google_dfareporting3d3/
api.rs

1#![allow(clippy::ptr_arg)]
2
3use std::collections::{BTreeSet, HashMap};
4
5use tokio::time::sleep;
6
7// ##############
8// UTILITIES ###
9// ############
10
11/// Identifies the an OAuth2 authorization scope.
12/// A scope is needed when requesting an
13/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
14#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
15pub enum Scope {
16    /// Manage DoubleClick Digital Marketing conversions
17    Ddmconversion,
18
19    /// View and manage DoubleClick for Advertisers reports
20    Full,
21
22    /// View and manage your DoubleClick Campaign Manager's (DCM) display ad campaigns
23    Dfatrafficking,
24}
25
26impl AsRef<str> for Scope {
27    fn as_ref(&self) -> &str {
28        match *self {
29            Scope::Ddmconversion => "https://www.googleapis.com/auth/ddmconversions",
30            Scope::Full => "https://www.googleapis.com/auth/dfareporting",
31            Scope::Dfatrafficking => "https://www.googleapis.com/auth/dfatrafficking",
32        }
33    }
34}
35
36#[allow(clippy::derivable_impls)]
37impl Default for Scope {
38    fn default() -> Scope {
39        Scope::Full
40    }
41}
42
43// ########
44// HUB ###
45// ######
46
47/// Central instance to access all Dfareporting related resource activities
48///
49/// # Examples
50///
51/// Instantiate a new hub
52///
53/// ```test_harness,no_run
54/// extern crate hyper;
55/// extern crate hyper_rustls;
56/// extern crate google_dfareporting3d3 as dfareporting3d3;
57/// use dfareporting3d3::{Result, Error};
58/// # async fn dox() {
59/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
60///
61/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
62/// // `client_secret`, among other things.
63/// let secret: yup_oauth2::ApplicationSecret = Default::default();
64/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
65/// // unless you replace  `None` with the desired Flow.
66/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
67/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
68/// // retrieve them from storage.
69/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
70///     secret,
71///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
72/// ).build().await.unwrap();
73///
74/// let client = hyper_util::client::legacy::Client::builder(
75///     hyper_util::rt::TokioExecutor::new()
76/// )
77/// .build(
78///     hyper_rustls::HttpsConnectorBuilder::new()
79///         .with_native_roots()
80///         .unwrap()
81///         .https_or_http()
82///         .enable_http1()
83///         .build()
84/// );
85/// let mut hub = Dfareporting::new(client, auth);
86/// // You can configure optional parameters by calling the respective setters at will, and
87/// // execute the final call using `doit()`.
88/// // Values shown here are possibly random and not representative !
89/// let result = hub.reports().files_list(-55, -62)
90///              .sort_order("Lorem")
91///              .sort_field("gubergren")
92///              .page_token("eos")
93///              .max_results(-4)
94///              .doit().await;
95///
96/// match result {
97///     Err(e) => match e {
98///         // The Error enum provides details about what exactly happened.
99///         // You can also just use its `Debug`, `Display` or `Error` traits
100///          Error::HttpError(_)
101///         |Error::Io(_)
102///         |Error::MissingAPIKey
103///         |Error::MissingToken(_)
104///         |Error::Cancelled
105///         |Error::UploadSizeLimitExceeded(_, _)
106///         |Error::Failure(_)
107///         |Error::BadRequest(_)
108///         |Error::FieldClash(_)
109///         |Error::JsonDecodeError(_, _) => println!("{}", e),
110///     },
111///     Ok(res) => println!("Success: {:?}", res),
112/// }
113/// # }
114/// ```
115#[derive(Clone)]
116pub struct Dfareporting<C> {
117    pub client: common::Client<C>,
118    pub auth: Box<dyn common::GetToken>,
119    _user_agent: String,
120    _base_url: String,
121    _root_url: String,
122}
123
124impl<C> common::Hub for Dfareporting<C> {}
125
126impl<'a, C> Dfareporting<C> {
127    pub fn new<A: 'static + common::GetToken>(
128        client: common::Client<C>,
129        auth: A,
130    ) -> Dfareporting<C> {
131        Dfareporting {
132            client,
133            auth: Box::new(auth),
134            _user_agent: "google-api-rust-client/6.0.0".to_string(),
135            _base_url: "https://dfareporting.googleapis.com/dfareporting/v3.3/".to_string(),
136            _root_url: "https://dfareporting.googleapis.com/".to_string(),
137        }
138    }
139
140    pub fn account_active_ad_summaries(&'a self) -> AccountActiveAdSummaryMethods<'a, C> {
141        AccountActiveAdSummaryMethods { hub: self }
142    }
143    pub fn account_permission_groups(&'a self) -> AccountPermissionGroupMethods<'a, C> {
144        AccountPermissionGroupMethods { hub: self }
145    }
146    pub fn account_permissions(&'a self) -> AccountPermissionMethods<'a, C> {
147        AccountPermissionMethods { hub: self }
148    }
149    pub fn account_user_profiles(&'a self) -> AccountUserProfileMethods<'a, C> {
150        AccountUserProfileMethods { hub: self }
151    }
152    pub fn accounts(&'a self) -> AccountMethods<'a, C> {
153        AccountMethods { hub: self }
154    }
155    pub fn ads(&'a self) -> AdMethods<'a, C> {
156        AdMethods { hub: self }
157    }
158    pub fn advertiser_groups(&'a self) -> AdvertiserGroupMethods<'a, C> {
159        AdvertiserGroupMethods { hub: self }
160    }
161    pub fn advertiser_landing_pages(&'a self) -> AdvertiserLandingPageMethods<'a, C> {
162        AdvertiserLandingPageMethods { hub: self }
163    }
164    pub fn advertisers(&'a self) -> AdvertiserMethods<'a, C> {
165        AdvertiserMethods { hub: self }
166    }
167    pub fn browsers(&'a self) -> BrowserMethods<'a, C> {
168        BrowserMethods { hub: self }
169    }
170    pub fn campaign_creative_associations(&'a self) -> CampaignCreativeAssociationMethods<'a, C> {
171        CampaignCreativeAssociationMethods { hub: self }
172    }
173    pub fn campaigns(&'a self) -> CampaignMethods<'a, C> {
174        CampaignMethods { hub: self }
175    }
176    pub fn change_logs(&'a self) -> ChangeLogMethods<'a, C> {
177        ChangeLogMethods { hub: self }
178    }
179    pub fn cities(&'a self) -> CityMethods<'a, C> {
180        CityMethods { hub: self }
181    }
182    pub fn connection_types(&'a self) -> ConnectionTypeMethods<'a, C> {
183        ConnectionTypeMethods { hub: self }
184    }
185    pub fn content_categories(&'a self) -> ContentCategoryMethods<'a, C> {
186        ContentCategoryMethods { hub: self }
187    }
188    pub fn conversions(&'a self) -> ConversionMethods<'a, C> {
189        ConversionMethods { hub: self }
190    }
191    pub fn countries(&'a self) -> CountryMethods<'a, C> {
192        CountryMethods { hub: self }
193    }
194    pub fn creative_assets(&'a self) -> CreativeAssetMethods<'a, C> {
195        CreativeAssetMethods { hub: self }
196    }
197    pub fn creative_field_values(&'a self) -> CreativeFieldValueMethods<'a, C> {
198        CreativeFieldValueMethods { hub: self }
199    }
200    pub fn creative_fields(&'a self) -> CreativeFieldMethods<'a, C> {
201        CreativeFieldMethods { hub: self }
202    }
203    pub fn creative_groups(&'a self) -> CreativeGroupMethods<'a, C> {
204        CreativeGroupMethods { hub: self }
205    }
206    pub fn creatives(&'a self) -> CreativeMethods<'a, C> {
207        CreativeMethods { hub: self }
208    }
209    pub fn dimension_values(&'a self) -> DimensionValueMethods<'a, C> {
210        DimensionValueMethods { hub: self }
211    }
212    pub fn directory_sites(&'a self) -> DirectorySiteMethods<'a, C> {
213        DirectorySiteMethods { hub: self }
214    }
215    pub fn dynamic_targeting_keys(&'a self) -> DynamicTargetingKeyMethods<'a, C> {
216        DynamicTargetingKeyMethods { hub: self }
217    }
218    pub fn event_tags(&'a self) -> EventTagMethods<'a, C> {
219        EventTagMethods { hub: self }
220    }
221    pub fn files(&'a self) -> FileMethods<'a, C> {
222        FileMethods { hub: self }
223    }
224    pub fn floodlight_activities(&'a self) -> FloodlightActivityMethods<'a, C> {
225        FloodlightActivityMethods { hub: self }
226    }
227    pub fn floodlight_activity_groups(&'a self) -> FloodlightActivityGroupMethods<'a, C> {
228        FloodlightActivityGroupMethods { hub: self }
229    }
230    pub fn floodlight_configurations(&'a self) -> FloodlightConfigurationMethods<'a, C> {
231        FloodlightConfigurationMethods { hub: self }
232    }
233    pub fn inventory_items(&'a self) -> InventoryItemMethods<'a, C> {
234        InventoryItemMethods { hub: self }
235    }
236    pub fn languages(&'a self) -> LanguageMethods<'a, C> {
237        LanguageMethods { hub: self }
238    }
239    pub fn metros(&'a self) -> MetroMethods<'a, C> {
240        MetroMethods { hub: self }
241    }
242    pub fn mobile_apps(&'a self) -> MobileAppMethods<'a, C> {
243        MobileAppMethods { hub: self }
244    }
245    pub fn mobile_carriers(&'a self) -> MobileCarrierMethods<'a, C> {
246        MobileCarrierMethods { hub: self }
247    }
248    pub fn operating_system_versions(&'a self) -> OperatingSystemVersionMethods<'a, C> {
249        OperatingSystemVersionMethods { hub: self }
250    }
251    pub fn operating_systems(&'a self) -> OperatingSystemMethods<'a, C> {
252        OperatingSystemMethods { hub: self }
253    }
254    pub fn order_documents(&'a self) -> OrderDocumentMethods<'a, C> {
255        OrderDocumentMethods { hub: self }
256    }
257    pub fn orders(&'a self) -> OrderMethods<'a, C> {
258        OrderMethods { hub: self }
259    }
260    pub fn placement_groups(&'a self) -> PlacementGroupMethods<'a, C> {
261        PlacementGroupMethods { hub: self }
262    }
263    pub fn placement_strategies(&'a self) -> PlacementStrategyMethods<'a, C> {
264        PlacementStrategyMethods { hub: self }
265    }
266    pub fn placements(&'a self) -> PlacementMethods<'a, C> {
267        PlacementMethods { hub: self }
268    }
269    pub fn platform_types(&'a self) -> PlatformTypeMethods<'a, C> {
270        PlatformTypeMethods { hub: self }
271    }
272    pub fn postal_codes(&'a self) -> PostalCodeMethods<'a, C> {
273        PostalCodeMethods { hub: self }
274    }
275    pub fn projects(&'a self) -> ProjectMethods<'a, C> {
276        ProjectMethods { hub: self }
277    }
278    pub fn regions(&'a self) -> RegionMethods<'a, C> {
279        RegionMethods { hub: self }
280    }
281    pub fn remarketing_list_shares(&'a self) -> RemarketingListShareMethods<'a, C> {
282        RemarketingListShareMethods { hub: self }
283    }
284    pub fn remarketing_lists(&'a self) -> RemarketingListMethods<'a, C> {
285        RemarketingListMethods { hub: self }
286    }
287    pub fn reports(&'a self) -> ReportMethods<'a, C> {
288        ReportMethods { hub: self }
289    }
290    pub fn sites(&'a self) -> SiteMethods<'a, C> {
291        SiteMethods { hub: self }
292    }
293    pub fn sizes(&'a self) -> SizeMethods<'a, C> {
294        SizeMethods { hub: self }
295    }
296    pub fn subaccounts(&'a self) -> SubaccountMethods<'a, C> {
297        SubaccountMethods { hub: self }
298    }
299    pub fn targetable_remarketing_lists(&'a self) -> TargetableRemarketingListMethods<'a, C> {
300        TargetableRemarketingListMethods { hub: self }
301    }
302    pub fn targeting_templates(&'a self) -> TargetingTemplateMethods<'a, C> {
303        TargetingTemplateMethods { hub: self }
304    }
305    pub fn user_profiles(&'a self) -> UserProfileMethods<'a, C> {
306        UserProfileMethods { hub: self }
307    }
308    pub fn user_role_permission_groups(&'a self) -> UserRolePermissionGroupMethods<'a, C> {
309        UserRolePermissionGroupMethods { hub: self }
310    }
311    pub fn user_role_permissions(&'a self) -> UserRolePermissionMethods<'a, C> {
312        UserRolePermissionMethods { hub: self }
313    }
314    pub fn user_roles(&'a self) -> UserRoleMethods<'a, C> {
315        UserRoleMethods { hub: self }
316    }
317    pub fn video_formats(&'a self) -> VideoFormatMethods<'a, C> {
318        VideoFormatMethods { hub: self }
319    }
320
321    /// Set the user-agent header field to use in all requests to the server.
322    /// It defaults to `google-api-rust-client/6.0.0`.
323    ///
324    /// Returns the previously set user-agent.
325    pub fn user_agent(&mut self, agent_name: String) -> String {
326        std::mem::replace(&mut self._user_agent, agent_name)
327    }
328
329    /// Set the base url to use in all requests to the server.
330    /// It defaults to `https://dfareporting.googleapis.com/dfareporting/v3.3/`.
331    ///
332    /// Returns the previously set base url.
333    pub fn base_url(&mut self, new_base_url: String) -> String {
334        std::mem::replace(&mut self._base_url, new_base_url)
335    }
336
337    /// Set the root url to use in all requests to the server.
338    /// It defaults to `https://dfareporting.googleapis.com/`.
339    ///
340    /// Returns the previously set root url.
341    pub fn root_url(&mut self, new_root_url: String) -> String {
342        std::mem::replace(&mut self._root_url, new_root_url)
343    }
344}
345
346// ############
347// SCHEMAS ###
348// ##########
349/// Contains properties of a Campaign Manager account.
350///
351/// # Activities
352///
353/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
354/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
355///
356/// * [get accounts](AccountGetCall) (response)
357/// * [list accounts](AccountListCall) (none)
358/// * [patch accounts](AccountPatchCall) (request|response)
359/// * [update accounts](AccountUpdateCall) (request|response)
360#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
361#[serde_with::serde_as]
362#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
363pub struct Account {
364    /// Account permissions assigned to this account.
365    #[serde(rename = "accountPermissionIds")]
366    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
367    pub account_permission_ids: Option<Vec<i64>>,
368    /// Profile for this account. This is a read-only field that can be left blank.
369    #[serde(rename = "accountProfile")]
370    pub account_profile: Option<String>,
371    /// Whether this account is active.
372    pub active: Option<bool>,
373    /// Maximum number of active ads allowed for this account.
374    #[serde(rename = "activeAdsLimitTier")]
375    pub active_ads_limit_tier: Option<String>,
376    /// Whether to serve creatives with Active View tags. If disabled, viewability data will not be available for any impressions.
377    #[serde(rename = "activeViewOptOut")]
378    pub active_view_opt_out: Option<bool>,
379    /// User role permissions available to the user roles of this account.
380    #[serde(rename = "availablePermissionIds")]
381    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
382    pub available_permission_ids: Option<Vec<i64>>,
383    /// ID of the country associated with this account.
384    #[serde(rename = "countryId")]
385    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
386    pub country_id: Option<i64>,
387    /// ID of currency associated with this account. This is a required field. Acceptable values are: - "1" for USD - "2" for GBP - "3" for ESP - "4" for SEK - "5" for CAD - "6" for JPY - "7" for DEM - "8" for AUD - "9" for FRF - "10" for ITL - "11" for DKK - "12" for NOK - "13" for FIM - "14" for ZAR - "15" for IEP - "16" for NLG - "17" for EUR - "18" for KRW - "19" for TWD - "20" for SGD - "21" for CNY - "22" for HKD - "23" for NZD - "24" for MYR - "25" for BRL - "26" for PTE - "28" for CLP - "29" for TRY - "30" for ARS - "31" for PEN - "32" for ILS - "33" for CHF - "34" for VEF - "35" for COP - "36" for GTQ - "37" for PLN - "39" for INR - "40" for THB - "41" for IDR - "42" for CZK - "43" for RON - "44" for HUF - "45" for RUB - "46" for AED - "47" for BGN - "48" for HRK - "49" for MXN - "50" for NGN - "51" for EGP
388    #[serde(rename = "currencyId")]
389    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
390    pub currency_id: Option<i64>,
391    /// Default placement dimensions for this account.
392    #[serde(rename = "defaultCreativeSizeId")]
393    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
394    pub default_creative_size_id: Option<i64>,
395    /// Description of this account.
396    pub description: Option<String>,
397    /// ID of this account. This is a read-only, auto-generated field.
398    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
399    pub id: Option<i64>,
400    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#account".
401    pub kind: Option<String>,
402    /// Locale of this account. Acceptable values are: - "cs" (Czech) - "de" (German) - "en" (English) - "en-GB" (English United Kingdom) - "es" (Spanish) - "fr" (French) - "it" (Italian) - "ja" (Japanese) - "ko" (Korean) - "pl" (Polish) - "pt-BR" (Portuguese Brazil) - "ru" (Russian) - "sv" (Swedish) - "tr" (Turkish) - "zh-CN" (Chinese Simplified) - "zh-TW" (Chinese Traditional)
403    pub locale: Option<String>,
404    /// Maximum image size allowed for this account, in kilobytes. Value must be greater than or equal to 1.
405    #[serde(rename = "maximumImageSize")]
406    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
407    pub maximum_image_size: Option<i64>,
408    /// Name of this account. This is a required field, and must be less than 128 characters long and be globally unique.
409    pub name: Option<String>,
410    /// Whether campaigns created in this account will be enabled for Nielsen OCR reach ratings by default.
411    #[serde(rename = "nielsenOcrEnabled")]
412    pub nielsen_ocr_enabled: Option<bool>,
413    /// Reporting configuration of this account.
414    #[serde(rename = "reportsConfiguration")]
415    pub reports_configuration: Option<ReportsConfiguration>,
416    /// Share Path to Conversion reports with Twitter.
417    #[serde(rename = "shareReportsWithTwitter")]
418    pub share_reports_with_twitter: Option<bool>,
419    /// File size limit in kilobytes of Rich Media teaser creatives. Acceptable values are 1 to 10240, inclusive.
420    #[serde(rename = "teaserSizeLimit")]
421    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
422    pub teaser_size_limit: Option<i64>,
423}
424
425impl common::RequestValue for Account {}
426impl common::Resource for Account {}
427impl common::ResponseResult for Account {}
428
429/// Gets a summary of active ads in an account.
430///
431/// # Activities
432///
433/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
434/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
435///
436/// * [get account active ad summaries](AccountActiveAdSummaryGetCall) (response)
437#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
438#[serde_with::serde_as]
439#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
440pub struct AccountActiveAdSummary {
441    /// ID of the account.
442    #[serde(rename = "accountId")]
443    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
444    pub account_id: Option<i64>,
445    /// Ads that have been activated for the account
446    #[serde(rename = "activeAds")]
447    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
448    pub active_ads: Option<i64>,
449    /// Maximum number of active ads allowed for the account.
450    #[serde(rename = "activeAdsLimitTier")]
451    pub active_ads_limit_tier: Option<String>,
452    /// Ads that can be activated for the account.
453    #[serde(rename = "availableAds")]
454    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
455    pub available_ads: Option<i64>,
456    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#accountActiveAdSummary".
457    pub kind: Option<String>,
458}
459
460impl common::ResponseResult for AccountActiveAdSummary {}
461
462/// AccountPermissions contains information about a particular account permission. Some features of Campaign Manager require an account permission to be present in the account.
463///
464/// # Activities
465///
466/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
467/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
468///
469/// * [get account permissions](AccountPermissionGetCall) (response)
470/// * [list account permissions](AccountPermissionListCall) (none)
471#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
472#[serde_with::serde_as]
473#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
474pub struct AccountPermission {
475    /// Account profiles associated with this account permission. Possible values are: - "ACCOUNT_PROFILE_BASIC" - "ACCOUNT_PROFILE_STANDARD"
476    #[serde(rename = "accountProfiles")]
477    pub account_profiles: Option<Vec<String>>,
478    /// ID of this account permission.
479    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
480    pub id: Option<i64>,
481    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#accountPermission".
482    pub kind: Option<String>,
483    /// Administrative level required to enable this account permission.
484    pub level: Option<String>,
485    /// Name of this account permission.
486    pub name: Option<String>,
487    /// Permission group of this account permission.
488    #[serde(rename = "permissionGroupId")]
489    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
490    pub permission_group_id: Option<i64>,
491}
492
493impl common::Resource for AccountPermission {}
494impl common::ResponseResult for AccountPermission {}
495
496/// AccountPermissionGroups contains a mapping of permission group IDs to names. A permission group is a grouping of account permissions.
497///
498/// # Activities
499///
500/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
501/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
502///
503/// * [get account permission groups](AccountPermissionGroupGetCall) (response)
504/// * [list account permission groups](AccountPermissionGroupListCall) (none)
505#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
506#[serde_with::serde_as]
507#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
508pub struct AccountPermissionGroup {
509    /// ID of this account permission group.
510    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
511    pub id: Option<i64>,
512    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#accountPermissionGroup".
513    pub kind: Option<String>,
514    /// Name of this account permission group.
515    pub name: Option<String>,
516}
517
518impl common::Resource for AccountPermissionGroup {}
519impl common::ResponseResult for AccountPermissionGroup {}
520
521/// Account Permission Group List Response
522///
523/// # Activities
524///
525/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
526/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
527///
528/// * [list account permission groups](AccountPermissionGroupListCall) (response)
529#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
530#[serde_with::serde_as]
531#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
532pub struct AccountPermissionGroupsListResponse {
533    /// Account permission group collection.
534    #[serde(rename = "accountPermissionGroups")]
535    pub account_permission_groups: Option<Vec<AccountPermissionGroup>>,
536    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#accountPermissionGroupsListResponse".
537    pub kind: Option<String>,
538}
539
540impl common::ResponseResult for AccountPermissionGroupsListResponse {}
541
542/// Account Permission List Response
543///
544/// # Activities
545///
546/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
547/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
548///
549/// * [list account permissions](AccountPermissionListCall) (response)
550#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
551#[serde_with::serde_as]
552#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
553pub struct AccountPermissionsListResponse {
554    /// Account permission collection.
555    #[serde(rename = "accountPermissions")]
556    pub account_permissions: Option<Vec<AccountPermission>>,
557    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#accountPermissionsListResponse".
558    pub kind: Option<String>,
559}
560
561impl common::ResponseResult for AccountPermissionsListResponse {}
562
563/// AccountUserProfiles contains properties of a Campaign Manager user profile. This resource is specifically for managing user profiles, whereas UserProfiles is for accessing the API.
564///
565/// # Activities
566///
567/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
568/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
569///
570/// * [get account user profiles](AccountUserProfileGetCall) (response)
571/// * [insert account user profiles](AccountUserProfileInsertCall) (request|response)
572/// * [list account user profiles](AccountUserProfileListCall) (none)
573/// * [patch account user profiles](AccountUserProfilePatchCall) (request|response)
574/// * [update account user profiles](AccountUserProfileUpdateCall) (request|response)
575#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
576#[serde_with::serde_as]
577#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
578pub struct AccountUserProfile {
579    /// Account ID of the user profile. This is a read-only field that can be left blank.
580    #[serde(rename = "accountId")]
581    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
582    pub account_id: Option<i64>,
583    /// Whether this user profile is active. This defaults to false, and must be set true on insert for the user profile to be usable.
584    pub active: Option<bool>,
585    /// Filter that describes which advertisers are visible to the user profile.
586    #[serde(rename = "advertiserFilter")]
587    pub advertiser_filter: Option<ObjectFilter>,
588    /// Filter that describes which campaigns are visible to the user profile.
589    #[serde(rename = "campaignFilter")]
590    pub campaign_filter: Option<ObjectFilter>,
591    /// Comments for this user profile.
592    pub comments: Option<String>,
593    /// Email of the user profile. The email addresss must be linked to a Google Account. This field is required on insertion and is read-only after insertion.
594    pub email: Option<String>,
595    /// ID of the user profile. This is a read-only, auto-generated field.
596    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
597    pub id: Option<i64>,
598    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#accountUserProfile".
599    pub kind: Option<String>,
600    /// Locale of the user profile. This is a required field. Acceptable values are: - "cs" (Czech) - "de" (German) - "en" (English) - "en-GB" (English United Kingdom) - "es" (Spanish) - "fr" (French) - "it" (Italian) - "ja" (Japanese) - "ko" (Korean) - "pl" (Polish) - "pt-BR" (Portuguese Brazil) - "ru" (Russian) - "sv" (Swedish) - "tr" (Turkish) - "zh-CN" (Chinese Simplified) - "zh-TW" (Chinese Traditional)
601    pub locale: Option<String>,
602    /// Name of the user profile. This is a required field. Must be less than 64 characters long, must be globally unique, and cannot contain whitespace or any of the following characters: "&;<>"#%,".
603    pub name: Option<String>,
604    /// Filter that describes which sites are visible to the user profile.
605    #[serde(rename = "siteFilter")]
606    pub site_filter: Option<ObjectFilter>,
607    /// Subaccount ID of the user profile. This is a read-only field that can be left blank.
608    #[serde(rename = "subaccountId")]
609    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
610    pub subaccount_id: Option<i64>,
611    /// Trafficker type of this user profile. This is a read-only field.
612    #[serde(rename = "traffickerType")]
613    pub trafficker_type: Option<String>,
614    /// User type of the user profile. This is a read-only field that can be left blank.
615    #[serde(rename = "userAccessType")]
616    pub user_access_type: Option<String>,
617    /// Filter that describes which user roles are visible to the user profile.
618    #[serde(rename = "userRoleFilter")]
619    pub user_role_filter: Option<ObjectFilter>,
620    /// User role ID of the user profile. This is a required field.
621    #[serde(rename = "userRoleId")]
622    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
623    pub user_role_id: Option<i64>,
624}
625
626impl common::RequestValue for AccountUserProfile {}
627impl common::Resource for AccountUserProfile {}
628impl common::ResponseResult for AccountUserProfile {}
629
630/// Account User Profile List Response
631///
632/// # Activities
633///
634/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
635/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
636///
637/// * [list account user profiles](AccountUserProfileListCall) (response)
638#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
639#[serde_with::serde_as]
640#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
641pub struct AccountUserProfilesListResponse {
642    /// Account user profile collection.
643    #[serde(rename = "accountUserProfiles")]
644    pub account_user_profiles: Option<Vec<AccountUserProfile>>,
645    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#accountUserProfilesListResponse".
646    pub kind: Option<String>,
647    /// Pagination token to be used for the next list operation.
648    #[serde(rename = "nextPageToken")]
649    pub next_page_token: Option<String>,
650}
651
652impl common::ResponseResult for AccountUserProfilesListResponse {}
653
654/// Account List Response
655///
656/// # Activities
657///
658/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
659/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
660///
661/// * [list accounts](AccountListCall) (response)
662#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
663#[serde_with::serde_as]
664#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
665pub struct AccountsListResponse {
666    /// Account collection.
667    pub accounts: Option<Vec<Account>>,
668    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#accountsListResponse".
669    pub kind: Option<String>,
670    /// Pagination token to be used for the next list operation.
671    #[serde(rename = "nextPageToken")]
672    pub next_page_token: Option<String>,
673}
674
675impl common::ResponseResult for AccountsListResponse {}
676
677/// Represents an activity group.
678///
679/// This type is not used in any activity, and only used as *part* of another schema.
680///
681#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
682#[serde_with::serde_as]
683#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
684pub struct Activities {
685    /// List of activity filters. The dimension values need to be all either of type "dfa:activity" or "dfa:activityGroup".
686    pub filters: Option<Vec<DimensionValue>>,
687    /// The kind of resource this is, in this case dfareporting#activities.
688    pub kind: Option<String>,
689    /// List of names of floodlight activity metrics.
690    #[serde(rename = "metricNames")]
691    pub metric_names: Option<Vec<String>>,
692}
693
694impl common::Part for Activities {}
695
696/// Contains properties of a Campaign Manager ad.
697///
698/// # Activities
699///
700/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
701/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
702///
703/// * [get ads](AdGetCall) (response)
704/// * [insert ads](AdInsertCall) (request|response)
705/// * [list ads](AdListCall) (none)
706/// * [patch ads](AdPatchCall) (request|response)
707/// * [update ads](AdUpdateCall) (request|response)
708#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
709#[serde_with::serde_as]
710#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
711pub struct Ad {
712    /// Account ID of this ad. This is a read-only field that can be left blank.
713    #[serde(rename = "accountId")]
714    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
715    pub account_id: Option<i64>,
716    /// Whether this ad is active. When true, archived must be false.
717    pub active: Option<bool>,
718    /// Advertiser ID of this ad. This is a required field on insertion.
719    #[serde(rename = "advertiserId")]
720    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
721    pub advertiser_id: Option<i64>,
722    /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field.
723    #[serde(rename = "advertiserIdDimensionValue")]
724    pub advertiser_id_dimension_value: Option<DimensionValue>,
725    /// Whether this ad is archived. When true, active must be false.
726    pub archived: Option<bool>,
727    /// Audience segment ID that is being targeted for this ad. Applicable when type is AD_SERVING_STANDARD_AD.
728    #[serde(rename = "audienceSegmentId")]
729    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
730    pub audience_segment_id: Option<i64>,
731    /// Campaign ID of this ad. This is a required field on insertion.
732    #[serde(rename = "campaignId")]
733    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
734    pub campaign_id: Option<i64>,
735    /// Dimension value for the ID of the campaign. This is a read-only, auto-generated field.
736    #[serde(rename = "campaignIdDimensionValue")]
737    pub campaign_id_dimension_value: Option<DimensionValue>,
738    /// Click-through URL for this ad. This is a required field on insertion. Applicable when type is AD_SERVING_CLICK_TRACKER.
739    #[serde(rename = "clickThroughUrl")]
740    pub click_through_url: Option<ClickThroughUrl>,
741    /// Click-through URL suffix properties for this ad. Applies to the URL in the ad or (if overriding ad properties) the URL in the creative.
742    #[serde(rename = "clickThroughUrlSuffixProperties")]
743    pub click_through_url_suffix_properties: Option<ClickThroughUrlSuffixProperties>,
744    /// Comments for this ad.
745    pub comments: Option<String>,
746    /// Compatibility of this ad. Applicable when type is AD_SERVING_DEFAULT_AD. DISPLAY and DISPLAY_INTERSTITIAL refer to either rendering on desktop or on mobile devices or in mobile apps for regular or interstitial ads, respectively. APP and APP_INTERSTITIAL are only used for existing default ads. New mobile placements must be assigned DISPLAY or DISPLAY_INTERSTITIAL and default ads created for those placements will be limited to those compatibility types. IN_STREAM_VIDEO refers to rendering in-stream video ads developed with the VAST standard.
747    pub compatibility: Option<String>,
748    /// Information about the creation of this ad. This is a read-only field.
749    #[serde(rename = "createInfo")]
750    pub create_info: Option<LastModifiedInfo>,
751    /// Creative group assignments for this ad. Applicable when type is AD_SERVING_CLICK_TRACKER. Only one assignment per creative group number is allowed for a maximum of two assignments.
752    #[serde(rename = "creativeGroupAssignments")]
753    pub creative_group_assignments: Option<Vec<CreativeGroupAssignment>>,
754    /// Creative rotation for this ad. Applicable when type is AD_SERVING_DEFAULT_AD, AD_SERVING_STANDARD_AD, or AD_SERVING_TRACKING. When type is AD_SERVING_DEFAULT_AD, this field should have exactly one creativeAssignment .
755    #[serde(rename = "creativeRotation")]
756    pub creative_rotation: Option<CreativeRotation>,
757    /// Time and day targeting information for this ad. This field must be left blank if the ad is using a targeting template. Applicable when type is AD_SERVING_STANDARD_AD.
758    #[serde(rename = "dayPartTargeting")]
759    pub day_part_targeting: Option<DayPartTargeting>,
760    /// Default click-through event tag properties for this ad.
761    #[serde(rename = "defaultClickThroughEventTagProperties")]
762    pub default_click_through_event_tag_properties: Option<DefaultClickThroughEventTagProperties>,
763    /// Delivery schedule information for this ad. Applicable when type is AD_SERVING_STANDARD_AD or AD_SERVING_TRACKING. This field along with subfields priority and impressionRatio are required on insertion when type is AD_SERVING_STANDARD_AD.
764    #[serde(rename = "deliverySchedule")]
765    pub delivery_schedule: Option<DeliverySchedule>,
766    /// Whether this ad is a dynamic click tracker. Applicable when type is AD_SERVING_CLICK_TRACKER. This is a required field on insert, and is read-only after insert.
767    #[serde(rename = "dynamicClickTracker")]
768    pub dynamic_click_tracker: Option<bool>,
769    /// no description provided
770    #[serde(rename = "endTime")]
771    pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
772    /// Event tag overrides for this ad.
773    #[serde(rename = "eventTagOverrides")]
774    pub event_tag_overrides: Option<Vec<EventTagOverride>>,
775    /// Geographical targeting information for this ad. This field must be left blank if the ad is using a targeting template. Applicable when type is AD_SERVING_STANDARD_AD.
776    #[serde(rename = "geoTargeting")]
777    pub geo_targeting: Option<GeoTargeting>,
778    /// ID of this ad. This is a read-only, auto-generated field.
779    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
780    pub id: Option<i64>,
781    /// Dimension value for the ID of this ad. This is a read-only, auto-generated field.
782    #[serde(rename = "idDimensionValue")]
783    pub id_dimension_value: Option<DimensionValue>,
784    /// Key-value targeting information for this ad. This field must be left blank if the ad is using a targeting template. Applicable when type is AD_SERVING_STANDARD_AD.
785    #[serde(rename = "keyValueTargetingExpression")]
786    pub key_value_targeting_expression: Option<KeyValueTargetingExpression>,
787    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#ad".
788    pub kind: Option<String>,
789    /// Language targeting information for this ad. This field must be left blank if the ad is using a targeting template. Applicable when type is AD_SERVING_STANDARD_AD.
790    #[serde(rename = "languageTargeting")]
791    pub language_targeting: Option<LanguageTargeting>,
792    /// Information about the most recent modification of this ad. This is a read-only field.
793    #[serde(rename = "lastModifiedInfo")]
794    pub last_modified_info: Option<LastModifiedInfo>,
795    /// Name of this ad. This is a required field and must be less than 256 characters long.
796    pub name: Option<String>,
797    /// Placement assignments for this ad.
798    #[serde(rename = "placementAssignments")]
799    pub placement_assignments: Option<Vec<PlacementAssignment>>,
800    /// Remarketing list targeting expression for this ad. This field must be left blank if the ad is using a targeting template. Applicable when type is AD_SERVING_STANDARD_AD.
801    #[serde(rename = "remarketingListExpression")]
802    pub remarketing_list_expression: Option<ListTargetingExpression>,
803    /// Size of this ad. Applicable when type is AD_SERVING_DEFAULT_AD.
804    pub size: Option<Size>,
805    /// Whether this ad is ssl compliant. This is a read-only field that is auto-generated when the ad is inserted or updated.
806    #[serde(rename = "sslCompliant")]
807    pub ssl_compliant: Option<bool>,
808    /// Whether this ad requires ssl. This is a read-only field that is auto-generated when the ad is inserted or updated.
809    #[serde(rename = "sslRequired")]
810    pub ssl_required: Option<bool>,
811    /// no description provided
812    #[serde(rename = "startTime")]
813    pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
814    /// Subaccount ID of this ad. This is a read-only field that can be left blank.
815    #[serde(rename = "subaccountId")]
816    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
817    pub subaccount_id: Option<i64>,
818    /// Targeting template ID, used to apply preconfigured targeting information to this ad. This cannot be set while any of dayPartTargeting, geoTargeting, keyValueTargetingExpression, languageTargeting, remarketingListExpression, or technologyTargeting are set. Applicable when type is AD_SERVING_STANDARD_AD.
819    #[serde(rename = "targetingTemplateId")]
820    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
821    pub targeting_template_id: Option<i64>,
822    /// Technology platform targeting information for this ad. This field must be left blank if the ad is using a targeting template. Applicable when type is AD_SERVING_STANDARD_AD.
823    #[serde(rename = "technologyTargeting")]
824    pub technology_targeting: Option<TechnologyTargeting>,
825    /// Type of ad. This is a required field on insertion. Note that default ads ( AD_SERVING_DEFAULT_AD) cannot be created directly (see Creative resource).
826    #[serde(rename = "type")]
827    pub type_: Option<String>,
828}
829
830impl common::RequestValue for Ad {}
831impl common::Resource for Ad {}
832impl common::ResponseResult for Ad {}
833
834/// Campaign ad blocking settings.
835///
836/// This type is not used in any activity, and only used as *part* of another schema.
837///
838#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
839#[serde_with::serde_as]
840#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
841pub struct AdBlockingConfiguration {
842    /// Click-through URL used by brand-neutral ads. This is a required field when overrideClickThroughUrl is set to true.
843    #[serde(rename = "clickThroughUrl")]
844    pub click_through_url: Option<String>,
845    /// ID of a creative bundle to use for this campaign. If set, brand-neutral ads will select creatives from this bundle. Otherwise, a default transparent pixel will be used.
846    #[serde(rename = "creativeBundleId")]
847    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
848    pub creative_bundle_id: Option<i64>,
849    /// Whether this campaign has enabled ad blocking. When true, ad blocking is enabled for placements in the campaign, but this may be overridden by site and placement settings. When false, ad blocking is disabled for all placements under the campaign, regardless of site and placement settings.
850    pub enabled: Option<bool>,
851    /// Whether the brand-neutral ad's click-through URL comes from the campaign's creative bundle or the override URL. Must be set to true if ad blocking is enabled and no creative bundle is configured.
852    #[serde(rename = "overrideClickThroughUrl")]
853    pub override_click_through_url: Option<bool>,
854}
855
856impl common::Part for AdBlockingConfiguration {}
857
858/// Ad Slot
859///
860/// This type is not used in any activity, and only used as *part* of another schema.
861///
862#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
863#[serde_with::serde_as]
864#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
865pub struct AdSlot {
866    /// Comment for this ad slot.
867    pub comment: Option<String>,
868    /// Ad slot compatibility. DISPLAY and DISPLAY_INTERSTITIAL refer to rendering either on desktop, mobile devices or in mobile apps for regular or interstitial ads respectively. APP and APP_INTERSTITIAL are for rendering in mobile apps. IN_STREAM_VIDEO refers to rendering in in-stream video ads developed with the VAST standard.
869    pub compatibility: Option<String>,
870    /// Height of this ad slot.
871    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
872    pub height: Option<i64>,
873    /// ID of the placement from an external platform that is linked to this ad slot.
874    #[serde(rename = "linkedPlacementId")]
875    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
876    pub linked_placement_id: Option<i64>,
877    /// Name of this ad slot.
878    pub name: Option<String>,
879    /// Payment source type of this ad slot.
880    #[serde(rename = "paymentSourceType")]
881    pub payment_source_type: Option<String>,
882    /// Primary ad slot of a roadblock inventory item.
883    pub primary: Option<bool>,
884    /// Width of this ad slot.
885    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
886    pub width: Option<i64>,
887}
888
889impl common::Part for AdSlot {}
890
891/// Ad List Response
892///
893/// # Activities
894///
895/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
896/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
897///
898/// * [list ads](AdListCall) (response)
899#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
900#[serde_with::serde_as]
901#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
902pub struct AdsListResponse {
903    /// Ad collection.
904    pub ads: Option<Vec<Ad>>,
905    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#adsListResponse".
906    pub kind: Option<String>,
907    /// Pagination token to be used for the next list operation.
908    #[serde(rename = "nextPageToken")]
909    pub next_page_token: Option<String>,
910}
911
912impl common::ResponseResult for AdsListResponse {}
913
914/// Contains properties of a Campaign Manager advertiser.
915///
916/// # Activities
917///
918/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
919/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
920///
921/// * [get advertisers](AdvertiserGetCall) (response)
922/// * [insert advertisers](AdvertiserInsertCall) (request|response)
923/// * [list advertisers](AdvertiserListCall) (none)
924/// * [patch advertisers](AdvertiserPatchCall) (request|response)
925/// * [update advertisers](AdvertiserUpdateCall) (request|response)
926#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
927#[serde_with::serde_as]
928#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
929pub struct Advertiser {
930    /// Account ID of this advertiser.This is a read-only field that can be left blank.
931    #[serde(rename = "accountId")]
932    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
933    pub account_id: Option<i64>,
934    /// ID of the advertiser group this advertiser belongs to. You can group advertisers for reporting purposes, allowing you to see aggregated information for all advertisers in each group.
935    #[serde(rename = "advertiserGroupId")]
936    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
937    pub advertiser_group_id: Option<i64>,
938    /// Suffix added to click-through URL of ad creative associations under this advertiser. Must be less than 129 characters long.
939    #[serde(rename = "clickThroughUrlSuffix")]
940    pub click_through_url_suffix: Option<String>,
941    /// ID of the click-through event tag to apply by default to the landing pages of this advertiser's campaigns.
942    #[serde(rename = "defaultClickThroughEventTagId")]
943    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
944    pub default_click_through_event_tag_id: Option<i64>,
945    /// Default email address used in sender field for tag emails.
946    #[serde(rename = "defaultEmail")]
947    pub default_email: Option<String>,
948    /// Floodlight configuration ID of this advertiser. The floodlight configuration ID will be created automatically, so on insert this field should be left blank. This field can be set to another advertiser's floodlight configuration ID in order to share that advertiser's floodlight configuration with this advertiser, so long as: - This advertiser's original floodlight configuration is not already associated with floodlight activities or floodlight activity groups. - This advertiser's original floodlight configuration is not already shared with another advertiser.
949    #[serde(rename = "floodlightConfigurationId")]
950    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
951    pub floodlight_configuration_id: Option<i64>,
952    /// Dimension value for the ID of the floodlight configuration. This is a read-only, auto-generated field.
953    #[serde(rename = "floodlightConfigurationIdDimensionValue")]
954    pub floodlight_configuration_id_dimension_value: Option<DimensionValue>,
955    /// ID of this advertiser. This is a read-only, auto-generated field.
956    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
957    pub id: Option<i64>,
958    /// Dimension value for the ID of this advertiser. This is a read-only, auto-generated field.
959    #[serde(rename = "idDimensionValue")]
960    pub id_dimension_value: Option<DimensionValue>,
961    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#advertiser".
962    pub kind: Option<String>,
963    /// Name of this advertiser. This is a required field and must be less than 256 characters long and unique among advertisers of the same account.
964    pub name: Option<String>,
965    /// Original floodlight configuration before any sharing occurred. Set the floodlightConfigurationId of this advertiser to originalFloodlightConfigurationId to unshare the advertiser's current floodlight configuration. You cannot unshare an advertiser's floodlight configuration if the shared configuration has activities associated with any campaign or placement.
966    #[serde(rename = "originalFloodlightConfigurationId")]
967    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
968    pub original_floodlight_configuration_id: Option<i64>,
969    /// Status of this advertiser.
970    pub status: Option<String>,
971    /// Subaccount ID of this advertiser.This is a read-only field that can be left blank.
972    #[serde(rename = "subaccountId")]
973    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
974    pub subaccount_id: Option<i64>,
975    /// Suspension status of this advertiser.
976    pub suspended: Option<bool>,
977}
978
979impl common::RequestValue for Advertiser {}
980impl common::Resource for Advertiser {}
981impl common::ResponseResult for Advertiser {}
982
983/// Groups advertisers together so that reports can be generated for the entire group at once.
984///
985/// # Activities
986///
987/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
988/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
989///
990/// * [delete advertiser groups](AdvertiserGroupDeleteCall) (none)
991/// * [get advertiser groups](AdvertiserGroupGetCall) (response)
992/// * [insert advertiser groups](AdvertiserGroupInsertCall) (request|response)
993/// * [list advertiser groups](AdvertiserGroupListCall) (none)
994/// * [patch advertiser groups](AdvertiserGroupPatchCall) (request|response)
995/// * [update advertiser groups](AdvertiserGroupUpdateCall) (request|response)
996#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
997#[serde_with::serde_as]
998#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
999pub struct AdvertiserGroup {
1000    /// Account ID of this advertiser group. This is a read-only field that can be left blank.
1001    #[serde(rename = "accountId")]
1002    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1003    pub account_id: Option<i64>,
1004    /// ID of this advertiser group. This is a read-only, auto-generated field.
1005    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1006    pub id: Option<i64>,
1007    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#advertiserGroup".
1008    pub kind: Option<String>,
1009    /// Name of this advertiser group. This is a required field and must be less than 256 characters long and unique among advertiser groups of the same account.
1010    pub name: Option<String>,
1011}
1012
1013impl common::RequestValue for AdvertiserGroup {}
1014impl common::Resource for AdvertiserGroup {}
1015impl common::ResponseResult for AdvertiserGroup {}
1016
1017/// Advertiser Group List Response
1018///
1019/// # Activities
1020///
1021/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1022/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1023///
1024/// * [list advertiser groups](AdvertiserGroupListCall) (response)
1025#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1026#[serde_with::serde_as]
1027#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1028pub struct AdvertiserGroupsListResponse {
1029    /// Advertiser group collection.
1030    #[serde(rename = "advertiserGroups")]
1031    pub advertiser_groups: Option<Vec<AdvertiserGroup>>,
1032    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#advertiserGroupsListResponse".
1033    pub kind: Option<String>,
1034    /// Pagination token to be used for the next list operation.
1035    #[serde(rename = "nextPageToken")]
1036    pub next_page_token: Option<String>,
1037}
1038
1039impl common::ResponseResult for AdvertiserGroupsListResponse {}
1040
1041/// Landing Page List Response
1042///
1043/// # Activities
1044///
1045/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1046/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1047///
1048/// * [list advertiser landing pages](AdvertiserLandingPageListCall) (response)
1049#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1050#[serde_with::serde_as]
1051#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1052pub struct AdvertiserLandingPagesListResponse {
1053    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#advertiserLandingPagesListResponse".
1054    pub kind: Option<String>,
1055    /// Landing page collection
1056    #[serde(rename = "landingPages")]
1057    pub landing_pages: Option<Vec<LandingPage>>,
1058    /// Pagination token to be used for the next list operation.
1059    #[serde(rename = "nextPageToken")]
1060    pub next_page_token: Option<String>,
1061}
1062
1063impl common::ResponseResult for AdvertiserLandingPagesListResponse {}
1064
1065/// Advertiser List Response
1066///
1067/// # Activities
1068///
1069/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1070/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1071///
1072/// * [list advertisers](AdvertiserListCall) (response)
1073#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1074#[serde_with::serde_as]
1075#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1076pub struct AdvertisersListResponse {
1077    /// Advertiser collection.
1078    pub advertisers: Option<Vec<Advertiser>>,
1079    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#advertisersListResponse".
1080    pub kind: Option<String>,
1081    /// Pagination token to be used for the next list operation.
1082    #[serde(rename = "nextPageToken")]
1083    pub next_page_token: Option<String>,
1084}
1085
1086impl common::ResponseResult for AdvertisersListResponse {}
1087
1088/// Audience Segment.
1089///
1090/// This type is not used in any activity, and only used as *part* of another schema.
1091///
1092#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1093#[serde_with::serde_as]
1094#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1095pub struct AudienceSegment {
1096    /// Weight allocated to this segment. The weight assigned will be understood in proportion to the weights assigned to other segments in the same segment group. Acceptable values are 1 to 1000, inclusive.
1097    pub allocation: Option<i32>,
1098    /// ID of this audience segment. This is a read-only, auto-generated field.
1099    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1100    pub id: Option<i64>,
1101    /// Name of this audience segment. This is a required field and must be less than 65 characters long.
1102    pub name: Option<String>,
1103}
1104
1105impl common::Part for AudienceSegment {}
1106
1107/// Audience Segment Group.
1108///
1109/// This type is not used in any activity, and only used as *part* of another schema.
1110///
1111#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1112#[serde_with::serde_as]
1113#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1114pub struct AudienceSegmentGroup {
1115    /// Audience segments assigned to this group. The number of segments must be between 2 and 100.
1116    #[serde(rename = "audienceSegments")]
1117    pub audience_segments: Option<Vec<AudienceSegment>>,
1118    /// ID of this audience segment group. This is a read-only, auto-generated field.
1119    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1120    pub id: Option<i64>,
1121    /// Name of this audience segment group. This is a required field and must be less than 65 characters long.
1122    pub name: Option<String>,
1123}
1124
1125impl common::Part for AudienceSegmentGroup {}
1126
1127/// Contains information about a browser that can be targeted by ads.
1128///
1129/// # Activities
1130///
1131/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1132/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1133///
1134/// * [list browsers](BrowserListCall) (none)
1135#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1136#[serde_with::serde_as]
1137#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1138pub struct Browser {
1139    /// ID referring to this grouping of browser and version numbers. This is the ID used for targeting.
1140    #[serde(rename = "browserVersionId")]
1141    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1142    pub browser_version_id: Option<i64>,
1143    /// DART ID of this browser. This is the ID used when generating reports.
1144    #[serde(rename = "dartId")]
1145    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1146    pub dart_id: Option<i64>,
1147    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#browser".
1148    pub kind: Option<String>,
1149    /// Major version number (leftmost number) of this browser. For example, for Chrome 5.0.376.86 beta, this field should be set to 5. An asterisk (*) may be used to target any version number, and a question mark (?) may be used to target cases where the version number cannot be identified. For example, Chrome *.* targets any version of Chrome: 1.2, 2.5, 3.5, and so on. Chrome 3.* targets Chrome 3.1, 3.5, but not 4.0. Firefox ?.? targets cases where the ad server knows the browser is Firefox but can't tell which version it is.
1150    #[serde(rename = "majorVersion")]
1151    pub major_version: Option<String>,
1152    /// Minor version number (number after first dot on left) of this browser. For example, for Chrome 5.0.375.86 beta, this field should be set to 0. An asterisk (*) may be used to target any version number, and a question mark (?) may be used to target cases where the version number cannot be identified. For example, Chrome *.* targets any version of Chrome: 1.2, 2.5, 3.5, and so on. Chrome 3.* targets Chrome 3.1, 3.5, but not 4.0. Firefox ?.? targets cases where the ad server knows the browser is Firefox but can't tell which version it is.
1153    #[serde(rename = "minorVersion")]
1154    pub minor_version: Option<String>,
1155    /// Name of this browser.
1156    pub name: Option<String>,
1157}
1158
1159impl common::Resource for Browser {}
1160
1161/// Browser List Response
1162///
1163/// # Activities
1164///
1165/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1166/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1167///
1168/// * [list browsers](BrowserListCall) (response)
1169#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1170#[serde_with::serde_as]
1171#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1172pub struct BrowsersListResponse {
1173    /// Browser collection.
1174    pub browsers: Option<Vec<Browser>>,
1175    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#browsersListResponse".
1176    pub kind: Option<String>,
1177}
1178
1179impl common::ResponseResult for BrowsersListResponse {}
1180
1181/// Contains properties of a Campaign Manager campaign.
1182///
1183/// # Activities
1184///
1185/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1186/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1187///
1188/// * [get campaigns](CampaignGetCall) (response)
1189/// * [insert campaigns](CampaignInsertCall) (request|response)
1190/// * [list campaigns](CampaignListCall) (none)
1191/// * [patch campaigns](CampaignPatchCall) (request|response)
1192/// * [update campaigns](CampaignUpdateCall) (request|response)
1193#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1194#[serde_with::serde_as]
1195#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1196pub struct Campaign {
1197    /// Account ID of this campaign. This is a read-only field that can be left blank.
1198    #[serde(rename = "accountId")]
1199    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1200    pub account_id: Option<i64>,
1201    /// Ad blocking settings for this campaign.
1202    #[serde(rename = "adBlockingConfiguration")]
1203    pub ad_blocking_configuration: Option<AdBlockingConfiguration>,
1204    /// Additional creative optimization configurations for the campaign.
1205    #[serde(rename = "additionalCreativeOptimizationConfigurations")]
1206    pub additional_creative_optimization_configurations:
1207        Option<Vec<CreativeOptimizationConfiguration>>,
1208    /// Advertiser group ID of the associated advertiser.
1209    #[serde(rename = "advertiserGroupId")]
1210    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1211    pub advertiser_group_id: Option<i64>,
1212    /// Advertiser ID of this campaign. This is a required field.
1213    #[serde(rename = "advertiserId")]
1214    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1215    pub advertiser_id: Option<i64>,
1216    /// Dimension value for the advertiser ID of this campaign. This is a read-only, auto-generated field.
1217    #[serde(rename = "advertiserIdDimensionValue")]
1218    pub advertiser_id_dimension_value: Option<DimensionValue>,
1219    /// Whether this campaign has been archived.
1220    pub archived: Option<bool>,
1221    /// Audience segment groups assigned to this campaign. Cannot have more than 300 segment groups.
1222    #[serde(rename = "audienceSegmentGroups")]
1223    pub audience_segment_groups: Option<Vec<AudienceSegmentGroup>>,
1224    /// Billing invoice code included in the Campaign Manager client billing invoices associated with the campaign.
1225    #[serde(rename = "billingInvoiceCode")]
1226    pub billing_invoice_code: Option<String>,
1227    /// Click-through URL suffix override properties for this campaign.
1228    #[serde(rename = "clickThroughUrlSuffixProperties")]
1229    pub click_through_url_suffix_properties: Option<ClickThroughUrlSuffixProperties>,
1230    /// Arbitrary comments about this campaign. Must be less than 256 characters long.
1231    pub comment: Option<String>,
1232    /// Information about the creation of this campaign. This is a read-only field.
1233    #[serde(rename = "createInfo")]
1234    pub create_info: Option<LastModifiedInfo>,
1235    /// List of creative group IDs that are assigned to the campaign.
1236    #[serde(rename = "creativeGroupIds")]
1237    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
1238    pub creative_group_ids: Option<Vec<i64>>,
1239    /// Creative optimization configuration for the campaign.
1240    #[serde(rename = "creativeOptimizationConfiguration")]
1241    pub creative_optimization_configuration: Option<CreativeOptimizationConfiguration>,
1242    /// Click-through event tag ID override properties for this campaign.
1243    #[serde(rename = "defaultClickThroughEventTagProperties")]
1244    pub default_click_through_event_tag_properties: Option<DefaultClickThroughEventTagProperties>,
1245    /// The default landing page ID for this campaign.
1246    #[serde(rename = "defaultLandingPageId")]
1247    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1248    pub default_landing_page_id: Option<i64>,
1249    /// no description provided
1250    #[serde(rename = "endDate")]
1251    pub end_date: Option<chrono::NaiveDate>,
1252    /// Overrides that can be used to activate or deactivate advertiser event tags.
1253    #[serde(rename = "eventTagOverrides")]
1254    pub event_tag_overrides: Option<Vec<EventTagOverride>>,
1255    /// External ID for this campaign.
1256    #[serde(rename = "externalId")]
1257    pub external_id: Option<String>,
1258    /// ID of this campaign. This is a read-only auto-generated field.
1259    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1260    pub id: Option<i64>,
1261    /// Dimension value for the ID of this campaign. This is a read-only, auto-generated field.
1262    #[serde(rename = "idDimensionValue")]
1263    pub id_dimension_value: Option<DimensionValue>,
1264    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#campaign".
1265    pub kind: Option<String>,
1266    /// Information about the most recent modification of this campaign. This is a read-only field.
1267    #[serde(rename = "lastModifiedInfo")]
1268    pub last_modified_info: Option<LastModifiedInfo>,
1269    /// Name of this campaign. This is a required field and must be less than 256 characters long and unique among campaigns of the same advertiser.
1270    pub name: Option<String>,
1271    /// Whether Nielsen reports are enabled for this campaign.
1272    #[serde(rename = "nielsenOcrEnabled")]
1273    pub nielsen_ocr_enabled: Option<bool>,
1274    /// no description provided
1275    #[serde(rename = "startDate")]
1276    pub start_date: Option<chrono::NaiveDate>,
1277    /// Subaccount ID of this campaign. This is a read-only field that can be left blank.
1278    #[serde(rename = "subaccountId")]
1279    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1280    pub subaccount_id: Option<i64>,
1281    /// Campaign trafficker contact emails.
1282    #[serde(rename = "traffickerEmails")]
1283    pub trafficker_emails: Option<Vec<String>>,
1284}
1285
1286impl common::RequestValue for Campaign {}
1287impl common::Resource for Campaign {}
1288impl common::ResponseResult for Campaign {}
1289
1290/// Identifies a creative which has been associated with a given campaign.
1291///
1292/// # Activities
1293///
1294/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1295/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1296///
1297/// * [insert campaign creative associations](CampaignCreativeAssociationInsertCall) (request|response)
1298/// * [list campaign creative associations](CampaignCreativeAssociationListCall) (none)
1299#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1300#[serde_with::serde_as]
1301#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1302pub struct CampaignCreativeAssociation {
1303    /// ID of the creative associated with the campaign. This is a required field.
1304    #[serde(rename = "creativeId")]
1305    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1306    pub creative_id: Option<i64>,
1307    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#campaignCreativeAssociation".
1308    pub kind: Option<String>,
1309}
1310
1311impl common::RequestValue for CampaignCreativeAssociation {}
1312impl common::Resource for CampaignCreativeAssociation {}
1313impl common::ResponseResult for CampaignCreativeAssociation {}
1314
1315/// Campaign Creative Association List Response
1316///
1317/// # Activities
1318///
1319/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1320/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1321///
1322/// * [list campaign creative associations](CampaignCreativeAssociationListCall) (response)
1323#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1324#[serde_with::serde_as]
1325#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1326pub struct CampaignCreativeAssociationsListResponse {
1327    /// Campaign creative association collection
1328    #[serde(rename = "campaignCreativeAssociations")]
1329    pub campaign_creative_associations: Option<Vec<CampaignCreativeAssociation>>,
1330    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#campaignCreativeAssociationsListResponse".
1331    pub kind: Option<String>,
1332    /// Pagination token to be used for the next list operation.
1333    #[serde(rename = "nextPageToken")]
1334    pub next_page_token: Option<String>,
1335}
1336
1337impl common::ResponseResult for CampaignCreativeAssociationsListResponse {}
1338
1339/// Campaign List Response
1340///
1341/// # Activities
1342///
1343/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1344/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1345///
1346/// * [list campaigns](CampaignListCall) (response)
1347#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1348#[serde_with::serde_as]
1349#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1350pub struct CampaignsListResponse {
1351    /// Campaign collection.
1352    pub campaigns: Option<Vec<Campaign>>,
1353    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#campaignsListResponse".
1354    pub kind: Option<String>,
1355    /// Pagination token to be used for the next list operation.
1356    #[serde(rename = "nextPageToken")]
1357    pub next_page_token: Option<String>,
1358}
1359
1360impl common::ResponseResult for CampaignsListResponse {}
1361
1362/// Describes a change that a user has made to a resource.
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/// * [get change logs](ChangeLogGetCall) (response)
1370/// * [list change logs](ChangeLogListCall) (none)
1371#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1372#[serde_with::serde_as]
1373#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1374pub struct ChangeLog {
1375    /// Account ID of the modified object.
1376    #[serde(rename = "accountId")]
1377    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1378    pub account_id: Option<i64>,
1379    /// Action which caused the change.
1380    pub action: Option<String>,
1381    /// no description provided
1382    #[serde(rename = "changeTime")]
1383    pub change_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1384    /// Field name of the object which changed.
1385    #[serde(rename = "fieldName")]
1386    pub field_name: Option<String>,
1387    /// ID of this change log.
1388    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1389    pub id: Option<i64>,
1390    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#changeLog".
1391    pub kind: Option<String>,
1392    /// New value of the object field.
1393    #[serde(rename = "newValue")]
1394    pub new_value: Option<String>,
1395    /// ID of the object of this change log. The object could be a campaign, placement, ad, or other type.
1396    #[serde(rename = "objectId")]
1397    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1398    pub object_id: Option<i64>,
1399    /// Object type of the change log.
1400    #[serde(rename = "objectType")]
1401    pub object_type: Option<String>,
1402    /// Old value of the object field.
1403    #[serde(rename = "oldValue")]
1404    pub old_value: Option<String>,
1405    /// Subaccount ID of the modified object.
1406    #[serde(rename = "subaccountId")]
1407    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1408    pub subaccount_id: Option<i64>,
1409    /// Transaction ID of this change log. When a single API call results in many changes, each change will have a separate ID in the change log but will share the same transactionId.
1410    #[serde(rename = "transactionId")]
1411    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1412    pub transaction_id: Option<i64>,
1413    /// ID of the user who modified the object.
1414    #[serde(rename = "userProfileId")]
1415    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1416    pub user_profile_id: Option<i64>,
1417    /// User profile name of the user who modified the object.
1418    #[serde(rename = "userProfileName")]
1419    pub user_profile_name: Option<String>,
1420}
1421
1422impl common::Resource for ChangeLog {}
1423impl common::ResponseResult for ChangeLog {}
1424
1425/// Change Log List Response
1426///
1427/// # Activities
1428///
1429/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1430/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1431///
1432/// * [list change logs](ChangeLogListCall) (response)
1433#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1434#[serde_with::serde_as]
1435#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1436pub struct ChangeLogsListResponse {
1437    /// Change log collection.
1438    #[serde(rename = "changeLogs")]
1439    pub change_logs: Option<Vec<ChangeLog>>,
1440    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#changeLogsListResponse".
1441    pub kind: Option<String>,
1442    /// Pagination token to be used for the next list operation.
1443    #[serde(rename = "nextPageToken")]
1444    pub next_page_token: Option<String>,
1445}
1446
1447impl common::ResponseResult for ChangeLogsListResponse {}
1448
1449/// City List Response
1450///
1451/// # Activities
1452///
1453/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1454/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1455///
1456/// * [list cities](CityListCall) (response)
1457#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1458#[serde_with::serde_as]
1459#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1460pub struct CitiesListResponse {
1461    /// City collection.
1462    pub cities: Option<Vec<City>>,
1463    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#citiesListResponse".
1464    pub kind: Option<String>,
1465}
1466
1467impl common::ResponseResult for CitiesListResponse {}
1468
1469/// Contains information about a city that can be targeted by ads.
1470///
1471/// This type is not used in any activity, and only used as *part* of another schema.
1472///
1473#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1474#[serde_with::serde_as]
1475#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1476pub struct City {
1477    /// Country code of the country to which this city belongs.
1478    #[serde(rename = "countryCode")]
1479    pub country_code: Option<String>,
1480    /// DART ID of the country to which this city belongs.
1481    #[serde(rename = "countryDartId")]
1482    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1483    pub country_dart_id: Option<i64>,
1484    /// DART ID of this city. This is the ID used for targeting and generating reports.
1485    #[serde(rename = "dartId")]
1486    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1487    pub dart_id: Option<i64>,
1488    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#city".
1489    pub kind: Option<String>,
1490    /// Metro region code of the metro region (DMA) to which this city belongs.
1491    #[serde(rename = "metroCode")]
1492    pub metro_code: Option<String>,
1493    /// ID of the metro region (DMA) to which this city belongs.
1494    #[serde(rename = "metroDmaId")]
1495    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1496    pub metro_dma_id: Option<i64>,
1497    /// Name of this city.
1498    pub name: Option<String>,
1499    /// Region code of the region to which this city belongs.
1500    #[serde(rename = "regionCode")]
1501    pub region_code: Option<String>,
1502    /// DART ID of the region to which this city belongs.
1503    #[serde(rename = "regionDartId")]
1504    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1505    pub region_dart_id: Option<i64>,
1506}
1507
1508impl common::Part for City {}
1509
1510/// Creative Click Tag.
1511///
1512/// This type is not used in any activity, and only used as *part* of another schema.
1513///
1514#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1515#[serde_with::serde_as]
1516#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1517pub struct ClickTag {
1518    /// Parameter value for the specified click tag. This field contains a click-through url.
1519    #[serde(rename = "clickThroughUrl")]
1520    pub click_through_url: Option<CreativeClickThroughUrl>,
1521    /// Advertiser event name associated with the click tag. This field is used by DISPLAY_IMAGE_GALLERY and HTML5_BANNER creatives. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE.
1522    #[serde(rename = "eventName")]
1523    pub event_name: Option<String>,
1524    /// Parameter name for the specified click tag. For DISPLAY_IMAGE_GALLERY creative assets, this field must match the value of the creative asset's creativeAssetId.name field.
1525    pub name: Option<String>,
1526}
1527
1528impl common::Part for ClickTag {}
1529
1530/// Click-through URL
1531///
1532/// This type is not used in any activity, and only used as *part* of another schema.
1533///
1534#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1535#[serde_with::serde_as]
1536#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1537pub struct ClickThroughUrl {
1538    /// Read-only convenience field representing the actual URL that will be used for this click-through. The URL is computed as follows: - If defaultLandingPage is enabled then the campaign's default landing page URL is assigned to this field. - If defaultLandingPage is not enabled and a landingPageId is specified then that landing page's URL is assigned to this field. - If neither of the above cases apply, then the customClickThroughUrl is assigned to this field.
1539    #[serde(rename = "computedClickThroughUrl")]
1540    pub computed_click_through_url: Option<String>,
1541    /// Custom click-through URL. Applicable if the defaultLandingPage field is set to false and the landingPageId field is left unset.
1542    #[serde(rename = "customClickThroughUrl")]
1543    pub custom_click_through_url: Option<String>,
1544    /// Whether the campaign default landing page is used.
1545    #[serde(rename = "defaultLandingPage")]
1546    pub default_landing_page: Option<bool>,
1547    /// ID of the landing page for the click-through URL. Applicable if the defaultLandingPage field is set to false.
1548    #[serde(rename = "landingPageId")]
1549    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1550    pub landing_page_id: Option<i64>,
1551}
1552
1553impl common::Part for ClickThroughUrl {}
1554
1555/// Click Through URL Suffix settings.
1556///
1557/// This type is not used in any activity, and only used as *part* of another schema.
1558///
1559#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1560#[serde_with::serde_as]
1561#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1562pub struct ClickThroughUrlSuffixProperties {
1563    /// Click-through URL suffix to apply to all ads in this entity's scope. Must be less than 128 characters long.
1564    #[serde(rename = "clickThroughUrlSuffix")]
1565    pub click_through_url_suffix: Option<String>,
1566    /// Whether this entity should override the inherited click-through URL suffix with its own defined value.
1567    #[serde(rename = "overrideInheritedSuffix")]
1568    pub override_inherited_suffix: Option<bool>,
1569}
1570
1571impl common::Part for ClickThroughUrlSuffixProperties {}
1572
1573/// Companion Click-through override.
1574///
1575/// This type is not used in any activity, and only used as *part* of another schema.
1576///
1577#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1578#[serde_with::serde_as]
1579#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1580pub struct CompanionClickThroughOverride {
1581    /// Click-through URL of this companion click-through override.
1582    #[serde(rename = "clickThroughUrl")]
1583    pub click_through_url: Option<ClickThroughUrl>,
1584    /// ID of the creative for this companion click-through override.
1585    #[serde(rename = "creativeId")]
1586    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1587    pub creative_id: Option<i64>,
1588}
1589
1590impl common::Part for CompanionClickThroughOverride {}
1591
1592/// Companion Settings
1593///
1594/// This type is not used in any activity, and only used as *part* of another schema.
1595///
1596#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1597#[serde_with::serde_as]
1598#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1599pub struct CompanionSetting {
1600    /// Whether companions are disabled for this placement.
1601    #[serde(rename = "companionsDisabled")]
1602    pub companions_disabled: Option<bool>,
1603    /// Allowlist of companion sizes to be served to this placement. Set this list to null or empty to serve all companion sizes.
1604    #[serde(rename = "enabledSizes")]
1605    pub enabled_sizes: Option<Vec<Size>>,
1606    /// Whether to serve only static images as companions.
1607    #[serde(rename = "imageOnly")]
1608    pub image_only: Option<bool>,
1609    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#companionSetting".
1610    pub kind: Option<String>,
1611}
1612
1613impl common::Part for CompanionSetting {}
1614
1615/// Represents a response to the queryCompatibleFields method.
1616///
1617/// # Activities
1618///
1619/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1620/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1621///
1622/// * [compatible fields query reports](ReportCompatibleFieldQueryCall) (response)
1623#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1624#[serde_with::serde_as]
1625#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1626pub struct CompatibleFields {
1627    /// Contains items that are compatible to be selected for a report of type "CROSS_DIMENSION_REACH".
1628    #[serde(rename = "crossDimensionReachReportCompatibleFields")]
1629    pub cross_dimension_reach_report_compatible_fields:
1630        Option<CrossDimensionReachReportCompatibleFields>,
1631    /// Contains items that are compatible to be selected for a report of type "FLOODLIGHT".
1632    #[serde(rename = "floodlightReportCompatibleFields")]
1633    pub floodlight_report_compatible_fields: Option<FloodlightReportCompatibleFields>,
1634    /// The kind of resource this is, in this case dfareporting#compatibleFields.
1635    pub kind: Option<String>,
1636    /// Contains items that are compatible to be selected for a report of type "PATH_TO_CONVERSION".
1637    #[serde(rename = "pathToConversionReportCompatibleFields")]
1638    pub path_to_conversion_report_compatible_fields: Option<PathToConversionReportCompatibleFields>,
1639    /// Contains items that are compatible to be selected for a report of type "REACH".
1640    #[serde(rename = "reachReportCompatibleFields")]
1641    pub reach_report_compatible_fields: Option<ReachReportCompatibleFields>,
1642    /// Contains items that are compatible to be selected for a report of type "STANDARD".
1643    #[serde(rename = "reportCompatibleFields")]
1644    pub report_compatible_fields: Option<ReportCompatibleFields>,
1645}
1646
1647impl common::ResponseResult for CompatibleFields {}
1648
1649/// Contains information about an internet connection type that can be targeted by ads. Clients can use the connection type to target mobile vs. broadband users.
1650///
1651/// # Activities
1652///
1653/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1654/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1655///
1656/// * [get connection types](ConnectionTypeGetCall) (response)
1657/// * [list connection types](ConnectionTypeListCall) (none)
1658#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1659#[serde_with::serde_as]
1660#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1661pub struct ConnectionType {
1662    /// ID of this connection type.
1663    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1664    pub id: Option<i64>,
1665    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#connectionType".
1666    pub kind: Option<String>,
1667    /// Name of this connection type.
1668    pub name: Option<String>,
1669}
1670
1671impl common::Resource for ConnectionType {}
1672impl common::ResponseResult for ConnectionType {}
1673
1674/// Connection Type List Response
1675///
1676/// # Activities
1677///
1678/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1679/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1680///
1681/// * [list connection types](ConnectionTypeListCall) (response)
1682#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1683#[serde_with::serde_as]
1684#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1685pub struct ConnectionTypesListResponse {
1686    /// Collection of connection types such as broadband and mobile.
1687    #[serde(rename = "connectionTypes")]
1688    pub connection_types: Option<Vec<ConnectionType>>,
1689    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#connectionTypesListResponse".
1690    pub kind: Option<String>,
1691}
1692
1693impl common::ResponseResult for ConnectionTypesListResponse {}
1694
1695/// Content Category List Response
1696///
1697/// # Activities
1698///
1699/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1700/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1701///
1702/// * [list content categories](ContentCategoryListCall) (response)
1703#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1704#[serde_with::serde_as]
1705#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1706pub struct ContentCategoriesListResponse {
1707    /// Content category collection.
1708    #[serde(rename = "contentCategories")]
1709    pub content_categories: Option<Vec<ContentCategory>>,
1710    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#contentCategoriesListResponse".
1711    pub kind: Option<String>,
1712    /// Pagination token to be used for the next list operation.
1713    #[serde(rename = "nextPageToken")]
1714    pub next_page_token: Option<String>,
1715}
1716
1717impl common::ResponseResult for ContentCategoriesListResponse {}
1718
1719/// Organizes placements according to the contents of their associated webpages.
1720///
1721/// # Activities
1722///
1723/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1724/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1725///
1726/// * [get content categories](ContentCategoryGetCall) (response)
1727/// * [insert content categories](ContentCategoryInsertCall) (request|response)
1728/// * [patch content categories](ContentCategoryPatchCall) (request|response)
1729/// * [update content categories](ContentCategoryUpdateCall) (request|response)
1730#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1731#[serde_with::serde_as]
1732#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1733pub struct ContentCategory {
1734    /// Account ID of this content category. This is a read-only field that can be left blank.
1735    #[serde(rename = "accountId")]
1736    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1737    pub account_id: Option<i64>,
1738    /// ID of this content category. This is a read-only, auto-generated field.
1739    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1740    pub id: Option<i64>,
1741    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#contentCategory".
1742    pub kind: Option<String>,
1743    /// Name of this content category. This is a required field and must be less than 256 characters long and unique among content categories of the same account.
1744    pub name: Option<String>,
1745}
1746
1747impl common::RequestValue for ContentCategory {}
1748impl common::ResponseResult for ContentCategory {}
1749
1750/// A Conversion represents when a user successfully performs a desired action after seeing an ad.
1751///
1752/// # Activities
1753///
1754/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1755/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1756///
1757/// * [batchinsert conversions](ConversionBatchinsertCall) (none)
1758/// * [batchupdate conversions](ConversionBatchupdateCall) (none)
1759#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1760#[serde_with::serde_as]
1761#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1762pub struct Conversion {
1763    /// Whether this particular request may come from a user under the age of 13, under COPPA compliance.
1764    #[serde(rename = "childDirectedTreatment")]
1765    pub child_directed_treatment: Option<bool>,
1766    /// Custom floodlight variables. This field may only be used when calling batchinsert; it is not supported by batchupdate.
1767    #[serde(rename = "customVariables")]
1768    pub custom_variables: Option<Vec<CustomFloodlightVariable>>,
1769    /// The alphanumeric encrypted user ID. When set, encryptionInfo should also be specified. This field is mutually exclusive with encryptedUserIdCandidates[], matchId, mobileDeviceId and gclid. This or encryptedUserIdCandidates[] or matchId or mobileDeviceId or gclid is a required field.
1770    #[serde(rename = "encryptedUserId")]
1771    pub encrypted_user_id: Option<String>,
1772    /// A list of the alphanumeric encrypted user IDs. Any user ID with exposure prior to the conversion timestamp will be used in the inserted conversion. If no such user ID is found then the conversion will be rejected with INVALID_ARGUMENT error. When set, encryptionInfo should also be specified. This field may only be used when calling batchinsert; it is not supported by batchupdate. This field is mutually exclusive with encryptedUserId, matchId, mobileDeviceId and gclid. This or encryptedUserId or matchId or mobileDeviceId or gclid is a required field.
1773    #[serde(rename = "encryptedUserIdCandidates")]
1774    pub encrypted_user_id_candidates: Option<Vec<String>>,
1775    /// Floodlight Activity ID of this conversion. This is a required field.
1776    #[serde(rename = "floodlightActivityId")]
1777    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1778    pub floodlight_activity_id: Option<i64>,
1779    /// Floodlight Configuration ID of this conversion. This is a required field.
1780    #[serde(rename = "floodlightConfigurationId")]
1781    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1782    pub floodlight_configuration_id: Option<i64>,
1783    /// The Google click ID. This field is mutually exclusive with encryptedUserId, encryptedUserIdCandidates[], matchId and mobileDeviceId. This or encryptedUserId or encryptedUserIdCandidates[] or matchId or mobileDeviceId is a required field.
1784    pub gclid: Option<String>,
1785    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#conversion".
1786    pub kind: Option<String>,
1787    /// Whether Limit Ad Tracking is enabled. When set to true, the conversion will be used for reporting but not targeting. This will prevent remarketing.
1788    #[serde(rename = "limitAdTracking")]
1789    pub limit_ad_tracking: Option<bool>,
1790    /// The match ID field. A match ID is your own first-party identifier that has been synced with Google using the match ID feature in Floodlight. This field is mutually exclusive with encryptedUserId, encryptedUserIdCandidates[],mobileDeviceId and gclid. This or encryptedUserId or encryptedUserIdCandidates[] or mobileDeviceId or gclid is a required field.
1791    #[serde(rename = "matchId")]
1792    pub match_id: Option<String>,
1793    /// The mobile device ID. This field is mutually exclusive with encryptedUserId, encryptedUserIdCandidates[], matchId and gclid. This or encryptedUserId or encryptedUserIdCandidates[] or matchId or gclid is a required field.
1794    #[serde(rename = "mobileDeviceId")]
1795    pub mobile_device_id: Option<String>,
1796    /// Whether the conversion was for a non personalized ad.
1797    #[serde(rename = "nonPersonalizedAd")]
1798    pub non_personalized_ad: Option<bool>,
1799    /// The ordinal of the conversion. Use this field to control how conversions of the same user and day are de-duplicated. This is a required field.
1800    pub ordinal: Option<String>,
1801    /// The quantity of the conversion.
1802    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1803    pub quantity: Option<i64>,
1804    /// The timestamp of conversion, in Unix epoch micros. This is a required field.
1805    #[serde(rename = "timestampMicros")]
1806    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1807    pub timestamp_micros: Option<i64>,
1808    /// Whether this particular request may come from a user under the age of 16 (may differ by country), under compliance with the European Union's General Data Protection Regulation (GDPR).
1809    #[serde(rename = "treatmentForUnderage")]
1810    pub treatment_for_underage: Option<bool>,
1811    /// The value of the conversion.
1812    pub value: Option<f64>,
1813}
1814
1815impl common::Resource for Conversion {}
1816
1817/// The error code and description for a conversion that failed to insert or update.
1818///
1819/// This type is not used in any activity, and only used as *part* of another schema.
1820///
1821#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1822#[serde_with::serde_as]
1823#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1824pub struct ConversionError {
1825    /// The error code.
1826    pub code: Option<String>,
1827    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#conversionError".
1828    pub kind: Option<String>,
1829    /// A description of the error.
1830    pub message: Option<String>,
1831}
1832
1833impl common::Part for ConversionError {}
1834
1835/// The original conversion that was inserted or updated and whether there were any errors.
1836///
1837/// This type is not used in any activity, and only used as *part* of another schema.
1838///
1839#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1840#[serde_with::serde_as]
1841#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1842pub struct ConversionStatus {
1843    /// The original conversion that was inserted or updated.
1844    pub conversion: Option<Conversion>,
1845    /// A list of errors related to this conversion.
1846    pub errors: Option<Vec<ConversionError>>,
1847    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#conversionStatus".
1848    pub kind: Option<String>,
1849}
1850
1851impl common::Part for ConversionStatus {}
1852
1853/// Insert Conversions Request.
1854///
1855/// # Activities
1856///
1857/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1858/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1859///
1860/// * [batchinsert conversions](ConversionBatchinsertCall) (request)
1861#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1862#[serde_with::serde_as]
1863#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1864pub struct ConversionsBatchInsertRequest {
1865    /// The set of conversions to insert.
1866    pub conversions: Option<Vec<Conversion>>,
1867    /// Describes how encryptedUserId or encryptedUserIdCandidates[] is encrypted. This is a required field if encryptedUserId or encryptedUserIdCandidates[] is used.
1868    #[serde(rename = "encryptionInfo")]
1869    pub encryption_info: Option<EncryptionInfo>,
1870    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#conversionsBatchInsertRequest".
1871    pub kind: Option<String>,
1872}
1873
1874impl common::RequestValue for ConversionsBatchInsertRequest {}
1875
1876/// Insert Conversions Response.
1877///
1878/// # Activities
1879///
1880/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1881/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1882///
1883/// * [batchinsert conversions](ConversionBatchinsertCall) (response)
1884#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1885#[serde_with::serde_as]
1886#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1887pub struct ConversionsBatchInsertResponse {
1888    /// Indicates that some or all conversions failed to insert.
1889    #[serde(rename = "hasFailures")]
1890    pub has_failures: Option<bool>,
1891    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#conversionsBatchInsertResponse".
1892    pub kind: Option<String>,
1893    /// The insert status of each conversion. Statuses are returned in the same order that conversions are inserted.
1894    pub status: Option<Vec<ConversionStatus>>,
1895}
1896
1897impl common::ResponseResult for ConversionsBatchInsertResponse {}
1898
1899/// Update Conversions Request.
1900///
1901/// # Activities
1902///
1903/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1904/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1905///
1906/// * [batchupdate conversions](ConversionBatchupdateCall) (request)
1907#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1908#[serde_with::serde_as]
1909#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1910pub struct ConversionsBatchUpdateRequest {
1911    /// The set of conversions to update.
1912    pub conversions: Option<Vec<Conversion>>,
1913    /// Describes how encryptedUserId is encrypted. This is a required field if encryptedUserId is used.
1914    #[serde(rename = "encryptionInfo")]
1915    pub encryption_info: Option<EncryptionInfo>,
1916    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#conversionsBatchUpdateRequest".
1917    pub kind: Option<String>,
1918}
1919
1920impl common::RequestValue for ConversionsBatchUpdateRequest {}
1921
1922/// Update Conversions Response.
1923///
1924/// # Activities
1925///
1926/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1927/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1928///
1929/// * [batchupdate conversions](ConversionBatchupdateCall) (response)
1930#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1931#[serde_with::serde_as]
1932#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1933pub struct ConversionsBatchUpdateResponse {
1934    /// Indicates that some or all conversions failed to update.
1935    #[serde(rename = "hasFailures")]
1936    pub has_failures: Option<bool>,
1937    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#conversionsBatchUpdateResponse".
1938    pub kind: Option<String>,
1939    /// The update status of each conversion. Statuses are returned in the same order that conversions are updated.
1940    pub status: Option<Vec<ConversionStatus>>,
1941}
1942
1943impl common::ResponseResult for ConversionsBatchUpdateResponse {}
1944
1945/// Country List Response
1946///
1947/// # Activities
1948///
1949/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1950/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1951///
1952/// * [list countries](CountryListCall) (response)
1953#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1954#[serde_with::serde_as]
1955#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1956pub struct CountriesListResponse {
1957    /// Country collection.
1958    pub countries: Option<Vec<Country>>,
1959    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#countriesListResponse".
1960    pub kind: Option<String>,
1961}
1962
1963impl common::ResponseResult for CountriesListResponse {}
1964
1965/// Contains information about a country that can be targeted by ads.
1966///
1967/// # Activities
1968///
1969/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1970/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1971///
1972/// * [get countries](CountryGetCall) (response)
1973#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1974#[serde_with::serde_as]
1975#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1976pub struct Country {
1977    /// Country code.
1978    #[serde(rename = "countryCode")]
1979    pub country_code: Option<String>,
1980    /// DART ID of this country. This is the ID used for targeting and generating reports.
1981    #[serde(rename = "dartId")]
1982    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1983    pub dart_id: Option<i64>,
1984    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#country".
1985    pub kind: Option<String>,
1986    /// Name of this country.
1987    pub name: Option<String>,
1988    /// Whether ad serving supports secure servers in this country.
1989    #[serde(rename = "sslEnabled")]
1990    pub ssl_enabled: Option<bool>,
1991}
1992
1993impl common::ResponseResult for Country {}
1994
1995/// Contains properties of a Creative.
1996///
1997/// # Activities
1998///
1999/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2000/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2001///
2002/// * [get creatives](CreativeGetCall) (response)
2003/// * [insert creatives](CreativeInsertCall) (request|response)
2004/// * [list creatives](CreativeListCall) (none)
2005/// * [patch creatives](CreativePatchCall) (request|response)
2006/// * [update creatives](CreativeUpdateCall) (request|response)
2007#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2008#[serde_with::serde_as]
2009#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2010pub struct Creative {
2011    /// Account ID of this creative. This field, if left unset, will be auto-generated for both insert and update operations. Applicable to all creative types.
2012    #[serde(rename = "accountId")]
2013    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2014    pub account_id: Option<i64>,
2015    /// Whether the creative is active. Applicable to all creative types.
2016    pub active: Option<bool>,
2017    /// Ad parameters user for VPAID creative. This is a read-only field. Applicable to the following creative types: all VPAID.
2018    #[serde(rename = "adParameters")]
2019    pub ad_parameters: Option<String>,
2020    /// Keywords for a Rich Media creative. Keywords let you customize the creative settings of a Rich Media ad running on your site without having to contact the advertiser. You can use keywords to dynamically change the look or functionality of a creative. Applicable to the following creative types: all RICH_MEDIA, and all VPAID.
2021    #[serde(rename = "adTagKeys")]
2022    pub ad_tag_keys: Option<Vec<String>>,
2023    /// Additional sizes associated with a responsive creative. When inserting or updating a creative either the size ID field or size width and height fields can be used. Applicable to DISPLAY creatives when the primary asset type is HTML_IMAGE.
2024    #[serde(rename = "additionalSizes")]
2025    pub additional_sizes: Option<Vec<Size>>,
2026    /// Advertiser ID of this creative. This is a required field. Applicable to all creative types.
2027    #[serde(rename = "advertiserId")]
2028    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2029    pub advertiser_id: Option<i64>,
2030    /// Whether script access is allowed for this creative. This is a read-only and deprecated field which will automatically be set to true on update. Applicable to the following creative types: FLASH_INPAGE.
2031    #[serde(rename = "allowScriptAccess")]
2032    pub allow_script_access: Option<bool>,
2033    /// Whether the creative is archived. Applicable to all creative types.
2034    pub archived: Option<bool>,
2035    /// Type of artwork used for the creative. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID.
2036    #[serde(rename = "artworkType")]
2037    pub artwork_type: Option<String>,
2038    /// Source application where creative was authored. Presently, only DBM authored creatives will have this field set. Applicable to all creative types.
2039    #[serde(rename = "authoringSource")]
2040    pub authoring_source: Option<String>,
2041    /// Authoring tool for HTML5 banner creatives. This is a read-only field. Applicable to the following creative types: HTML5_BANNER.
2042    #[serde(rename = "authoringTool")]
2043    pub authoring_tool: Option<String>,
2044    /// Whether images are automatically advanced for image gallery creatives. Applicable to the following creative types: DISPLAY_IMAGE_GALLERY.
2045    #[serde(rename = "autoAdvanceImages")]
2046    pub auto_advance_images: Option<bool>,
2047    /// The 6-character HTML color code, beginning with #, for the background of the window area where the Flash file is displayed. Default is white. Applicable to the following creative types: FLASH_INPAGE.
2048    #[serde(rename = "backgroundColor")]
2049    pub background_color: Option<String>,
2050    /// Click-through URL for backup image. Applicable to ENHANCED_BANNER when the primary asset type is not HTML_IMAGE.
2051    #[serde(rename = "backupImageClickThroughUrl")]
2052    pub backup_image_click_through_url: Option<CreativeClickThroughUrl>,
2053    /// List of feature dependencies that will cause a backup image to be served if the browser that serves the ad does not support them. Feature dependencies are features that a browser must be able to support in order to render your HTML5 creative asset correctly. This field is initially auto-generated to contain all features detected by Campaign Manager for all the assets of this creative and can then be modified by the client. To reset this field, copy over all the creativeAssets' detected features. Applicable to the following creative types: HTML5_BANNER. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE.
2054    #[serde(rename = "backupImageFeatures")]
2055    pub backup_image_features: Option<Vec<String>>,
2056    /// Reporting label used for HTML5 banner backup image. Applicable to the following creative types: DISPLAY when the primary asset type is not HTML_IMAGE.
2057    #[serde(rename = "backupImageReportingLabel")]
2058    pub backup_image_reporting_label: Option<String>,
2059    /// Target window for backup image. Applicable to the following creative types: FLASH_INPAGE and HTML5_BANNER. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE.
2060    #[serde(rename = "backupImageTargetWindow")]
2061    pub backup_image_target_window: Option<TargetWindow>,
2062    /// Click tags of the creative. For DISPLAY, FLASH_INPAGE, and HTML5_BANNER creatives, this is a subset of detected click tags for the assets associated with this creative. After creating a flash asset, detected click tags will be returned in the creativeAssetMetadata. When inserting the creative, populate the creative clickTags field using the creativeAssetMetadata.clickTags field. For DISPLAY_IMAGE_GALLERY creatives, there should be exactly one entry in this list for each image creative asset. A click tag is matched with a corresponding creative asset by matching the clickTag.name field with the creativeAsset.assetIdentifier.name field. Applicable to the following creative types: DISPLAY_IMAGE_GALLERY, FLASH_INPAGE, HTML5_BANNER. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE.
2063    #[serde(rename = "clickTags")]
2064    pub click_tags: Option<Vec<ClickTag>>,
2065    /// Industry standard ID assigned to creative for reach and frequency. Applicable to INSTREAM_VIDEO_REDIRECT creatives.
2066    #[serde(rename = "commercialId")]
2067    pub commercial_id: Option<String>,
2068    /// List of companion creatives assigned to an in-Stream video creative. Acceptable values include IDs of existing flash and image creatives. Applicable to the following creative types: all VPAID, all INSTREAM_AUDIO and all INSTREAM_VIDEO with dynamicAssetSelection set to false.
2069    #[serde(rename = "companionCreatives")]
2070    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
2071    pub companion_creatives: Option<Vec<i64>>,
2072    /// Compatibilities associated with this creative. This is a read-only field. DISPLAY and DISPLAY_INTERSTITIAL refer to rendering either on desktop or on mobile devices or in mobile apps for regular or interstitial ads, respectively. APP and APP_INTERSTITIAL are for rendering in mobile apps. Only pre-existing creatives may have these compatibilities since new creatives will either be assigned DISPLAY or DISPLAY_INTERSTITIAL instead. IN_STREAM_VIDEO refers to rendering in in-stream video ads developed with the VAST standard. IN_STREAM_AUDIO refers to rendering in in-stream audio ads developed with the VAST standard. Applicable to all creative types. Acceptable values are: - "APP" - "APP_INTERSTITIAL" - "IN_STREAM_VIDEO" - "IN_STREAM_AUDIO" - "DISPLAY" - "DISPLAY_INTERSTITIAL"
2073    pub compatibility: Option<Vec<String>>,
2074    /// Whether Flash assets associated with the creative need to be automatically converted to HTML5. This flag is enabled by default and users can choose to disable it if they don't want the system to generate and use HTML5 asset for this creative. Applicable to the following creative type: FLASH_INPAGE. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE.
2075    #[serde(rename = "convertFlashToHtml5")]
2076    pub convert_flash_to_html5: Option<bool>,
2077    /// List of counter events configured for the creative. For DISPLAY_IMAGE_GALLERY creatives, these are read-only and auto-generated from clickTags. Applicable to the following creative types: DISPLAY_IMAGE_GALLERY, all RICH_MEDIA, and all VPAID.
2078    #[serde(rename = "counterCustomEvents")]
2079    pub counter_custom_events: Option<Vec<CreativeCustomEvent>>,
2080    /// Required if dynamicAssetSelection is true.
2081    #[serde(rename = "creativeAssetSelection")]
2082    pub creative_asset_selection: Option<CreativeAssetSelection>,
2083    /// Assets associated with a creative. Applicable to all but the following creative types: INTERNAL_REDIRECT, INTERSTITIAL_INTERNAL_REDIRECT, and REDIRECT
2084    #[serde(rename = "creativeAssets")]
2085    pub creative_assets: Option<Vec<CreativeAsset>>,
2086    /// Creative field assignments for this creative. Applicable to all creative types.
2087    #[serde(rename = "creativeFieldAssignments")]
2088    pub creative_field_assignments: Option<Vec<CreativeFieldAssignment>>,
2089    /// Custom key-values for a Rich Media creative. Key-values let you customize the creative settings of a Rich Media ad running on your site without having to contact the advertiser. You can use key-values to dynamically change the look or functionality of a creative. Applicable to the following creative types: all RICH_MEDIA, and all VPAID.
2090    #[serde(rename = "customKeyValues")]
2091    pub custom_key_values: Option<Vec<String>>,
2092    /// Set this to true to enable the use of rules to target individual assets in this creative. When set to true creativeAssetSelection must be set. This also controls asset-level companions. When this is true, companion creatives should be assigned to creative assets. Learn more. Applicable to INSTREAM_VIDEO creatives.
2093    #[serde(rename = "dynamicAssetSelection")]
2094    pub dynamic_asset_selection: Option<bool>,
2095    /// List of exit events configured for the creative. For DISPLAY and DISPLAY_IMAGE_GALLERY creatives, these are read-only and auto-generated from clickTags, For DISPLAY, an event is also created from the backupImageReportingLabel. Applicable to the following creative types: DISPLAY_IMAGE_GALLERY, all RICH_MEDIA, and all VPAID. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE.
2096    #[serde(rename = "exitCustomEvents")]
2097    pub exit_custom_events: Option<Vec<CreativeCustomEvent>>,
2098    /// OpenWindow FSCommand of this creative. This lets the SWF file communicate with either Flash Player or the program hosting Flash Player, such as a web browser. This is only triggered if allowScriptAccess field is true. Applicable to the following creative types: FLASH_INPAGE.
2099    #[serde(rename = "fsCommand")]
2100    pub fs_command: Option<FsCommand>,
2101    /// HTML code for the creative. This is a required field when applicable. This field is ignored if htmlCodeLocked is true. Applicable to the following creative types: all CUSTOM, FLASH_INPAGE, and HTML5_BANNER, and all RICH_MEDIA.
2102    #[serde(rename = "htmlCode")]
2103    pub html_code: Option<String>,
2104    /// Whether HTML code is generated by Campaign Manager or manually entered. Set to true to ignore changes to htmlCode. Applicable to the following creative types: FLASH_INPAGE and HTML5_BANNER.
2105    #[serde(rename = "htmlCodeLocked")]
2106    pub html_code_locked: Option<bool>,
2107    /// ID of this creative. This is a read-only, auto-generated field. Applicable to all creative types.
2108    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2109    pub id: Option<i64>,
2110    /// Dimension value for the ID of this creative. This is a read-only field. Applicable to all creative types.
2111    #[serde(rename = "idDimensionValue")]
2112    pub id_dimension_value: Option<DimensionValue>,
2113    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creative".
2114    pub kind: Option<String>,
2115    /// Creative last modification information. This is a read-only field. Applicable to all creative types.
2116    #[serde(rename = "lastModifiedInfo")]
2117    pub last_modified_info: Option<LastModifiedInfo>,
2118    /// Latest Studio trafficked creative ID associated with rich media and VPAID creatives. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID.
2119    #[serde(rename = "latestTraffickedCreativeId")]
2120    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2121    pub latest_trafficked_creative_id: Option<i64>,
2122    /// Description of the audio or video ad. Applicable to the following creative types: all INSTREAM_VIDEO, INSTREAM_AUDIO, and all VPAID.
2123    #[serde(rename = "mediaDescription")]
2124    pub media_description: Option<String>,
2125    /// Creative audio or video duration in seconds. This is a read-only field. Applicable to the following creative types: INSTREAM_VIDEO, INSTREAM_AUDIO, all RICH_MEDIA, and all VPAID.
2126    #[serde(rename = "mediaDuration")]
2127    pub media_duration: Option<f32>,
2128    /// Name of the creative. This is a required field and must be less than 256 characters long. Applicable to all creative types.
2129    pub name: Option<String>,
2130    /// Override CSS value for rich media creatives. Applicable to the following creative types: all RICH_MEDIA.
2131    #[serde(rename = "overrideCss")]
2132    pub override_css: Option<String>,
2133    /// Amount of time to play the video before counting a view. Applicable to the following creative types: all INSTREAM_VIDEO.
2134    #[serde(rename = "progressOffset")]
2135    pub progress_offset: Option<VideoOffset>,
2136    /// URL of hosted image or hosted video or another ad tag. For INSTREAM_VIDEO_REDIRECT creatives this is the in-stream video redirect URL. The standard for a VAST (Video Ad Serving Template) ad response allows for a redirect link to another VAST 2.0 or 3.0 call. This is a required field when applicable. Applicable to the following creative types: DISPLAY_REDIRECT, INTERNAL_REDIRECT, INTERSTITIAL_INTERNAL_REDIRECT, and INSTREAM_VIDEO_REDIRECT
2137    #[serde(rename = "redirectUrl")]
2138    pub redirect_url: Option<String>,
2139    /// ID of current rendering version. This is a read-only field. Applicable to all creative types.
2140    #[serde(rename = "renderingId")]
2141    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2142    pub rendering_id: Option<i64>,
2143    /// Dimension value for the rendering ID of this creative. This is a read-only field. Applicable to all creative types.
2144    #[serde(rename = "renderingIdDimensionValue")]
2145    pub rendering_id_dimension_value: Option<DimensionValue>,
2146    /// The minimum required Flash plugin version for this creative. For example, 11.2.202.235. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID.
2147    #[serde(rename = "requiredFlashPluginVersion")]
2148    pub required_flash_plugin_version: Option<String>,
2149    /// The internal Flash version for this creative as calculated by Studio. This is a read-only field. Applicable to the following creative types: FLASH_INPAGE all RICH_MEDIA, and all VPAID. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE.
2150    #[serde(rename = "requiredFlashVersion")]
2151    pub required_flash_version: Option<i32>,
2152    /// Size associated with this creative. When inserting or updating a creative either the size ID field or size width and height fields can be used. This is a required field when applicable; however for IMAGE, FLASH_INPAGE creatives, and for DISPLAY creatives with a primary asset of type HTML_IMAGE, if left blank, this field will be automatically set using the actual size of the associated image assets. Applicable to the following creative types: DISPLAY, DISPLAY_IMAGE_GALLERY, FLASH_INPAGE, HTML5_BANNER, IMAGE, and all RICH_MEDIA.
2153    pub size: Option<Size>,
2154    /// Amount of time to play the video before the skip button appears. Applicable to the following creative types: all INSTREAM_VIDEO.
2155    #[serde(rename = "skipOffset")]
2156    pub skip_offset: Option<VideoOffset>,
2157    /// Whether the user can choose to skip the creative. Applicable to the following creative types: all INSTREAM_VIDEO and all VPAID.
2158    pub skippable: Option<bool>,
2159    /// Whether the creative is SSL-compliant. This is a read-only field. Applicable to all creative types.
2160    #[serde(rename = "sslCompliant")]
2161    pub ssl_compliant: Option<bool>,
2162    /// Whether creative should be treated as SSL compliant even if the system scan shows it's not. Applicable to all creative types.
2163    #[serde(rename = "sslOverride")]
2164    pub ssl_override: Option<bool>,
2165    /// Studio advertiser ID associated with rich media and VPAID creatives. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID.
2166    #[serde(rename = "studioAdvertiserId")]
2167    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2168    pub studio_advertiser_id: Option<i64>,
2169    /// Studio creative ID associated with rich media and VPAID creatives. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID.
2170    #[serde(rename = "studioCreativeId")]
2171    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2172    pub studio_creative_id: Option<i64>,
2173    /// Studio trafficked creative ID associated with rich media and VPAID creatives. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID.
2174    #[serde(rename = "studioTraffickedCreativeId")]
2175    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2176    pub studio_trafficked_creative_id: Option<i64>,
2177    /// Subaccount ID of this creative. This field, if left unset, will be auto-generated for both insert and update operations. Applicable to all creative types.
2178    #[serde(rename = "subaccountId")]
2179    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2180    pub subaccount_id: Option<i64>,
2181    /// Third-party URL used to record backup image impressions. Applicable to the following creative types: all RICH_MEDIA.
2182    #[serde(rename = "thirdPartyBackupImageImpressionsUrl")]
2183    pub third_party_backup_image_impressions_url: Option<String>,
2184    /// Third-party URL used to record rich media impressions. Applicable to the following creative types: all RICH_MEDIA.
2185    #[serde(rename = "thirdPartyRichMediaImpressionsUrl")]
2186    pub third_party_rich_media_impressions_url: Option<String>,
2187    /// Third-party URLs for tracking in-stream creative events. Applicable to the following creative types: all INSTREAM_VIDEO, all INSTREAM_AUDIO, and all VPAID.
2188    #[serde(rename = "thirdPartyUrls")]
2189    pub third_party_urls: Option<Vec<ThirdPartyTrackingUrl>>,
2190    /// List of timer events configured for the creative. For DISPLAY_IMAGE_GALLERY creatives, these are read-only and auto-generated from clickTags. Applicable to the following creative types: DISPLAY_IMAGE_GALLERY, all RICH_MEDIA, and all VPAID. Applicable to DISPLAY when the primary asset is not HTML_IMAGE.
2191    #[serde(rename = "timerCustomEvents")]
2192    pub timer_custom_events: Option<Vec<CreativeCustomEvent>>,
2193    /// Combined size of all creative assets. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA, and all VPAID.
2194    #[serde(rename = "totalFileSize")]
2195    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2196    pub total_file_size: Option<i64>,
2197    /// Type of this creative. This is a required field. Applicable to all creative types. *Note:* FLASH_INPAGE, HTML5_BANNER, and IMAGE are only used for existing creatives. New creatives should use DISPLAY as a replacement for these types.
2198    #[serde(rename = "type")]
2199    pub type_: Option<String>,
2200    /// A Universal Ad ID as per the VAST 4.0 spec. Applicable to the following creative types: INSTREAM_AUDIO and INSTREAM_VIDEO and VPAID.
2201    #[serde(rename = "universalAdId")]
2202    pub universal_ad_id: Option<UniversalAdId>,
2203    /// The version number helps you keep track of multiple versions of your creative in your reports. The version number will always be auto-generated during insert operations to start at 1. For tracking creatives the version cannot be incremented and will always remain at 1. For all other creative types the version can be incremented only by 1 during update operations. In addition, the version will be automatically incremented by 1 when undergoing Rich Media creative merging. Applicable to all creative types.
2204    pub version: Option<i32>,
2205}
2206
2207impl common::RequestValue for Creative {}
2208impl common::Resource for Creative {}
2209impl common::ResponseResult for Creative {}
2210
2211/// Creative Asset.
2212///
2213/// # Activities
2214///
2215/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2216/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2217///
2218/// * [insert creative assets](CreativeAssetInsertCall) (none)
2219#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2220#[serde_with::serde_as]
2221#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2222pub struct CreativeAsset {
2223    /// Whether ActionScript3 is enabled for the flash asset. This is a read-only field. Applicable to the following creative type: FLASH_INPAGE. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE.
2224    #[serde(rename = "actionScript3")]
2225    pub action_script3: Option<bool>,
2226    /// Whether the video or audio asset is active. This is a read-only field for VPAID_NON_LINEAR_VIDEO assets. Applicable to the following creative types: INSTREAM_AUDIO, INSTREAM_VIDEO and all VPAID.
2227    pub active: Option<bool>,
2228    /// Additional sizes associated with this creative asset. HTML5 asset generated by compatible software such as GWD will be able to support more sizes this creative asset can render.
2229    #[serde(rename = "additionalSizes")]
2230    pub additional_sizes: Option<Vec<Size>>,
2231    /// Possible alignments for an asset. This is a read-only field. Applicable to the following creative types: RICH_MEDIA_DISPLAY_MULTI_FLOATING_INTERSTITIAL .
2232    pub alignment: Option<String>,
2233    /// Artwork type of rich media creative. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA.
2234    #[serde(rename = "artworkType")]
2235    pub artwork_type: Option<String>,
2236    /// Identifier of this asset. This is the same identifier returned during creative asset insert operation. This is a required field. Applicable to all but the following creative types: all REDIRECT and TRACKING_TEXT.
2237    #[serde(rename = "assetIdentifier")]
2238    pub asset_identifier: Option<CreativeAssetId>,
2239    /// Audio stream bit rate in kbps. This is a read-only field. Applicable to the following creative types: INSTREAM_AUDIO, INSTREAM_VIDEO and all VPAID.
2240    #[serde(rename = "audioBitRate")]
2241    pub audio_bit_rate: Option<i32>,
2242    /// Audio sample bit rate in hertz. This is a read-only field. Applicable to the following creative types: INSTREAM_AUDIO, INSTREAM_VIDEO and all VPAID.
2243    #[serde(rename = "audioSampleRate")]
2244    pub audio_sample_rate: Option<i32>,
2245    /// Exit event configured for the backup image. Applicable to the following creative types: all RICH_MEDIA.
2246    #[serde(rename = "backupImageExit")]
2247    pub backup_image_exit: Option<CreativeCustomEvent>,
2248    /// Detected bit-rate for audio or video asset. This is a read-only field. Applicable to the following creative types: INSTREAM_AUDIO, INSTREAM_VIDEO and all VPAID.
2249    #[serde(rename = "bitRate")]
2250    pub bit_rate: Option<i32>,
2251    /// Rich media child asset type. This is a read-only field. Applicable to the following creative types: all VPAID.
2252    #[serde(rename = "childAssetType")]
2253    pub child_asset_type: Option<String>,
2254    /// Size of an asset when collapsed. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA and all VPAID. Additionally, applicable to assets whose displayType is ASSET_DISPLAY_TYPE_EXPANDING or ASSET_DISPLAY_TYPE_PEEL_DOWN.
2255    #[serde(rename = "collapsedSize")]
2256    pub collapsed_size: Option<Size>,
2257    /// List of companion creatives assigned to an in-stream video creative asset. Acceptable values include IDs of existing flash and image creatives. Applicable to INSTREAM_VIDEO creative type with dynamicAssetSelection set to true.
2258    #[serde(rename = "companionCreativeIds")]
2259    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
2260    pub companion_creative_ids: Option<Vec<i64>>,
2261    /// Custom start time in seconds for making the asset visible. Applicable to the following creative types: all RICH_MEDIA. Value must be greater than or equal to 0.
2262    #[serde(rename = "customStartTimeValue")]
2263    pub custom_start_time_value: Option<i32>,
2264    /// List of feature dependencies for the creative asset that are detected by Campaign Manager. Feature dependencies are features that a browser must be able to support in order to render your HTML5 creative correctly. This is a read-only, auto-generated field. Applicable to the following creative types: HTML5_BANNER. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE.
2265    #[serde(rename = "detectedFeatures")]
2266    pub detected_features: Option<Vec<String>>,
2267    /// Type of rich media asset. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA.
2268    #[serde(rename = "displayType")]
2269    pub display_type: Option<String>,
2270    /// Duration in seconds for which an asset will be displayed. Applicable to the following creative types: INSTREAM_AUDIO, INSTREAM_VIDEO and VPAID_LINEAR_VIDEO. Value must be greater than or equal to 1.
2271    pub duration: Option<i32>,
2272    /// Duration type for which an asset will be displayed. Applicable to the following creative types: all RICH_MEDIA.
2273    #[serde(rename = "durationType")]
2274    pub duration_type: Option<String>,
2275    /// Detected expanded dimension for video asset. This is a read-only field. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID.
2276    #[serde(rename = "expandedDimension")]
2277    pub expanded_dimension: Option<Size>,
2278    /// File size associated with this creative asset. This is a read-only field. Applicable to all but the following creative types: all REDIRECT and TRACKING_TEXT.
2279    #[serde(rename = "fileSize")]
2280    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2281    pub file_size: Option<i64>,
2282    /// Flash version of the asset. This is a read-only field. Applicable to the following creative types: FLASH_INPAGE, all RICH_MEDIA, and all VPAID. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE.
2283    #[serde(rename = "flashVersion")]
2284    pub flash_version: Option<i32>,
2285    /// Video frame rate for video asset in frames per second. This is a read-only field. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID.
2286    #[serde(rename = "frameRate")]
2287    pub frame_rate: Option<f32>,
2288    /// Whether to hide Flash objects flag for an asset. Applicable to the following creative types: all RICH_MEDIA.
2289    #[serde(rename = "hideFlashObjects")]
2290    pub hide_flash_objects: Option<bool>,
2291    /// Whether to hide selection boxes flag for an asset. Applicable to the following creative types: all RICH_MEDIA.
2292    #[serde(rename = "hideSelectionBoxes")]
2293    pub hide_selection_boxes: Option<bool>,
2294    /// Whether the asset is horizontally locked. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA.
2295    #[serde(rename = "horizontallyLocked")]
2296    pub horizontally_locked: Option<bool>,
2297    /// Numeric ID of this creative asset. This is a required field and should not be modified. Applicable to all but the following creative types: all REDIRECT and TRACKING_TEXT.
2298    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2299    pub id: Option<i64>,
2300    /// Dimension value for the ID of the asset. This is a read-only, auto-generated field.
2301    #[serde(rename = "idDimensionValue")]
2302    pub id_dimension_value: Option<DimensionValue>,
2303    /// Detected duration for audio or video asset. This is a read-only field. Applicable to the following creative types: INSTREAM_AUDIO, INSTREAM_VIDEO and all VPAID.
2304    #[serde(rename = "mediaDuration")]
2305    pub media_duration: Option<f32>,
2306    /// Detected MIME type for audio or video asset. This is a read-only field. Applicable to the following creative types: INSTREAM_AUDIO, INSTREAM_VIDEO and all VPAID.
2307    #[serde(rename = "mimeType")]
2308    pub mime_type: Option<String>,
2309    /// Offset position for an asset in collapsed mode. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA and all VPAID. Additionally, only applicable to assets whose displayType is ASSET_DISPLAY_TYPE_EXPANDING or ASSET_DISPLAY_TYPE_PEEL_DOWN.
2310    pub offset: Option<OffsetPosition>,
2311    /// Orientation of video asset. This is a read-only, auto-generated field.
2312    pub orientation: Option<String>,
2313    /// Whether the backup asset is original or changed by the user in Campaign Manager. Applicable to the following creative types: all RICH_MEDIA.
2314    #[serde(rename = "originalBackup")]
2315    pub original_backup: Option<bool>,
2316    /// Whether this asset is used as a polite load asset.
2317    #[serde(rename = "politeLoad")]
2318    pub polite_load: Option<bool>,
2319    /// Offset position for an asset. Applicable to the following creative types: all RICH_MEDIA.
2320    pub position: Option<OffsetPosition>,
2321    /// Offset left unit for an asset. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA.
2322    #[serde(rename = "positionLeftUnit")]
2323    pub position_left_unit: Option<String>,
2324    /// Offset top unit for an asset. This is a read-only field if the asset displayType is ASSET_DISPLAY_TYPE_OVERLAY. Applicable to the following creative types: all RICH_MEDIA.
2325    #[serde(rename = "positionTopUnit")]
2326    pub position_top_unit: Option<String>,
2327    /// Progressive URL for video asset. This is a read-only field. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID.
2328    #[serde(rename = "progressiveServingUrl")]
2329    pub progressive_serving_url: Option<String>,
2330    /// Whether the asset pushes down other content. Applicable to the following creative types: all RICH_MEDIA. Additionally, only applicable when the asset offsets are 0, the collapsedSize.width matches size.width, and the collapsedSize.height is less than size.height.
2331    pub pushdown: Option<bool>,
2332    /// Pushdown duration in seconds for an asset. Applicable to the following creative types: all RICH_MEDIA.Additionally, only applicable when the asset pushdown field is true, the offsets are 0, the collapsedSize.width matches size.width, and the collapsedSize.height is less than size.height. Acceptable values are 0 to 9.99, inclusive.
2333    #[serde(rename = "pushdownDuration")]
2334    pub pushdown_duration: Option<f32>,
2335    /// Role of the asset in relation to creative. Applicable to all but the following creative types: all REDIRECT and TRACKING_TEXT. This is a required field. PRIMARY applies to DISPLAY, FLASH_INPAGE, HTML5_BANNER, IMAGE, DISPLAY_IMAGE_GALLERY, all RICH_MEDIA (which may contain multiple primary assets), and all VPAID creatives. BACKUP_IMAGE applies to FLASH_INPAGE, HTML5_BANNER, all RICH_MEDIA, and all VPAID creatives. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE. ADDITIONAL_IMAGE and ADDITIONAL_FLASH apply to FLASH_INPAGE creatives. OTHER refers to assets from sources other than Campaign Manager, such as Studio uploaded assets, applicable to all RICH_MEDIA and all VPAID creatives. PARENT_VIDEO refers to videos uploaded by the user in Campaign Manager and is applicable to INSTREAM_VIDEO and VPAID_LINEAR_VIDEO creatives. TRANSCODED_VIDEO refers to videos transcoded by Campaign Manager from PARENT_VIDEO assets and is applicable to INSTREAM_VIDEO and VPAID_LINEAR_VIDEO creatives. ALTERNATE_VIDEO refers to the Campaign Manager representation of child asset videos from Studio, and is applicable to VPAID_LINEAR_VIDEO creatives. These cannot be added or removed within Campaign Manager. For VPAID_LINEAR_VIDEO creatives, PARENT_VIDEO, TRANSCODED_VIDEO and ALTERNATE_VIDEO assets that are marked active serve as backup in case the VPAID creative cannot be served. Only PARENT_VIDEO assets can be added or removed for an INSTREAM_VIDEO or VPAID_LINEAR_VIDEO creative. PARENT_AUDIO refers to audios uploaded by the user in Campaign Manager and is applicable to INSTREAM_AUDIO creatives. TRANSCODED_AUDIO refers to audios transcoded by Campaign Manager from PARENT_AUDIO assets and is applicable to INSTREAM_AUDIO creatives.
2336    pub role: Option<String>,
2337    /// Size associated with this creative asset. This is a required field when applicable; however for IMAGE and FLASH_INPAGE, creatives if left blank, this field will be automatically set using the actual size of the associated image asset. Applicable to the following creative types: DISPLAY_IMAGE_GALLERY, FLASH_INPAGE, HTML5_BANNER, IMAGE, and all RICH_MEDIA. Applicable to DISPLAY when the primary asset type is not HTML_IMAGE.
2338    pub size: Option<Size>,
2339    /// Whether the asset is SSL-compliant. This is a read-only field. Applicable to all but the following creative types: all REDIRECT and TRACKING_TEXT.
2340    #[serde(rename = "sslCompliant")]
2341    pub ssl_compliant: Option<bool>,
2342    /// Initial wait time type before making the asset visible. Applicable to the following creative types: all RICH_MEDIA.
2343    #[serde(rename = "startTimeType")]
2344    pub start_time_type: Option<String>,
2345    /// Streaming URL for video asset. This is a read-only field. Applicable to the following creative types: INSTREAM_VIDEO and all VPAID.
2346    #[serde(rename = "streamingServingUrl")]
2347    pub streaming_serving_url: Option<String>,
2348    /// Whether the asset is transparent. Applicable to the following creative types: all RICH_MEDIA. Additionally, only applicable to HTML5 assets.
2349    pub transparency: Option<bool>,
2350    /// Whether the asset is vertically locked. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA.
2351    #[serde(rename = "verticallyLocked")]
2352    pub vertically_locked: Option<bool>,
2353    /// Window mode options for flash assets. Applicable to the following creative types: FLASH_INPAGE, RICH_MEDIA_DISPLAY_EXPANDING, RICH_MEDIA_IM_EXPAND, RICH_MEDIA_DISPLAY_BANNER, and RICH_MEDIA_INPAGE_FLOATING.
2354    #[serde(rename = "windowMode")]
2355    pub window_mode: Option<String>,
2356    /// zIndex value of an asset. Applicable to the following creative types: all RICH_MEDIA.Additionally, only applicable to assets whose displayType is NOT one of the following types: ASSET_DISPLAY_TYPE_INPAGE or ASSET_DISPLAY_TYPE_OVERLAY. Acceptable values are -999999999 to 999999999, inclusive.
2357    #[serde(rename = "zIndex")]
2358    pub z_index: Option<i32>,
2359    /// File name of zip file. This is a read-only field. Applicable to the following creative types: HTML5_BANNER.
2360    #[serde(rename = "zipFilename")]
2361    pub zip_filename: Option<String>,
2362    /// Size of zip file. This is a read-only field. Applicable to the following creative types: HTML5_BANNER.
2363    #[serde(rename = "zipFilesize")]
2364    pub zip_filesize: Option<String>,
2365}
2366
2367impl common::Resource for CreativeAsset {}
2368
2369/// Creative Asset ID.
2370///
2371/// This type is not used in any activity, and only used as *part* of another schema.
2372///
2373#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2374#[serde_with::serde_as]
2375#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2376pub struct CreativeAssetId {
2377    /// Name of the creative asset. This is a required field while inserting an asset. After insertion, this assetIdentifier is used to identify the uploaded asset. Characters in the name must be alphanumeric or one of the following: ".-_ ". Spaces are allowed.
2378    pub name: Option<String>,
2379    /// Type of asset to upload. This is a required field. FLASH and IMAGE are no longer supported for new uploads. All image assets should use HTML_IMAGE.
2380    #[serde(rename = "type")]
2381    pub type_: Option<String>,
2382}
2383
2384impl common::Part for CreativeAssetId {}
2385
2386/// CreativeAssets contains properties of a creative asset file which will be uploaded or has already been uploaded. Refer to the creative sample code for how to upload assets and insert a creative.
2387///
2388/// # Activities
2389///
2390/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2391/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2392///
2393/// * [insert creative assets](CreativeAssetInsertCall) (request|response)
2394#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2395#[serde_with::serde_as]
2396#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2397pub struct CreativeAssetMetadata {
2398    /// ID of the creative asset. This is a required field.
2399    #[serde(rename = "assetIdentifier")]
2400    pub asset_identifier: Option<CreativeAssetId>,
2401    /// List of detected click tags for assets. This is a read-only, auto-generated field. This field is empty for a rich media asset.
2402    #[serde(rename = "clickTags")]
2403    pub click_tags: Option<Vec<ClickTag>>,
2404    /// List of feature dependencies for the creative asset that are detected by Campaign Manager. Feature dependencies are features that a browser must be able to support in order to render your HTML5 creative correctly. This is a read-only, auto-generated field.
2405    #[serde(rename = "detectedFeatures")]
2406    pub detected_features: Option<Vec<String>>,
2407    /// Numeric ID of the asset. This is a read-only, auto-generated field.
2408    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2409    pub id: Option<i64>,
2410    /// Dimension value for the numeric ID of the asset. This is a read-only, auto-generated field.
2411    #[serde(rename = "idDimensionValue")]
2412    pub id_dimension_value: Option<DimensionValue>,
2413    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creativeAssetMetadata".
2414    pub kind: Option<String>,
2415    /// Rules validated during code generation that generated a warning. This is a read-only, auto-generated field. Possible values are: - "ADMOB_REFERENCED" - "ASSET_FORMAT_UNSUPPORTED_DCM" - "ASSET_INVALID" - "CLICK_TAG_HARD_CODED" - "CLICK_TAG_INVALID" - "CLICK_TAG_IN_GWD" - "CLICK_TAG_MISSING" - "CLICK_TAG_MORE_THAN_ONE" - "CLICK_TAG_NON_TOP_LEVEL" - "COMPONENT_UNSUPPORTED_DCM" - "ENABLER_UNSUPPORTED_METHOD_DCM" - "EXTERNAL_FILE_REFERENCED" - "FILE_DETAIL_EMPTY" - "FILE_TYPE_INVALID" - "GWD_PROPERTIES_INVALID" - "HTML5_FEATURE_UNSUPPORTED" - "LINKED_FILE_NOT_FOUND" - "MAX_FLASH_VERSION_11" - "MRAID_REFERENCED" - "NOT_SSL_COMPLIANT" - "ORPHANED_ASSET" - "PRIMARY_HTML_MISSING" - "SVG_INVALID" - "ZIP_INVALID"
2416    #[serde(rename = "warnedValidationRules")]
2417    pub warned_validation_rules: Option<Vec<String>>,
2418}
2419
2420impl common::RequestValue for CreativeAssetMetadata {}
2421impl common::ResponseResult for CreativeAssetMetadata {}
2422
2423/// Encapsulates the list of rules for asset selection and a default asset in case none of the rules match. Applicable to INSTREAM_VIDEO creatives.
2424///
2425/// This type is not used in any activity, and only used as *part* of another schema.
2426///
2427#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2428#[serde_with::serde_as]
2429#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2430pub struct CreativeAssetSelection {
2431    /// A creativeAssets[].id. This should refer to one of the parent assets in this creative, and will be served if none of the rules match. This is a required field.
2432    #[serde(rename = "defaultAssetId")]
2433    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2434    pub default_asset_id: Option<i64>,
2435    /// Rules determine which asset will be served to a viewer. Rules will be evaluated in the order in which they are stored in this list. This list must contain at least one rule. Applicable to INSTREAM_VIDEO creatives.
2436    pub rules: Option<Vec<Rule>>,
2437}
2438
2439impl common::Part for CreativeAssetSelection {}
2440
2441/// Creative Assignment.
2442///
2443/// This type is not used in any activity, and only used as *part* of another schema.
2444///
2445#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2446#[serde_with::serde_as]
2447#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2448pub struct CreativeAssignment {
2449    /// Whether this creative assignment is active. When true, the creative will be included in the ad's rotation.
2450    pub active: Option<bool>,
2451    /// Whether applicable event tags should fire when this creative assignment is rendered. If this value is unset when the ad is inserted or updated, it will default to true for all creative types EXCEPT for INTERNAL_REDIRECT, INTERSTITIAL_INTERNAL_REDIRECT, and INSTREAM_VIDEO.
2452    #[serde(rename = "applyEventTags")]
2453    pub apply_event_tags: Option<bool>,
2454    /// Click-through URL of the creative assignment.
2455    #[serde(rename = "clickThroughUrl")]
2456    pub click_through_url: Option<ClickThroughUrl>,
2457    /// Companion creative overrides for this creative assignment. Applicable to video ads.
2458    #[serde(rename = "companionCreativeOverrides")]
2459    pub companion_creative_overrides: Option<Vec<CompanionClickThroughOverride>>,
2460    /// Creative group assignments for this creative assignment. Only one assignment per creative group number is allowed for a maximum of two assignments.
2461    #[serde(rename = "creativeGroupAssignments")]
2462    pub creative_group_assignments: Option<Vec<CreativeGroupAssignment>>,
2463    /// ID of the creative to be assigned. This is a required field.
2464    #[serde(rename = "creativeId")]
2465    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2466    pub creative_id: Option<i64>,
2467    /// Dimension value for the ID of the creative. This is a read-only, auto-generated field.
2468    #[serde(rename = "creativeIdDimensionValue")]
2469    pub creative_id_dimension_value: Option<DimensionValue>,
2470    /// no description provided
2471    #[serde(rename = "endTime")]
2472    pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2473    /// Rich media exit overrides for this creative assignment. Applicable when the creative type is any of the following: - DISPLAY - RICH_MEDIA_INPAGE - RICH_MEDIA_INPAGE_FLOATING - RICH_MEDIA_IM_EXPAND - RICH_MEDIA_EXPANDING - RICH_MEDIA_INTERSTITIAL_FLOAT - RICH_MEDIA_MOBILE_IN_APP - RICH_MEDIA_MULTI_FLOATING - RICH_MEDIA_PEEL_DOWN - VPAID_LINEAR - VPAID_NON_LINEAR
2474    #[serde(rename = "richMediaExitOverrides")]
2475    pub rich_media_exit_overrides: Option<Vec<RichMediaExitOverride>>,
2476    /// Sequence number of the creative assignment, applicable when the rotation type is CREATIVE_ROTATION_TYPE_SEQUENTIAL. Acceptable values are 1 to 65535, inclusive.
2477    pub sequence: Option<i32>,
2478    /// Whether the creative to be assigned is SSL-compliant. This is a read-only field that is auto-generated when the ad is inserted or updated.
2479    #[serde(rename = "sslCompliant")]
2480    pub ssl_compliant: Option<bool>,
2481    /// no description provided
2482    #[serde(rename = "startTime")]
2483    pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2484    /// Weight of the creative assignment, applicable when the rotation type is CREATIVE_ROTATION_TYPE_RANDOM. Value must be greater than or equal to 1.
2485    pub weight: Option<i32>,
2486}
2487
2488impl common::Part for CreativeAssignment {}
2489
2490/// Click-through URL
2491///
2492/// This type is not used in any activity, and only used as *part* of another schema.
2493///
2494#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2495#[serde_with::serde_as]
2496#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2497pub struct CreativeClickThroughUrl {
2498    /// Read-only convenience field representing the actual URL that will be used for this click-through. The URL is computed as follows: - If landingPageId is specified then that landing page's URL is assigned to this field. - Otherwise, the customClickThroughUrl is assigned to this field.
2499    #[serde(rename = "computedClickThroughUrl")]
2500    pub computed_click_through_url: Option<String>,
2501    /// Custom click-through URL. Applicable if the landingPageId field is left unset.
2502    #[serde(rename = "customClickThroughUrl")]
2503    pub custom_click_through_url: Option<String>,
2504    /// ID of the landing page for the click-through URL.
2505    #[serde(rename = "landingPageId")]
2506    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2507    pub landing_page_id: Option<i64>,
2508}
2509
2510impl common::Part for CreativeClickThroughUrl {}
2511
2512/// Creative Custom Event.
2513///
2514/// This type is not used in any activity, and only used as *part* of another schema.
2515///
2516#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2517#[serde_with::serde_as]
2518#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2519pub struct CreativeCustomEvent {
2520    /// Unique ID of this event used by Reporting and Data Transfer. This is a read-only field.
2521    #[serde(rename = "advertiserCustomEventId")]
2522    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2523    pub advertiser_custom_event_id: Option<i64>,
2524    /// User-entered name for the event.
2525    #[serde(rename = "advertiserCustomEventName")]
2526    pub advertiser_custom_event_name: Option<String>,
2527    /// Type of the event. This is a read-only field.
2528    #[serde(rename = "advertiserCustomEventType")]
2529    pub advertiser_custom_event_type: Option<String>,
2530    /// Artwork label column, used to link events in Campaign Manager back to events in Studio. This is a required field and should not be modified after insertion.
2531    #[serde(rename = "artworkLabel")]
2532    pub artwork_label: Option<String>,
2533    /// Artwork type used by the creative.This is a read-only field.
2534    #[serde(rename = "artworkType")]
2535    pub artwork_type: Option<String>,
2536    /// Exit click-through URL for the event. This field is used only for exit events.
2537    #[serde(rename = "exitClickThroughUrl")]
2538    pub exit_click_through_url: Option<CreativeClickThroughUrl>,
2539    /// ID of this event. This is a required field and should not be modified after insertion.
2540    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2541    pub id: Option<i64>,
2542    /// Properties for rich media popup windows. This field is used only for exit events.
2543    #[serde(rename = "popupWindowProperties")]
2544    pub popup_window_properties: Option<PopupWindowProperties>,
2545    /// Target type used by the event.
2546    #[serde(rename = "targetType")]
2547    pub target_type: Option<String>,
2548    /// Video reporting ID, used to differentiate multiple videos in a single creative. This is a read-only field.
2549    #[serde(rename = "videoReportingId")]
2550    pub video_reporting_id: Option<String>,
2551}
2552
2553impl common::Part for CreativeCustomEvent {}
2554
2555/// Contains properties of a creative field.
2556///
2557/// # Activities
2558///
2559/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2560/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2561///
2562/// * [delete creative fields](CreativeFieldDeleteCall) (none)
2563/// * [get creative fields](CreativeFieldGetCall) (response)
2564/// * [insert creative fields](CreativeFieldInsertCall) (request|response)
2565/// * [list creative fields](CreativeFieldListCall) (none)
2566/// * [patch creative fields](CreativeFieldPatchCall) (request|response)
2567/// * [update creative fields](CreativeFieldUpdateCall) (request|response)
2568#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2569#[serde_with::serde_as]
2570#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2571pub struct CreativeField {
2572    /// Account ID of this creative field. This is a read-only field that can be left blank.
2573    #[serde(rename = "accountId")]
2574    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2575    pub account_id: Option<i64>,
2576    /// Advertiser ID of this creative field. This is a required field on insertion.
2577    #[serde(rename = "advertiserId")]
2578    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2579    pub advertiser_id: Option<i64>,
2580    /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field.
2581    #[serde(rename = "advertiserIdDimensionValue")]
2582    pub advertiser_id_dimension_value: Option<DimensionValue>,
2583    /// ID of this creative field. This is a read-only, auto-generated field.
2584    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2585    pub id: Option<i64>,
2586    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creativeField".
2587    pub kind: Option<String>,
2588    /// Name of this creative field. This is a required field and must be less than 256 characters long and unique among creative fields of the same advertiser.
2589    pub name: Option<String>,
2590    /// Subaccount ID of this creative field. This is a read-only field that can be left blank.
2591    #[serde(rename = "subaccountId")]
2592    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2593    pub subaccount_id: Option<i64>,
2594}
2595
2596impl common::RequestValue for CreativeField {}
2597impl common::Resource for CreativeField {}
2598impl common::ResponseResult for CreativeField {}
2599
2600/// Creative Field Assignment.
2601///
2602/// This type is not used in any activity, and only used as *part* of another schema.
2603///
2604#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2605#[serde_with::serde_as]
2606#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2607pub struct CreativeFieldAssignment {
2608    /// ID of the creative field.
2609    #[serde(rename = "creativeFieldId")]
2610    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2611    pub creative_field_id: Option<i64>,
2612    /// ID of the creative field value.
2613    #[serde(rename = "creativeFieldValueId")]
2614    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2615    pub creative_field_value_id: Option<i64>,
2616}
2617
2618impl common::Part for CreativeFieldAssignment {}
2619
2620/// Contains properties of a creative field value.
2621///
2622/// # Activities
2623///
2624/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2625/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2626///
2627/// * [delete creative field values](CreativeFieldValueDeleteCall) (none)
2628/// * [get creative field values](CreativeFieldValueGetCall) (response)
2629/// * [insert creative field values](CreativeFieldValueInsertCall) (request|response)
2630/// * [list creative field values](CreativeFieldValueListCall) (none)
2631/// * [patch creative field values](CreativeFieldValuePatchCall) (request|response)
2632/// * [update creative field values](CreativeFieldValueUpdateCall) (request|response)
2633#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2634#[serde_with::serde_as]
2635#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2636pub struct CreativeFieldValue {
2637    /// ID of this creative field value. This is a read-only, auto-generated field.
2638    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2639    pub id: Option<i64>,
2640    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creativeFieldValue".
2641    pub kind: Option<String>,
2642    /// Value of this creative field value. It needs to be less than 256 characters in length and unique per creative field.
2643    pub value: Option<String>,
2644}
2645
2646impl common::RequestValue for CreativeFieldValue {}
2647impl common::Resource for CreativeFieldValue {}
2648impl common::ResponseResult for CreativeFieldValue {}
2649
2650/// Creative Field Value List Response
2651///
2652/// # Activities
2653///
2654/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2655/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2656///
2657/// * [list creative field values](CreativeFieldValueListCall) (response)
2658#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2659#[serde_with::serde_as]
2660#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2661pub struct CreativeFieldValuesListResponse {
2662    /// Creative field value collection.
2663    #[serde(rename = "creativeFieldValues")]
2664    pub creative_field_values: Option<Vec<CreativeFieldValue>>,
2665    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creativeFieldValuesListResponse".
2666    pub kind: Option<String>,
2667    /// Pagination token to be used for the next list operation.
2668    #[serde(rename = "nextPageToken")]
2669    pub next_page_token: Option<String>,
2670}
2671
2672impl common::ResponseResult for CreativeFieldValuesListResponse {}
2673
2674/// Creative Field List Response
2675///
2676/// # Activities
2677///
2678/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2679/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2680///
2681/// * [list creative fields](CreativeFieldListCall) (response)
2682#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2683#[serde_with::serde_as]
2684#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2685pub struct CreativeFieldsListResponse {
2686    /// Creative field collection.
2687    #[serde(rename = "creativeFields")]
2688    pub creative_fields: Option<Vec<CreativeField>>,
2689    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creativeFieldsListResponse".
2690    pub kind: Option<String>,
2691    /// Pagination token to be used for the next list operation.
2692    #[serde(rename = "nextPageToken")]
2693    pub next_page_token: Option<String>,
2694}
2695
2696impl common::ResponseResult for CreativeFieldsListResponse {}
2697
2698/// Contains properties of a creative group.
2699///
2700/// # Activities
2701///
2702/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2703/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2704///
2705/// * [get creative groups](CreativeGroupGetCall) (response)
2706/// * [insert creative groups](CreativeGroupInsertCall) (request|response)
2707/// * [list creative groups](CreativeGroupListCall) (none)
2708/// * [patch creative groups](CreativeGroupPatchCall) (request|response)
2709/// * [update creative groups](CreativeGroupUpdateCall) (request|response)
2710#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2711#[serde_with::serde_as]
2712#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2713pub struct CreativeGroup {
2714    /// Account ID of this creative group. This is a read-only field that can be left blank.
2715    #[serde(rename = "accountId")]
2716    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2717    pub account_id: Option<i64>,
2718    /// Advertiser ID of this creative group. This is a required field on insertion.
2719    #[serde(rename = "advertiserId")]
2720    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2721    pub advertiser_id: Option<i64>,
2722    /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field.
2723    #[serde(rename = "advertiserIdDimensionValue")]
2724    pub advertiser_id_dimension_value: Option<DimensionValue>,
2725    /// Subgroup of the creative group. Assign your creative groups to a subgroup in order to filter or manage them more easily. This field is required on insertion and is read-only after insertion. Acceptable values are 1 to 2, inclusive.
2726    #[serde(rename = "groupNumber")]
2727    pub group_number: Option<i32>,
2728    /// ID of this creative group. This is a read-only, auto-generated field.
2729    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2730    pub id: Option<i64>,
2731    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creativeGroup".
2732    pub kind: Option<String>,
2733    /// Name of this creative group. This is a required field and must be less than 256 characters long and unique among creative groups of the same advertiser.
2734    pub name: Option<String>,
2735    /// Subaccount ID of this creative group. This is a read-only field that can be left blank.
2736    #[serde(rename = "subaccountId")]
2737    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2738    pub subaccount_id: Option<i64>,
2739}
2740
2741impl common::RequestValue for CreativeGroup {}
2742impl common::Resource for CreativeGroup {}
2743impl common::ResponseResult for CreativeGroup {}
2744
2745/// Creative Group Assignment.
2746///
2747/// This type is not used in any activity, and only used as *part* of another schema.
2748///
2749#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2750#[serde_with::serde_as]
2751#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2752pub struct CreativeGroupAssignment {
2753    /// ID of the creative group to be assigned.
2754    #[serde(rename = "creativeGroupId")]
2755    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2756    pub creative_group_id: Option<i64>,
2757    /// Creative group number of the creative group assignment.
2758    #[serde(rename = "creativeGroupNumber")]
2759    pub creative_group_number: Option<String>,
2760}
2761
2762impl common::Part for CreativeGroupAssignment {}
2763
2764/// Creative Group List Response
2765///
2766/// # Activities
2767///
2768/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2769/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2770///
2771/// * [list creative groups](CreativeGroupListCall) (response)
2772#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2773#[serde_with::serde_as]
2774#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2775pub struct CreativeGroupsListResponse {
2776    /// Creative group collection.
2777    #[serde(rename = "creativeGroups")]
2778    pub creative_groups: Option<Vec<CreativeGroup>>,
2779    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creativeGroupsListResponse".
2780    pub kind: Option<String>,
2781    /// Pagination token to be used for the next list operation.
2782    #[serde(rename = "nextPageToken")]
2783    pub next_page_token: Option<String>,
2784}
2785
2786impl common::ResponseResult for CreativeGroupsListResponse {}
2787
2788/// Creative optimization settings.
2789///
2790/// This type is not used in any activity, and only used as *part* of another schema.
2791///
2792#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2793#[serde_with::serde_as]
2794#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2795pub struct CreativeOptimizationConfiguration {
2796    /// ID of this creative optimization config. This field is auto-generated when the campaign is inserted or updated. It can be null for existing campaigns.
2797    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2798    pub id: Option<i64>,
2799    /// Name of this creative optimization config. This is a required field and must be less than 129 characters long.
2800    pub name: Option<String>,
2801    /// List of optimization activities associated with this configuration.
2802    #[serde(rename = "optimizationActivitys")]
2803    pub optimization_activitys: Option<Vec<OptimizationActivity>>,
2804    /// Optimization model for this configuration.
2805    #[serde(rename = "optimizationModel")]
2806    pub optimization_model: Option<String>,
2807}
2808
2809impl common::Part for CreativeOptimizationConfiguration {}
2810
2811/// Creative Rotation.
2812///
2813/// This type is not used in any activity, and only used as *part* of another schema.
2814///
2815#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2816#[serde_with::serde_as]
2817#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2818pub struct CreativeRotation {
2819    /// Creative assignments in this creative rotation.
2820    #[serde(rename = "creativeAssignments")]
2821    pub creative_assignments: Option<Vec<CreativeAssignment>>,
2822    /// Creative optimization configuration that is used by this ad. It should refer to one of the existing optimization configurations in the ad's campaign. If it is unset or set to 0, then the campaign's default optimization configuration will be used for this ad.
2823    #[serde(rename = "creativeOptimizationConfigurationId")]
2824    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2825    pub creative_optimization_configuration_id: Option<i64>,
2826    /// Type of creative rotation. Can be used to specify whether to use sequential or random rotation.
2827    #[serde(rename = "type")]
2828    pub type_: Option<String>,
2829    /// Strategy for calculating weights. Used with CREATIVE_ROTATION_TYPE_RANDOM.
2830    #[serde(rename = "weightCalculationStrategy")]
2831    pub weight_calculation_strategy: Option<String>,
2832}
2833
2834impl common::Part for CreativeRotation {}
2835
2836/// Creative List Response
2837///
2838/// # Activities
2839///
2840/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2841/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2842///
2843/// * [list creatives](CreativeListCall) (response)
2844#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2845#[serde_with::serde_as]
2846#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2847pub struct CreativesListResponse {
2848    /// Creative collection.
2849    pub creatives: Option<Vec<Creative>>,
2850    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#creativesListResponse".
2851    pub kind: Option<String>,
2852    /// Pagination token to be used for the next list operation.
2853    #[serde(rename = "nextPageToken")]
2854    pub next_page_token: Option<String>,
2855}
2856
2857impl common::ResponseResult for CreativesListResponse {}
2858
2859/// Represents fields that are compatible to be selected for a report of type "CROSS_DIMENSION_REACH".
2860///
2861/// This type is not used in any activity, and only used as *part* of another schema.
2862///
2863#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2864#[serde_with::serde_as]
2865#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2866pub struct CrossDimensionReachReportCompatibleFields {
2867    /// Dimensions which are compatible to be selected in the "breakdown" section of the report.
2868    pub breakdown: Option<Vec<Dimension>>,
2869    /// Dimensions which are compatible to be selected in the "dimensionFilters" section of the report.
2870    #[serde(rename = "dimensionFilters")]
2871    pub dimension_filters: Option<Vec<Dimension>>,
2872    /// The kind of resource this is, in this case dfareporting#crossDimensionReachReportCompatibleFields.
2873    pub kind: Option<String>,
2874    /// Metrics which are compatible to be selected in the "metricNames" section of the report.
2875    pub metrics: Option<Vec<Metric>>,
2876    /// Metrics which are compatible to be selected in the "overlapMetricNames" section of the report.
2877    #[serde(rename = "overlapMetrics")]
2878    pub overlap_metrics: Option<Vec<Metric>>,
2879}
2880
2881impl common::Part for CrossDimensionReachReportCompatibleFields {}
2882
2883/// A custom floodlight variable. This field may only be used when calling batchinsert; it is not supported by batchupdate.
2884///
2885/// This type is not used in any activity, and only used as *part* of another schema.
2886///
2887#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2888#[serde_with::serde_as]
2889#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2890pub struct CustomFloodlightVariable {
2891    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#customFloodlightVariable".
2892    pub kind: Option<String>,
2893    /// The type of custom floodlight variable to supply a value for. These map to the "u[1-20]=" in the tags.
2894    #[serde(rename = "type")]
2895    pub type_: Option<String>,
2896    /// The value of the custom floodlight variable. The length of string must not exceed 100 characters.
2897    pub value: Option<String>,
2898}
2899
2900impl common::Part for CustomFloodlightVariable {}
2901
2902/// Represents a Custom Rich Media Events group.
2903///
2904/// This type is not used in any activity, and only used as *part* of another schema.
2905///
2906#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2907#[serde_with::serde_as]
2908#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2909pub struct CustomRichMediaEvents {
2910    /// List of custom rich media event IDs. Dimension values must be all of type dfa:richMediaEventTypeIdAndName.
2911    #[serde(rename = "filteredEventIds")]
2912    pub filtered_event_ids: Option<Vec<DimensionValue>>,
2913    /// The kind of resource this is, in this case dfareporting#customRichMediaEvents.
2914    pub kind: Option<String>,
2915}
2916
2917impl common::Part for CustomRichMediaEvents {}
2918
2919/// Custom Viewability Metric
2920///
2921/// This type is not used in any activity, and only used as *part* of another schema.
2922///
2923#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2924#[serde_with::serde_as]
2925#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2926pub struct CustomViewabilityMetric {
2927    /// Configuration of the custom viewability metric.
2928    pub configuration: Option<CustomViewabilityMetricConfiguration>,
2929    /// ID of the custom viewability metric.
2930    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2931    pub id: Option<i64>,
2932    /// Name of the custom viewability metric.
2933    pub name: Option<String>,
2934}
2935
2936impl common::Part for CustomViewabilityMetric {}
2937
2938/// The attributes, like playtime and percent onscreen, that define the Custom Viewability Metric.
2939///
2940/// This type is not used in any activity, and only used as *part* of another schema.
2941///
2942#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2943#[serde_with::serde_as]
2944#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2945pub struct CustomViewabilityMetricConfiguration {
2946    /// Whether the video must be audible to count an impression.
2947    pub audible: Option<bool>,
2948    /// The time in milliseconds the video must play for the Custom Viewability Metric to count an impression. If both this and timePercent are specified, the earlier of the two will be used.
2949    #[serde(rename = "timeMillis")]
2950    pub time_millis: Option<i32>,
2951    /// The percentage of video that must play for the Custom Viewability Metric to count an impression. If both this and timeMillis are specified, the earlier of the two will be used.
2952    #[serde(rename = "timePercent")]
2953    pub time_percent: Option<i32>,
2954    /// The percentage of video that must be on screen for the Custom Viewability Metric to count an impression.
2955    #[serde(rename = "viewabilityPercent")]
2956    pub viewability_percent: Option<i32>,
2957}
2958
2959impl common::Part for CustomViewabilityMetricConfiguration {}
2960
2961/// Represents a date range.
2962///
2963/// This type is not used in any activity, and only used as *part* of another schema.
2964///
2965#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2966#[serde_with::serde_as]
2967#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2968pub struct DateRange {
2969    /// no description provided
2970    #[serde(rename = "endDate")]
2971    pub end_date: Option<chrono::NaiveDate>,
2972    /// The kind of resource this is, in this case dfareporting#dateRange.
2973    pub kind: Option<String>,
2974    /// The date range relative to the date of when the report is run.
2975    #[serde(rename = "relativeDateRange")]
2976    pub relative_date_range: Option<String>,
2977    /// no description provided
2978    #[serde(rename = "startDate")]
2979    pub start_date: Option<chrono::NaiveDate>,
2980}
2981
2982impl common::Part for DateRange {}
2983
2984/// Day Part Targeting.
2985///
2986/// This type is not used in any activity, and only used as *part* of another schema.
2987///
2988#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2989#[serde_with::serde_as]
2990#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2991pub struct DayPartTargeting {
2992    /// Days of the week when the ad will serve. Acceptable values are: - "SUNDAY" - "MONDAY" - "TUESDAY" - "WEDNESDAY" - "THURSDAY" - "FRIDAY" - "SATURDAY"
2993    #[serde(rename = "daysOfWeek")]
2994    pub days_of_week: Option<Vec<String>>,
2995    /// Hours of the day when the ad will serve, where 0 is midnight to 1 AM and 23 is 11 PM to midnight. Can be specified with days of week, in which case the ad would serve during these hours on the specified days. For example if Monday, Wednesday, Friday are the days of week specified and 9-10am, 3-5pm (hours 9, 15, and 16) is specified, the ad would serve Monday, Wednesdays, and Fridays at 9-10am and 3-5pm. Acceptable values are 0 to 23, inclusive.
2996    #[serde(rename = "hoursOfDay")]
2997    pub hours_of_day: Option<Vec<i32>>,
2998    /// Whether or not to use the user's local time. If false, the America/New York time zone applies.
2999    #[serde(rename = "userLocalTime")]
3000    pub user_local_time: Option<bool>,
3001}
3002
3003impl common::Part for DayPartTargeting {}
3004
3005/// Contains information about a landing page deep link.
3006///
3007/// This type is not used in any activity, and only used as *part* of another schema.
3008///
3009#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3010#[serde_with::serde_as]
3011#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3012pub struct DeepLink {
3013    /// The URL of the mobile app being linked to.
3014    #[serde(rename = "appUrl")]
3015    pub app_url: Option<String>,
3016    /// The fallback URL. This URL will be served to users who do not have the mobile app installed.
3017    #[serde(rename = "fallbackUrl")]
3018    pub fallback_url: Option<String>,
3019    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#deepLink".
3020    pub kind: Option<String>,
3021    /// The mobile app targeted by this deep link.
3022    #[serde(rename = "mobileApp")]
3023    pub mobile_app: Option<MobileApp>,
3024    /// Ads served to users on these remarketing lists will use this deep link. Applicable when mobileApp.directory is APPLE_APP_STORE.
3025    #[serde(rename = "remarketingListIds")]
3026    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
3027    pub remarketing_list_ids: Option<Vec<i64>>,
3028}
3029
3030impl common::Part for DeepLink {}
3031
3032/// Properties of inheriting and overriding the default click-through event tag. A campaign may override the event tag defined at the advertiser level, and an ad may also override the campaign's setting further.
3033///
3034/// This type is not used in any activity, and only used as *part* of another schema.
3035///
3036#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3037#[serde_with::serde_as]
3038#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3039pub struct DefaultClickThroughEventTagProperties {
3040    /// ID of the click-through event tag to apply to all ads in this entity's scope.
3041    #[serde(rename = "defaultClickThroughEventTagId")]
3042    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3043    pub default_click_through_event_tag_id: Option<i64>,
3044    /// Whether this entity should override the inherited default click-through event tag with its own defined value.
3045    #[serde(rename = "overrideInheritedEventTag")]
3046    pub override_inherited_event_tag: Option<bool>,
3047}
3048
3049impl common::Part for DefaultClickThroughEventTagProperties {}
3050
3051/// Delivery Schedule.
3052///
3053/// This type is not used in any activity, and only used as *part* of another schema.
3054///
3055#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3056#[serde_with::serde_as]
3057#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3058pub struct DeliverySchedule {
3059    /// Limit on the number of times an individual user can be served the ad within a specified period of time.
3060    #[serde(rename = "frequencyCap")]
3061    pub frequency_cap: Option<FrequencyCap>,
3062    /// Whether or not hard cutoff is enabled. If true, the ad will not serve after the end date and time. Otherwise the ad will continue to be served until it has reached its delivery goals.
3063    #[serde(rename = "hardCutoff")]
3064    pub hard_cutoff: Option<bool>,
3065    /// Impression ratio for this ad. This ratio determines how often each ad is served relative to the others. For example, if ad A has an impression ratio of 1 and ad B has an impression ratio of 3, then Campaign Manager will serve ad B three times as often as ad A. Acceptable values are 1 to 10, inclusive.
3066    #[serde(rename = "impressionRatio")]
3067    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3068    pub impression_ratio: Option<i64>,
3069    /// Serving priority of an ad, with respect to other ads. The lower the priority number, the greater the priority with which it is served.
3070    pub priority: Option<String>,
3071}
3072
3073impl common::Part for DeliverySchedule {}
3074
3075/// Google Ad Manager Settings
3076///
3077/// This type is not used in any activity, and only used as *part* of another schema.
3078///
3079#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3080#[serde_with::serde_as]
3081#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3082pub struct DfpSettings {
3083    /// Ad Manager network code for this directory site.
3084    #[serde(rename = "dfpNetworkCode")]
3085    pub dfp_network_code: Option<String>,
3086    /// Ad Manager network name for this directory site.
3087    #[serde(rename = "dfpNetworkName")]
3088    pub dfp_network_name: Option<String>,
3089    /// Whether this directory site accepts programmatic placements.
3090    #[serde(rename = "programmaticPlacementAccepted")]
3091    pub programmatic_placement_accepted: Option<bool>,
3092    /// Whether this directory site accepts publisher-paid tags.
3093    #[serde(rename = "pubPaidPlacementAccepted")]
3094    pub pub_paid_placement_accepted: Option<bool>,
3095    /// Whether this directory site is available only via Publisher Portal.
3096    #[serde(rename = "publisherPortalOnly")]
3097    pub publisher_portal_only: Option<bool>,
3098}
3099
3100impl common::Part for DfpSettings {}
3101
3102/// Represents a dimension.
3103///
3104/// This type is not used in any activity, and only used as *part* of another schema.
3105///
3106#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3107#[serde_with::serde_as]
3108#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3109pub struct Dimension {
3110    /// The kind of resource this is, in this case dfareporting#dimension.
3111    pub kind: Option<String>,
3112    /// The dimension name, e.g. dfa:advertiser
3113    pub name: Option<String>,
3114}
3115
3116impl common::Part for Dimension {}
3117
3118/// Represents a dimension filter.
3119///
3120/// This type is not used in any activity, and only used as *part* of another schema.
3121///
3122#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3123#[serde_with::serde_as]
3124#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3125pub struct DimensionFilter {
3126    /// The name of the dimension to filter.
3127    #[serde(rename = "dimensionName")]
3128    pub dimension_name: Option<String>,
3129    /// The kind of resource this is, in this case dfareporting#dimensionFilter.
3130    pub kind: Option<String>,
3131    /// The value of the dimension to filter.
3132    pub value: Option<String>,
3133}
3134
3135impl common::Part for DimensionFilter {}
3136
3137/// Represents a DimensionValue resource.
3138///
3139/// # Activities
3140///
3141/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3142/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3143///
3144/// * [query dimension values](DimensionValueQueryCall) (none)
3145#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3146#[serde_with::serde_as]
3147#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3148pub struct DimensionValue {
3149    /// The name of the dimension.
3150    #[serde(rename = "dimensionName")]
3151    pub dimension_name: Option<String>,
3152    /// The eTag of this response for caching purposes.
3153    pub etag: Option<String>,
3154    /// The ID associated with the value if available.
3155    pub id: Option<String>,
3156    /// The kind of resource this is, in this case dfareporting#dimensionValue.
3157    pub kind: Option<String>,
3158    /// Determines how the 'value' field is matched when filtering. If not specified, defaults to EXACT. If set to WILDCARD_EXPRESSION, '*' is allowed as a placeholder for variable length character sequences, and it can be escaped with a backslash. Note, only paid search dimensions ('dfa:paidSearch*') allow a matchType other than EXACT.
3159    #[serde(rename = "matchType")]
3160    pub match_type: Option<String>,
3161    /// The value of the dimension.
3162    pub value: Option<String>,
3163}
3164
3165impl common::Resource for DimensionValue {}
3166
3167/// Represents the list of DimensionValue resources.
3168///
3169/// # Activities
3170///
3171/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3172/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3173///
3174/// * [query dimension values](DimensionValueQueryCall) (response)
3175#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3176#[serde_with::serde_as]
3177#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3178pub struct DimensionValueList {
3179    /// The eTag of this response for caching purposes.
3180    pub etag: Option<String>,
3181    /// The dimension values returned in this response.
3182    pub items: Option<Vec<DimensionValue>>,
3183    /// The kind of list this is, in this case dfareporting#dimensionValueList.
3184    pub kind: Option<String>,
3185    /// Continuation token used to page through dimension values. To retrieve the next page of results, set the next request's "pageToken" to the value of this field. The page token is only valid for a limited amount of time and should not be persisted.
3186    #[serde(rename = "nextPageToken")]
3187    pub next_page_token: Option<String>,
3188}
3189
3190impl common::ResponseResult for DimensionValueList {}
3191
3192/// Represents a DimensionValuesRequest.
3193///
3194/// # Activities
3195///
3196/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3197/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3198///
3199/// * [query dimension values](DimensionValueQueryCall) (request)
3200#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3201#[serde_with::serde_as]
3202#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3203pub struct DimensionValueRequest {
3204    /// The name of the dimension for which values should be requested.
3205    #[serde(rename = "dimensionName")]
3206    pub dimension_name: Option<String>,
3207    /// no description provided
3208    #[serde(rename = "endDate")]
3209    pub end_date: Option<chrono::NaiveDate>,
3210    /// The list of filters by which to filter values. The filters are ANDed.
3211    pub filters: Option<Vec<DimensionFilter>>,
3212    /// The kind of request this is, in this case dfareporting#dimensionValueRequest .
3213    pub kind: Option<String>,
3214    /// no description provided
3215    #[serde(rename = "startDate")]
3216    pub start_date: Option<chrono::NaiveDate>,
3217}
3218
3219impl common::RequestValue for DimensionValueRequest {}
3220
3221/// DirectorySites contains properties of a website from the Site Directory. Sites need to be added to an account via the Sites resource before they can be assigned to a placement.
3222///
3223/// # Activities
3224///
3225/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3226/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3227///
3228/// * [get directory sites](DirectorySiteGetCall) (response)
3229/// * [insert directory sites](DirectorySiteInsertCall) (request|response)
3230/// * [list directory sites](DirectorySiteListCall) (none)
3231#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3232#[serde_with::serde_as]
3233#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3234pub struct DirectorySite {
3235    /// Whether this directory site is active.
3236    pub active: Option<bool>,
3237    /// ID of this directory site. This is a read-only, auto-generated field.
3238    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3239    pub id: Option<i64>,
3240    /// Dimension value for the ID of this directory site. This is a read-only, auto-generated field.
3241    #[serde(rename = "idDimensionValue")]
3242    pub id_dimension_value: Option<DimensionValue>,
3243    /// Tag types for regular placements. Acceptable values are: - "STANDARD" - "IFRAME_JAVASCRIPT_INPAGE" - "INTERNAL_REDIRECT_INPAGE" - "JAVASCRIPT_INPAGE"
3244    #[serde(rename = "inpageTagFormats")]
3245    pub inpage_tag_formats: Option<Vec<String>>,
3246    /// Tag types for interstitial placements. Acceptable values are: - "IFRAME_JAVASCRIPT_INTERSTITIAL" - "INTERNAL_REDIRECT_INTERSTITIAL" - "JAVASCRIPT_INTERSTITIAL"
3247    #[serde(rename = "interstitialTagFormats")]
3248    pub interstitial_tag_formats: Option<Vec<String>>,
3249    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#directorySite".
3250    pub kind: Option<String>,
3251    /// Name of this directory site.
3252    pub name: Option<String>,
3253    /// Directory site settings.
3254    pub settings: Option<DirectorySiteSettings>,
3255    /// URL of this directory site.
3256    pub url: Option<String>,
3257}
3258
3259impl common::RequestValue for DirectorySite {}
3260impl common::Resource for DirectorySite {}
3261impl common::ResponseResult for DirectorySite {}
3262
3263/// Directory Site Settings
3264///
3265/// This type is not used in any activity, and only used as *part* of another schema.
3266///
3267#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3268#[serde_with::serde_as]
3269#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3270pub struct DirectorySiteSettings {
3271    /// Whether this directory site has disabled active view creatives.
3272    #[serde(rename = "activeViewOptOut")]
3273    pub active_view_opt_out: Option<bool>,
3274    /// Directory site Ad Manager settings.
3275    #[serde(rename = "dfpSettings")]
3276    pub dfp_settings: Option<DfpSettings>,
3277    /// Whether this site accepts in-stream video ads.
3278    #[serde(rename = "instreamVideoPlacementAccepted")]
3279    pub instream_video_placement_accepted: Option<bool>,
3280    /// Whether this site accepts interstitial ads.
3281    #[serde(rename = "interstitialPlacementAccepted")]
3282    pub interstitial_placement_accepted: Option<bool>,
3283}
3284
3285impl common::Part for DirectorySiteSettings {}
3286
3287/// Directory Site List Response
3288///
3289/// # Activities
3290///
3291/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3292/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3293///
3294/// * [list directory sites](DirectorySiteListCall) (response)
3295#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3296#[serde_with::serde_as]
3297#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3298pub struct DirectorySitesListResponse {
3299    /// Directory site collection.
3300    #[serde(rename = "directorySites")]
3301    pub directory_sites: Option<Vec<DirectorySite>>,
3302    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#directorySitesListResponse".
3303    pub kind: Option<String>,
3304    /// Pagination token to be used for the next list operation.
3305    #[serde(rename = "nextPageToken")]
3306    pub next_page_token: Option<String>,
3307}
3308
3309impl common::ResponseResult for DirectorySitesListResponse {}
3310
3311/// Contains properties of a dynamic targeting key. Dynamic targeting keys are unique, user-friendly labels, created at the advertiser level in DCM, that can be assigned to ads, creatives, and placements and used for targeting with Studio dynamic creatives. Use these labels instead of numeric Campaign Manager IDs (such as placement IDs) to save time and avoid errors in your dynamic feeds.
3312///
3313/// # Activities
3314///
3315/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3316/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3317///
3318/// * [delete dynamic targeting keys](DynamicTargetingKeyDeleteCall) (none)
3319/// * [insert dynamic targeting keys](DynamicTargetingKeyInsertCall) (request|response)
3320/// * [list dynamic targeting keys](DynamicTargetingKeyListCall) (none)
3321#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3322#[serde_with::serde_as]
3323#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3324pub struct DynamicTargetingKey {
3325    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#dynamicTargetingKey".
3326    pub kind: Option<String>,
3327    /// Name of this dynamic targeting key. This is a required field. Must be less than 256 characters long and cannot contain commas. All characters are converted to lowercase.
3328    pub name: Option<String>,
3329    /// ID of the object of this dynamic targeting key. This is a required field.
3330    #[serde(rename = "objectId")]
3331    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3332    pub object_id: Option<i64>,
3333    /// Type of the object of this dynamic targeting key. This is a required field.
3334    #[serde(rename = "objectType")]
3335    pub object_type: Option<String>,
3336}
3337
3338impl common::RequestValue for DynamicTargetingKey {}
3339impl common::Resource for DynamicTargetingKey {}
3340impl common::ResponseResult for DynamicTargetingKey {}
3341
3342/// Dynamic Targeting Key List Response
3343///
3344/// # Activities
3345///
3346/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3347/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3348///
3349/// * [list dynamic targeting keys](DynamicTargetingKeyListCall) (response)
3350#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3351#[serde_with::serde_as]
3352#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3353pub struct DynamicTargetingKeysListResponse {
3354    /// Dynamic targeting key collection.
3355    #[serde(rename = "dynamicTargetingKeys")]
3356    pub dynamic_targeting_keys: Option<Vec<DynamicTargetingKey>>,
3357    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#dynamicTargetingKeysListResponse".
3358    pub kind: Option<String>,
3359}
3360
3361impl common::ResponseResult for DynamicTargetingKeysListResponse {}
3362
3363/// A description of how user IDs are encrypted.
3364///
3365/// This type is not used in any activity, and only used as *part* of another schema.
3366///
3367#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3368#[serde_with::serde_as]
3369#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3370pub struct EncryptionInfo {
3371    /// The encryption entity ID. This should match the encryption configuration for ad serving or Data Transfer.
3372    #[serde(rename = "encryptionEntityId")]
3373    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3374    pub encryption_entity_id: Option<i64>,
3375    /// The encryption entity type. This should match the encryption configuration for ad serving or Data Transfer.
3376    #[serde(rename = "encryptionEntityType")]
3377    pub encryption_entity_type: Option<String>,
3378    /// Describes whether the encrypted cookie was received from ad serving (the %m macro) or from Data Transfer.
3379    #[serde(rename = "encryptionSource")]
3380    pub encryption_source: Option<String>,
3381    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#encryptionInfo".
3382    pub kind: Option<String>,
3383}
3384
3385impl common::Part for EncryptionInfo {}
3386
3387/// Contains properties of an event tag.
3388///
3389/// # Activities
3390///
3391/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3392/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3393///
3394/// * [delete event tags](EventTagDeleteCall) (none)
3395/// * [get event tags](EventTagGetCall) (response)
3396/// * [insert event tags](EventTagInsertCall) (request|response)
3397/// * [list event tags](EventTagListCall) (none)
3398/// * [patch event tags](EventTagPatchCall) (request|response)
3399/// * [update event tags](EventTagUpdateCall) (request|response)
3400#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3401#[serde_with::serde_as]
3402#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3403pub struct EventTag {
3404    /// Account ID of this event tag. This is a read-only field that can be left blank.
3405    #[serde(rename = "accountId")]
3406    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3407    pub account_id: Option<i64>,
3408    /// Advertiser ID of this event tag. This field or the campaignId field is required on insertion.
3409    #[serde(rename = "advertiserId")]
3410    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3411    pub advertiser_id: Option<i64>,
3412    /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field.
3413    #[serde(rename = "advertiserIdDimensionValue")]
3414    pub advertiser_id_dimension_value: Option<DimensionValue>,
3415    /// Campaign ID of this event tag. This field or the advertiserId field is required on insertion.
3416    #[serde(rename = "campaignId")]
3417    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3418    pub campaign_id: Option<i64>,
3419    /// Dimension value for the ID of the campaign. This is a read-only, auto-generated field.
3420    #[serde(rename = "campaignIdDimensionValue")]
3421    pub campaign_id_dimension_value: Option<DimensionValue>,
3422    /// Whether this event tag should be automatically enabled for all of the advertiser's campaigns and ads.
3423    #[serde(rename = "enabledByDefault")]
3424    pub enabled_by_default: Option<bool>,
3425    /// Whether to remove this event tag from ads that are trafficked through Display & Video 360 to Ad Exchange. This may be useful if the event tag uses a pixel that is unapproved for Ad Exchange bids on one or more networks, such as the Google Display Network.
3426    #[serde(rename = "excludeFromAdxRequests")]
3427    pub exclude_from_adx_requests: Option<bool>,
3428    /// ID of this event tag. This is a read-only, auto-generated field.
3429    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3430    pub id: Option<i64>,
3431    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#eventTag".
3432    pub kind: Option<String>,
3433    /// Name of this event tag. This is a required field and must be less than 256 characters long.
3434    pub name: Option<String>,
3435    /// Site filter type for this event tag. If no type is specified then the event tag will be applied to all sites.
3436    #[serde(rename = "siteFilterType")]
3437    pub site_filter_type: Option<String>,
3438    /// Filter list of site IDs associated with this event tag. The siteFilterType determines whether this is a allowlist or blocklist filter.
3439    #[serde(rename = "siteIds")]
3440    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
3441    pub site_ids: Option<Vec<i64>>,
3442    /// Whether this tag is SSL-compliant or not. This is a read-only field.
3443    #[serde(rename = "sslCompliant")]
3444    pub ssl_compliant: Option<bool>,
3445    /// Status of this event tag. Must be ENABLED for this event tag to fire. This is a required field.
3446    pub status: Option<String>,
3447    /// Subaccount ID of this event tag. This is a read-only field that can be left blank.
3448    #[serde(rename = "subaccountId")]
3449    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3450    pub subaccount_id: Option<i64>,
3451    /// Event tag type. Can be used to specify whether to use a third-party pixel, a third-party JavaScript URL, or a third-party click-through URL for either impression or click tracking. This is a required field.
3452    #[serde(rename = "type")]
3453    pub type_: Option<String>,
3454    /// Payload URL for this event tag. The URL on a click-through event tag should have a landing page URL appended to the end of it. This field is required on insertion.
3455    pub url: Option<String>,
3456    /// Number of times the landing page URL should be URL-escaped before being appended to the click-through event tag URL. Only applies to click-through event tags as specified by the event tag type.
3457    #[serde(rename = "urlEscapeLevels")]
3458    pub url_escape_levels: Option<i32>,
3459}
3460
3461impl common::RequestValue for EventTag {}
3462impl common::Resource for EventTag {}
3463impl common::ResponseResult for EventTag {}
3464
3465/// Event tag override information.
3466///
3467/// This type is not used in any activity, and only used as *part* of another schema.
3468///
3469#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3470#[serde_with::serde_as]
3471#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3472pub struct EventTagOverride {
3473    /// Whether this override is enabled.
3474    pub enabled: Option<bool>,
3475    /// ID of this event tag override. This is a read-only, auto-generated field.
3476    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3477    pub id: Option<i64>,
3478}
3479
3480impl common::Part for EventTagOverride {}
3481
3482/// Event Tag List Response
3483///
3484/// # Activities
3485///
3486/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3487/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3488///
3489/// * [list event tags](EventTagListCall) (response)
3490#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3491#[serde_with::serde_as]
3492#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3493pub struct EventTagsListResponse {
3494    /// Event tag collection.
3495    #[serde(rename = "eventTags")]
3496    pub event_tags: Option<Vec<EventTag>>,
3497    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#eventTagsListResponse".
3498    pub kind: Option<String>,
3499}
3500
3501impl common::ResponseResult for EventTagsListResponse {}
3502
3503/// Represents a File resource. A file contains the metadata for a report run. It shows the status of the run and holds the URLs to the generated report data if the run is finished and the status is “REPORT_AVAILABLE”.
3504///
3505/// # Activities
3506///
3507/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3508/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3509///
3510/// * [get files](FileGetCall) (response)
3511/// * [list files](FileListCall) (none)
3512/// * [files get reports](ReportFileGetCall) (response)
3513/// * [run reports](ReportRunCall) (response)
3514#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3515#[serde_with::serde_as]
3516#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3517pub struct File {
3518    /// The date range for which the file has report data. The date range will always be the absolute date range for which the report is run.
3519    #[serde(rename = "dateRange")]
3520    pub date_range: Option<DateRange>,
3521    /// Etag of this resource.
3522    pub etag: Option<String>,
3523    /// The filename of the file.
3524    #[serde(rename = "fileName")]
3525    pub file_name: Option<String>,
3526    /// The output format of the report. Only available once the file is available.
3527    pub format: Option<String>,
3528    /// The unique ID of this report file.
3529    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3530    pub id: Option<i64>,
3531    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#file".
3532    pub kind: Option<String>,
3533    /// The timestamp in milliseconds since epoch when this file was last modified.
3534    #[serde(rename = "lastModifiedTime")]
3535    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3536    pub last_modified_time: Option<i64>,
3537    /// The ID of the report this file was generated from.
3538    #[serde(rename = "reportId")]
3539    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3540    pub report_id: Option<i64>,
3541    /// The status of the report file.
3542    pub status: Option<String>,
3543    /// The URLs where the completed report file can be downloaded.
3544    pub urls: Option<FileUrls>,
3545}
3546
3547impl common::Resource for File {}
3548impl common::ResponseResult for File {}
3549
3550/// List of files for a report.
3551///
3552/// # Activities
3553///
3554/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3555/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3556///
3557/// * [list files](FileListCall) (response)
3558/// * [files list reports](ReportFileListCall) (response)
3559#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3560#[serde_with::serde_as]
3561#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3562pub struct FileList {
3563    /// Etag of this resource.
3564    pub etag: Option<String>,
3565    /// The files returned in this response.
3566    pub items: Option<Vec<File>>,
3567    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#fileList".
3568    pub kind: Option<String>,
3569    /// Continuation token used to page through files. To retrieve the next page of results, set the next request's "pageToken" to the value of this field. The page token is only valid for a limited amount of time and should not be persisted.
3570    #[serde(rename = "nextPageToken")]
3571    pub next_page_token: Option<String>,
3572}
3573
3574impl common::ResponseResult for FileList {}
3575
3576/// Flight
3577///
3578/// This type is not used in any activity, and only used as *part* of another schema.
3579///
3580#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3581#[serde_with::serde_as]
3582#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3583pub struct Flight {
3584    /// no description provided
3585    #[serde(rename = "endDate")]
3586    pub end_date: Option<chrono::NaiveDate>,
3587    /// Rate or cost of this flight.
3588    #[serde(rename = "rateOrCost")]
3589    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3590    pub rate_or_cost: Option<i64>,
3591    /// no description provided
3592    #[serde(rename = "startDate")]
3593    pub start_date: Option<chrono::NaiveDate>,
3594    /// Units of this flight.
3595    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3596    pub units: Option<i64>,
3597}
3598
3599impl common::Part for Flight {}
3600
3601/// Floodlight Activity GenerateTag Response
3602///
3603/// # Activities
3604///
3605/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3606/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3607///
3608/// * [generatetag floodlight activities](FloodlightActivityGeneratetagCall) (response)
3609#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3610#[serde_with::serde_as]
3611#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3612pub struct FloodlightActivitiesGenerateTagResponse {
3613    /// Generated tag for this Floodlight activity. For global site tags, this is the event snippet.
3614    #[serde(rename = "floodlightActivityTag")]
3615    pub floodlight_activity_tag: Option<String>,
3616    /// The global snippet section of a global site tag. The global site tag sets new cookies on your domain, which will store a unique identifier for a user or the ad click that brought the user to your site. Learn more.
3617    #[serde(rename = "globalSiteTagGlobalSnippet")]
3618    pub global_site_tag_global_snippet: Option<String>,
3619    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#floodlightActivitiesGenerateTagResponse".
3620    pub kind: Option<String>,
3621}
3622
3623impl common::ResponseResult for FloodlightActivitiesGenerateTagResponse {}
3624
3625/// Floodlight Activity List Response
3626///
3627/// # Activities
3628///
3629/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3630/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3631///
3632/// * [list floodlight activities](FloodlightActivityListCall) (response)
3633#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3634#[serde_with::serde_as]
3635#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3636pub struct FloodlightActivitiesListResponse {
3637    /// Floodlight activity collection.
3638    #[serde(rename = "floodlightActivities")]
3639    pub floodlight_activities: Option<Vec<FloodlightActivity>>,
3640    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#floodlightActivitiesListResponse".
3641    pub kind: Option<String>,
3642    /// Pagination token to be used for the next list operation.
3643    #[serde(rename = "nextPageToken")]
3644    pub next_page_token: Option<String>,
3645}
3646
3647impl common::ResponseResult for FloodlightActivitiesListResponse {}
3648
3649/// Contains properties of a Floodlight activity.
3650///
3651/// # Activities
3652///
3653/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3654/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3655///
3656/// * [get floodlight activities](FloodlightActivityGetCall) (response)
3657/// * [insert floodlight activities](FloodlightActivityInsertCall) (request|response)
3658/// * [patch floodlight activities](FloodlightActivityPatchCall) (request|response)
3659/// * [update floodlight activities](FloodlightActivityUpdateCall) (request|response)
3660#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3661#[serde_with::serde_as]
3662#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3663pub struct FloodlightActivity {
3664    /// Account ID of this floodlight activity. This is a read-only field that can be left blank.
3665    #[serde(rename = "accountId")]
3666    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3667    pub account_id: Option<i64>,
3668    /// Advertiser ID of this floodlight activity. If this field is left blank, the value will be copied over either from the activity group's advertiser or the existing activity's advertiser.
3669    #[serde(rename = "advertiserId")]
3670    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3671    pub advertiser_id: Option<i64>,
3672    /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field.
3673    #[serde(rename = "advertiserIdDimensionValue")]
3674    pub advertiser_id_dimension_value: Option<DimensionValue>,
3675    /// Code type used for cache busting in the generated tag. Applicable only when floodlightActivityGroupType is COUNTER and countingMethod is STANDARD_COUNTING or UNIQUE_COUNTING.
3676    #[serde(rename = "cacheBustingType")]
3677    pub cache_busting_type: Option<String>,
3678    /// Counting method for conversions for this floodlight activity. This is a required field.
3679    #[serde(rename = "countingMethod")]
3680    pub counting_method: Option<String>,
3681    /// Dynamic floodlight tags.
3682    #[serde(rename = "defaultTags")]
3683    pub default_tags: Option<Vec<FloodlightActivityDynamicTag>>,
3684    /// URL where this tag will be deployed. If specified, must be less than 256 characters long.
3685    #[serde(rename = "expectedUrl")]
3686    pub expected_url: Option<String>,
3687    /// Floodlight activity group ID of this floodlight activity. This is a required field.
3688    #[serde(rename = "floodlightActivityGroupId")]
3689    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3690    pub floodlight_activity_group_id: Option<i64>,
3691    /// Name of the associated floodlight activity group. This is a read-only field.
3692    #[serde(rename = "floodlightActivityGroupName")]
3693    pub floodlight_activity_group_name: Option<String>,
3694    /// Tag string of the associated floodlight activity group. This is a read-only field.
3695    #[serde(rename = "floodlightActivityGroupTagString")]
3696    pub floodlight_activity_group_tag_string: Option<String>,
3697    /// Type of the associated floodlight activity group. This is a read-only field.
3698    #[serde(rename = "floodlightActivityGroupType")]
3699    pub floodlight_activity_group_type: Option<String>,
3700    /// Floodlight configuration ID of this floodlight activity. If this field is left blank, the value will be copied over either from the activity group's floodlight configuration or from the existing activity's floodlight configuration.
3701    #[serde(rename = "floodlightConfigurationId")]
3702    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3703    pub floodlight_configuration_id: Option<i64>,
3704    /// Dimension value for the ID of the floodlight configuration. This is a read-only, auto-generated field.
3705    #[serde(rename = "floodlightConfigurationIdDimensionValue")]
3706    pub floodlight_configuration_id_dimension_value: Option<DimensionValue>,
3707    /// The type of Floodlight tag this activity will generate. This is a required field.
3708    #[serde(rename = "floodlightTagType")]
3709    pub floodlight_tag_type: Option<String>,
3710    /// Whether this activity is archived.
3711    pub hidden: Option<bool>,
3712    /// ID of this floodlight activity. This is a read-only, auto-generated field.
3713    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3714    pub id: Option<i64>,
3715    /// Dimension value for the ID of this floodlight activity. This is a read-only, auto-generated field.
3716    #[serde(rename = "idDimensionValue")]
3717    pub id_dimension_value: Option<DimensionValue>,
3718    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#floodlightActivity".
3719    pub kind: Option<String>,
3720    /// Name of this floodlight activity. This is a required field. Must be less than 129 characters long and cannot contain quotes.
3721    pub name: Option<String>,
3722    /// General notes or implementation instructions for the tag.
3723    pub notes: Option<String>,
3724    /// Publisher dynamic floodlight tags.
3725    #[serde(rename = "publisherTags")]
3726    pub publisher_tags: Option<Vec<FloodlightActivityPublisherDynamicTag>>,
3727    /// Whether this tag should use SSL.
3728    pub secure: Option<bool>,
3729    /// Whether the floodlight activity is SSL-compliant. This is a read-only field, its value detected by the system from the floodlight tags.
3730    #[serde(rename = "sslCompliant")]
3731    pub ssl_compliant: Option<bool>,
3732    /// Whether this floodlight activity must be SSL-compliant.
3733    #[serde(rename = "sslRequired")]
3734    pub ssl_required: Option<bool>,
3735    /// Subaccount ID of this floodlight activity. This is a read-only field that can be left blank.
3736    #[serde(rename = "subaccountId")]
3737    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3738    pub subaccount_id: Option<i64>,
3739    /// Tag format type for the floodlight activity. If left blank, the tag format will default to HTML.
3740    #[serde(rename = "tagFormat")]
3741    pub tag_format: Option<String>,
3742    /// Value of the cat= parameter in the floodlight tag, which the ad servers use to identify the activity. This is optional: if empty, a new tag string will be generated for you. This string must be 1 to 8 characters long, with valid characters being a-z0-9[ _ ]. This tag string must also be unique among activities of the same activity group. This field is read-only after insertion.
3743    #[serde(rename = "tagString")]
3744    pub tag_string: Option<String>,
3745    /// List of the user-defined variables used by this conversion tag. These map to the "u[1-100]=" in the tags. Each of these can have a user defined type. Acceptable values are U1 to U100, inclusive.
3746    #[serde(rename = "userDefinedVariableTypes")]
3747    pub user_defined_variable_types: Option<Vec<String>>,
3748}
3749
3750impl common::RequestValue for FloodlightActivity {}
3751impl common::ResponseResult for FloodlightActivity {}
3752
3753/// Dynamic Tag
3754///
3755/// This type is not used in any activity, and only used as *part* of another schema.
3756///
3757#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3758#[serde_with::serde_as]
3759#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3760pub struct FloodlightActivityDynamicTag {
3761    /// ID of this dynamic tag. This is a read-only, auto-generated field.
3762    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3763    pub id: Option<i64>,
3764    /// Name of this tag.
3765    pub name: Option<String>,
3766    /// Tag code.
3767    pub tag: Option<String>,
3768}
3769
3770impl common::Part for FloodlightActivityDynamicTag {}
3771
3772/// Contains properties of a Floodlight activity group.
3773///
3774/// # Activities
3775///
3776/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3777/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3778///
3779/// * [get floodlight activity groups](FloodlightActivityGroupGetCall) (response)
3780/// * [insert floodlight activity groups](FloodlightActivityGroupInsertCall) (request|response)
3781/// * [list floodlight activity groups](FloodlightActivityGroupListCall) (none)
3782/// * [patch floodlight activity groups](FloodlightActivityGroupPatchCall) (request|response)
3783/// * [update floodlight activity groups](FloodlightActivityGroupUpdateCall) (request|response)
3784#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3785#[serde_with::serde_as]
3786#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3787pub struct FloodlightActivityGroup {
3788    /// Account ID of this floodlight activity group. This is a read-only field that can be left blank.
3789    #[serde(rename = "accountId")]
3790    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3791    pub account_id: Option<i64>,
3792    /// Advertiser ID of this floodlight activity group. If this field is left blank, the value will be copied over either from the floodlight configuration's advertiser or from the existing activity group's advertiser.
3793    #[serde(rename = "advertiserId")]
3794    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3795    pub advertiser_id: Option<i64>,
3796    /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field.
3797    #[serde(rename = "advertiserIdDimensionValue")]
3798    pub advertiser_id_dimension_value: Option<DimensionValue>,
3799    /// Floodlight configuration ID of this floodlight activity group. This is a required field.
3800    #[serde(rename = "floodlightConfigurationId")]
3801    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3802    pub floodlight_configuration_id: Option<i64>,
3803    /// Dimension value for the ID of the floodlight configuration. This is a read-only, auto-generated field.
3804    #[serde(rename = "floodlightConfigurationIdDimensionValue")]
3805    pub floodlight_configuration_id_dimension_value: Option<DimensionValue>,
3806    /// ID of this floodlight activity group. This is a read-only, auto-generated field.
3807    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3808    pub id: Option<i64>,
3809    /// Dimension value for the ID of this floodlight activity group. This is a read-only, auto-generated field.
3810    #[serde(rename = "idDimensionValue")]
3811    pub id_dimension_value: Option<DimensionValue>,
3812    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#floodlightActivityGroup".
3813    pub kind: Option<String>,
3814    /// Name of this floodlight activity group. This is a required field. Must be less than 65 characters long and cannot contain quotes.
3815    pub name: Option<String>,
3816    /// Subaccount ID of this floodlight activity group. This is a read-only field that can be left blank.
3817    #[serde(rename = "subaccountId")]
3818    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3819    pub subaccount_id: Option<i64>,
3820    /// Value of the type= parameter in the floodlight tag, which the ad servers use to identify the activity group that the activity belongs to. This is optional: if empty, a new tag string will be generated for you. This string must be 1 to 8 characters long, with valid characters being a-z0-9[ _ ]. This tag string must also be unique among activity groups of the same floodlight configuration. This field is read-only after insertion.
3821    #[serde(rename = "tagString")]
3822    pub tag_string: Option<String>,
3823    /// Type of the floodlight activity group. This is a required field that is read-only after insertion.
3824    #[serde(rename = "type")]
3825    pub type_: Option<String>,
3826}
3827
3828impl common::RequestValue for FloodlightActivityGroup {}
3829impl common::Resource for FloodlightActivityGroup {}
3830impl common::ResponseResult for FloodlightActivityGroup {}
3831
3832/// Floodlight Activity Group List Response
3833///
3834/// # Activities
3835///
3836/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3837/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3838///
3839/// * [list floodlight activity groups](FloodlightActivityGroupListCall) (response)
3840#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3841#[serde_with::serde_as]
3842#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3843pub struct FloodlightActivityGroupsListResponse {
3844    /// Floodlight activity group collection.
3845    #[serde(rename = "floodlightActivityGroups")]
3846    pub floodlight_activity_groups: Option<Vec<FloodlightActivityGroup>>,
3847    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#floodlightActivityGroupsListResponse".
3848    pub kind: Option<String>,
3849    /// Pagination token to be used for the next list operation.
3850    #[serde(rename = "nextPageToken")]
3851    pub next_page_token: Option<String>,
3852}
3853
3854impl common::ResponseResult for FloodlightActivityGroupsListResponse {}
3855
3856/// Publisher Dynamic Tag
3857///
3858/// This type is not used in any activity, and only used as *part* of another schema.
3859///
3860#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3861#[serde_with::serde_as]
3862#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3863pub struct FloodlightActivityPublisherDynamicTag {
3864    /// Whether this tag is applicable only for click-throughs.
3865    #[serde(rename = "clickThrough")]
3866    pub click_through: Option<bool>,
3867    /// Directory site ID of this dynamic tag. This is a write-only field that can be used as an alternative to the siteId field. When this resource is retrieved, only the siteId field will be populated.
3868    #[serde(rename = "directorySiteId")]
3869    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3870    pub directory_site_id: Option<i64>,
3871    /// Dynamic floodlight tag.
3872    #[serde(rename = "dynamicTag")]
3873    pub dynamic_tag: Option<FloodlightActivityDynamicTag>,
3874    /// Site ID of this dynamic tag.
3875    #[serde(rename = "siteId")]
3876    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3877    pub site_id: Option<i64>,
3878    /// Dimension value for the ID of the site. This is a read-only, auto-generated field.
3879    #[serde(rename = "siteIdDimensionValue")]
3880    pub site_id_dimension_value: Option<DimensionValue>,
3881    /// Whether this tag is applicable only for view-throughs.
3882    #[serde(rename = "viewThrough")]
3883    pub view_through: Option<bool>,
3884}
3885
3886impl common::Part for FloodlightActivityPublisherDynamicTag {}
3887
3888/// Contains properties of a Floodlight configuration.
3889///
3890/// # Activities
3891///
3892/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3893/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3894///
3895/// * [get floodlight configurations](FloodlightConfigurationGetCall) (response)
3896/// * [list floodlight configurations](FloodlightConfigurationListCall) (none)
3897/// * [patch floodlight configurations](FloodlightConfigurationPatchCall) (request|response)
3898/// * [update floodlight configurations](FloodlightConfigurationUpdateCall) (request|response)
3899#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3900#[serde_with::serde_as]
3901#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3902pub struct FloodlightConfiguration {
3903    /// Account ID of this floodlight configuration. This is a read-only field that can be left blank.
3904    #[serde(rename = "accountId")]
3905    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3906    pub account_id: Option<i64>,
3907    /// Advertiser ID of the parent advertiser of this floodlight configuration.
3908    #[serde(rename = "advertiserId")]
3909    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3910    pub advertiser_id: Option<i64>,
3911    /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field.
3912    #[serde(rename = "advertiserIdDimensionValue")]
3913    pub advertiser_id_dimension_value: Option<DimensionValue>,
3914    /// Whether advertiser data is shared with Google Analytics.
3915    #[serde(rename = "analyticsDataSharingEnabled")]
3916    pub analytics_data_sharing_enabled: Option<bool>,
3917    /// Custom Viewability metric for the floodlight configuration.
3918    #[serde(rename = "customViewabilityMetric")]
3919    pub custom_viewability_metric: Option<CustomViewabilityMetric>,
3920    /// Whether the exposure-to-conversion report is enabled. This report shows detailed pathway information on up to 10 of the most recent ad exposures seen by a user before converting.
3921    #[serde(rename = "exposureToConversionEnabled")]
3922    pub exposure_to_conversion_enabled: Option<bool>,
3923    /// Day that will be counted as the first day of the week in reports. This is a required field.
3924    #[serde(rename = "firstDayOfWeek")]
3925    pub first_day_of_week: Option<String>,
3926    /// ID of this floodlight configuration. This is a read-only, auto-generated field.
3927    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3928    pub id: Option<i64>,
3929    /// Dimension value for the ID of this floodlight configuration. This is a read-only, auto-generated field.
3930    #[serde(rename = "idDimensionValue")]
3931    pub id_dimension_value: Option<DimensionValue>,
3932    /// Whether in-app attribution tracking is enabled.
3933    #[serde(rename = "inAppAttributionTrackingEnabled")]
3934    pub in_app_attribution_tracking_enabled: Option<bool>,
3935    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#floodlightConfiguration".
3936    pub kind: Option<String>,
3937    /// Lookback window settings for this floodlight configuration.
3938    #[serde(rename = "lookbackConfiguration")]
3939    pub lookback_configuration: Option<LookbackConfiguration>,
3940    /// Types of attribution options for natural search conversions.
3941    #[serde(rename = "naturalSearchConversionAttributionOption")]
3942    pub natural_search_conversion_attribution_option: Option<String>,
3943    /// Settings for Campaign Manager Omniture integration.
3944    #[serde(rename = "omnitureSettings")]
3945    pub omniture_settings: Option<OmnitureSettings>,
3946    /// Subaccount ID of this floodlight configuration. This is a read-only field that can be left blank.
3947    #[serde(rename = "subaccountId")]
3948    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3949    pub subaccount_id: Option<i64>,
3950    /// Configuration settings for dynamic and image floodlight tags.
3951    #[serde(rename = "tagSettings")]
3952    pub tag_settings: Option<TagSettings>,
3953    /// List of third-party authentication tokens enabled for this configuration.
3954    #[serde(rename = "thirdPartyAuthenticationTokens")]
3955    pub third_party_authentication_tokens: Option<Vec<ThirdPartyAuthenticationToken>>,
3956    /// List of user defined variables enabled for this configuration.
3957    #[serde(rename = "userDefinedVariableConfigurations")]
3958    pub user_defined_variable_configurations: Option<Vec<UserDefinedVariableConfiguration>>,
3959}
3960
3961impl common::RequestValue for FloodlightConfiguration {}
3962impl common::Resource for FloodlightConfiguration {}
3963impl common::ResponseResult for FloodlightConfiguration {}
3964
3965/// Floodlight Configuration List Response
3966///
3967/// # Activities
3968///
3969/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3970/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3971///
3972/// * [list floodlight configurations](FloodlightConfigurationListCall) (response)
3973#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3974#[serde_with::serde_as]
3975#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3976pub struct FloodlightConfigurationsListResponse {
3977    /// Floodlight configuration collection.
3978    #[serde(rename = "floodlightConfigurations")]
3979    pub floodlight_configurations: Option<Vec<FloodlightConfiguration>>,
3980    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#floodlightConfigurationsListResponse".
3981    pub kind: Option<String>,
3982}
3983
3984impl common::ResponseResult for FloodlightConfigurationsListResponse {}
3985
3986/// Represents fields that are compatible to be selected for a report of type "FlOODLIGHT".
3987///
3988/// This type is not used in any activity, and only used as *part* of another schema.
3989///
3990#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3991#[serde_with::serde_as]
3992#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3993pub struct FloodlightReportCompatibleFields {
3994    /// Dimensions which are compatible to be selected in the "dimensionFilters" section of the report.
3995    #[serde(rename = "dimensionFilters")]
3996    pub dimension_filters: Option<Vec<Dimension>>,
3997    /// Dimensions which are compatible to be selected in the "dimensions" section of the report.
3998    pub dimensions: Option<Vec<Dimension>>,
3999    /// The kind of resource this is, in this case dfareporting#floodlightReportCompatibleFields.
4000    pub kind: Option<String>,
4001    /// Metrics which are compatible to be selected in the "metricNames" section of the report.
4002    pub metrics: Option<Vec<Metric>>,
4003}
4004
4005impl common::Part for FloodlightReportCompatibleFields {}
4006
4007/// Frequency Cap.
4008///
4009/// This type is not used in any activity, and only used as *part* of another schema.
4010///
4011#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4012#[serde_with::serde_as]
4013#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4014pub struct FrequencyCap {
4015    /// Duration of time, in seconds, for this frequency cap. The maximum duration is 90 days. Acceptable values are 1 to 7776000, inclusive.
4016    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4017    pub duration: Option<i64>,
4018    /// Number of times an individual user can be served the ad within the specified duration. Acceptable values are 1 to 15, inclusive.
4019    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4020    pub impressions: Option<i64>,
4021}
4022
4023impl common::Part for FrequencyCap {}
4024
4025/// FsCommand.
4026///
4027/// This type is not used in any activity, and only used as *part* of another schema.
4028///
4029#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4030#[serde_with::serde_as]
4031#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4032pub struct FsCommand {
4033    /// Distance from the left of the browser.Applicable when positionOption is DISTANCE_FROM_TOP_LEFT_CORNER.
4034    pub left: Option<i32>,
4035    /// Position in the browser where the window will open.
4036    #[serde(rename = "positionOption")]
4037    pub position_option: Option<String>,
4038    /// Distance from the top of the browser. Applicable when positionOption is DISTANCE_FROM_TOP_LEFT_CORNER.
4039    pub top: Option<i32>,
4040    /// Height of the window.
4041    #[serde(rename = "windowHeight")]
4042    pub window_height: Option<i32>,
4043    /// Width of the window.
4044    #[serde(rename = "windowWidth")]
4045    pub window_width: Option<i32>,
4046}
4047
4048impl common::Part for FsCommand {}
4049
4050/// Geographical Targeting.
4051///
4052/// This type is not used in any activity, and only used as *part* of another schema.
4053///
4054#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4055#[serde_with::serde_as]
4056#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4057pub struct GeoTargeting {
4058    /// Cities to be targeted. For each city only dartId is required. The other fields are populated automatically when the ad is inserted or updated. If targeting a city, do not target or exclude the country of the city, and do not target the metro or region of the city.
4059    pub cities: Option<Vec<City>>,
4060    /// Countries to be targeted or excluded from targeting, depending on the setting of the excludeCountries field. For each country only dartId is required. The other fields are populated automatically when the ad is inserted or updated. If targeting or excluding a country, do not target regions, cities, metros, or postal codes in the same country.
4061    pub countries: Option<Vec<Country>>,
4062    /// Whether or not to exclude the countries in the countries field from targeting. If false, the countries field refers to countries which will be targeted by the ad.
4063    #[serde(rename = "excludeCountries")]
4064    pub exclude_countries: Option<bool>,
4065    /// Metros to be targeted. For each metro only dmaId is required. The other fields are populated automatically when the ad is inserted or updated. If targeting a metro, do not target or exclude the country of the metro.
4066    pub metros: Option<Vec<Metro>>,
4067    /// Postal codes to be targeted. For each postal code only id is required. The other fields are populated automatically when the ad is inserted or updated. If targeting a postal code, do not target or exclude the country of the postal code.
4068    #[serde(rename = "postalCodes")]
4069    pub postal_codes: Option<Vec<PostalCode>>,
4070    /// Regions to be targeted. For each region only dartId is required. The other fields are populated automatically when the ad is inserted or updated. If targeting a region, do not target or exclude the country of the region.
4071    pub regions: Option<Vec<Region>>,
4072}
4073
4074impl common::Part for GeoTargeting {}
4075
4076/// Represents a buy from the Planning inventory store.
4077///
4078/// # Activities
4079///
4080/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4081/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4082///
4083/// * [get inventory items](InventoryItemGetCall) (response)
4084/// * [list inventory items](InventoryItemListCall) (none)
4085#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4086#[serde_with::serde_as]
4087#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4088pub struct InventoryItem {
4089    /// Account ID of this inventory item.
4090    #[serde(rename = "accountId")]
4091    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4092    pub account_id: Option<i64>,
4093    /// Ad slots of this inventory item. If this inventory item represents a standalone placement, there will be exactly one ad slot. If this inventory item represents a placement group, there will be more than one ad slot, each representing one child placement in that placement group.
4094    #[serde(rename = "adSlots")]
4095    pub ad_slots: Option<Vec<AdSlot>>,
4096    /// Advertiser ID of this inventory item.
4097    #[serde(rename = "advertiserId")]
4098    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4099    pub advertiser_id: Option<i64>,
4100    /// Content category ID of this inventory item.
4101    #[serde(rename = "contentCategoryId")]
4102    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4103    pub content_category_id: Option<i64>,
4104    /// Estimated click-through rate of this inventory item.
4105    #[serde(rename = "estimatedClickThroughRate")]
4106    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4107    pub estimated_click_through_rate: Option<i64>,
4108    /// Estimated conversion rate of this inventory item.
4109    #[serde(rename = "estimatedConversionRate")]
4110    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4111    pub estimated_conversion_rate: Option<i64>,
4112    /// ID of this inventory item.
4113    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4114    pub id: Option<i64>,
4115    /// Whether this inventory item is in plan.
4116    #[serde(rename = "inPlan")]
4117    pub in_plan: Option<bool>,
4118    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#inventoryItem".
4119    pub kind: Option<String>,
4120    /// Information about the most recent modification of this inventory item.
4121    #[serde(rename = "lastModifiedInfo")]
4122    pub last_modified_info: Option<LastModifiedInfo>,
4123    /// Name of this inventory item. For standalone inventory items, this is the same name as that of its only ad slot. For group inventory items, this can differ from the name of any of its ad slots.
4124    pub name: Option<String>,
4125    /// Negotiation channel ID of this inventory item.
4126    #[serde(rename = "negotiationChannelId")]
4127    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4128    pub negotiation_channel_id: Option<i64>,
4129    /// Order ID of this inventory item.
4130    #[serde(rename = "orderId")]
4131    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4132    pub order_id: Option<i64>,
4133    /// Placement strategy ID of this inventory item.
4134    #[serde(rename = "placementStrategyId")]
4135    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4136    pub placement_strategy_id: Option<i64>,
4137    /// Pricing of this inventory item.
4138    pub pricing: Option<Pricing>,
4139    /// Project ID of this inventory item.
4140    #[serde(rename = "projectId")]
4141    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4142    pub project_id: Option<i64>,
4143    /// RFP ID of this inventory item.
4144    #[serde(rename = "rfpId")]
4145    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4146    pub rfp_id: Option<i64>,
4147    /// ID of the site this inventory item is associated with.
4148    #[serde(rename = "siteId")]
4149    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4150    pub site_id: Option<i64>,
4151    /// Subaccount ID of this inventory item.
4152    #[serde(rename = "subaccountId")]
4153    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4154    pub subaccount_id: Option<i64>,
4155    /// Type of inventory item.
4156    #[serde(rename = "type")]
4157    pub type_: Option<String>,
4158}
4159
4160impl common::Resource for InventoryItem {}
4161impl common::ResponseResult for InventoryItem {}
4162
4163/// Inventory item List Response
4164///
4165/// # Activities
4166///
4167/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4168/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4169///
4170/// * [list inventory items](InventoryItemListCall) (response)
4171#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4172#[serde_with::serde_as]
4173#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4174pub struct InventoryItemsListResponse {
4175    /// Inventory item collection
4176    #[serde(rename = "inventoryItems")]
4177    pub inventory_items: Option<Vec<InventoryItem>>,
4178    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#inventoryItemsListResponse".
4179    pub kind: Option<String>,
4180    /// Pagination token to be used for the next list operation.
4181    #[serde(rename = "nextPageToken")]
4182    pub next_page_token: Option<String>,
4183}
4184
4185impl common::ResponseResult for InventoryItemsListResponse {}
4186
4187/// Key Value Targeting Expression.
4188///
4189/// This type is not used in any activity, and only used as *part* of another schema.
4190///
4191#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4192#[serde_with::serde_as]
4193#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4194pub struct KeyValueTargetingExpression {
4195    /// Keyword expression being targeted by the ad.
4196    pub expression: Option<String>,
4197}
4198
4199impl common::Part for KeyValueTargetingExpression {}
4200
4201/// Contains information about where a user’s browser is taken after the user clicks an ad.
4202///
4203/// # Activities
4204///
4205/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4206/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4207///
4208/// * [get advertiser landing pages](AdvertiserLandingPageGetCall) (response)
4209/// * [insert advertiser landing pages](AdvertiserLandingPageInsertCall) (request|response)
4210/// * [patch advertiser landing pages](AdvertiserLandingPagePatchCall) (request|response)
4211/// * [update advertiser landing pages](AdvertiserLandingPageUpdateCall) (request|response)
4212#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4213#[serde_with::serde_as]
4214#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4215pub struct LandingPage {
4216    /// Advertiser ID of this landing page. This is a required field.
4217    #[serde(rename = "advertiserId")]
4218    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4219    pub advertiser_id: Option<i64>,
4220    /// Whether this landing page has been archived.
4221    pub archived: Option<bool>,
4222    /// Links that will direct the user to a mobile app, if installed.
4223    #[serde(rename = "deepLinks")]
4224    pub deep_links: Option<Vec<DeepLink>>,
4225    /// ID of this landing page. This is a read-only, auto-generated field.
4226    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4227    pub id: Option<i64>,
4228    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#landingPage".
4229    pub kind: Option<String>,
4230    /// Name of this landing page. This is a required field. It must be less than 256 characters long.
4231    pub name: Option<String>,
4232    /// URL of this landing page. This is a required field.
4233    pub url: Option<String>,
4234}
4235
4236impl common::RequestValue for LandingPage {}
4237impl common::ResponseResult for LandingPage {}
4238
4239/// Contains information about a language that can be targeted by ads.
4240///
4241/// # Activities
4242///
4243/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4244/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4245///
4246/// * [list languages](LanguageListCall) (none)
4247#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4248#[serde_with::serde_as]
4249#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4250pub struct Language {
4251    /// Language ID of this language. This is the ID used for targeting and generating reports.
4252    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4253    pub id: Option<i64>,
4254    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#language".
4255    pub kind: Option<String>,
4256    /// Format of language code is an ISO 639 two-letter language code optionally followed by an underscore followed by an ISO 3166 code. Examples are "en" for English or "zh_CN" for Simplified Chinese.
4257    #[serde(rename = "languageCode")]
4258    pub language_code: Option<String>,
4259    /// Name of this language.
4260    pub name: Option<String>,
4261}
4262
4263impl common::Resource for Language {}
4264
4265/// Language Targeting.
4266///
4267/// This type is not used in any activity, and only used as *part* of another schema.
4268///
4269#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4270#[serde_with::serde_as]
4271#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4272pub struct LanguageTargeting {
4273    /// Languages that this ad targets. For each language only languageId is required. The other fields are populated automatically when the ad is inserted or updated.
4274    pub languages: Option<Vec<Language>>,
4275}
4276
4277impl common::Part for LanguageTargeting {}
4278
4279/// Language List Response
4280///
4281/// # Activities
4282///
4283/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4284/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4285///
4286/// * [list languages](LanguageListCall) (response)
4287#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4288#[serde_with::serde_as]
4289#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4290pub struct LanguagesListResponse {
4291    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#languagesListResponse".
4292    pub kind: Option<String>,
4293    /// Language collection.
4294    pub languages: Option<Vec<Language>>,
4295}
4296
4297impl common::ResponseResult for LanguagesListResponse {}
4298
4299/// Modification timestamp.
4300///
4301/// This type is not used in any activity, and only used as *part* of another schema.
4302///
4303#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4304#[serde_with::serde_as]
4305#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4306pub struct LastModifiedInfo {
4307    /// Timestamp of the last change in milliseconds since epoch.
4308    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4309    pub time: Option<i64>,
4310}
4311
4312impl common::Part for LastModifiedInfo {}
4313
4314/// A group clause made up of list population terms representing constraints joined by ORs.
4315///
4316/// This type is not used in any activity, and only used as *part* of another schema.
4317///
4318#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4319#[serde_with::serde_as]
4320#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4321pub struct ListPopulationClause {
4322    /// Terms of this list population clause. Each clause is made up of list population terms representing constraints and are joined by ORs.
4323    pub terms: Option<Vec<ListPopulationTerm>>,
4324}
4325
4326impl common::Part for ListPopulationClause {}
4327
4328/// Remarketing List Population Rule.
4329///
4330/// This type is not used in any activity, and only used as *part* of another schema.
4331///
4332#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4333#[serde_with::serde_as]
4334#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4335pub struct ListPopulationRule {
4336    /// Floodlight activity ID associated with this rule. This field can be left blank.
4337    #[serde(rename = "floodlightActivityId")]
4338    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4339    pub floodlight_activity_id: Option<i64>,
4340    /// Name of floodlight activity associated with this rule. This is a read-only, auto-generated field.
4341    #[serde(rename = "floodlightActivityName")]
4342    pub floodlight_activity_name: Option<String>,
4343    /// Clauses that make up this list population rule. Clauses are joined by ANDs, and the clauses themselves are made up of list population terms which are joined by ORs.
4344    #[serde(rename = "listPopulationClauses")]
4345    pub list_population_clauses: Option<Vec<ListPopulationClause>>,
4346}
4347
4348impl common::Part for ListPopulationRule {}
4349
4350/// Remarketing List Population Rule Term.
4351///
4352/// This type is not used in any activity, and only used as *part* of another schema.
4353///
4354#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4355#[serde_with::serde_as]
4356#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4357pub struct ListPopulationTerm {
4358    /// Will be true if the term should check if the user is in the list and false if the term should check if the user is not in the list. This field is only relevant when type is set to LIST_MEMBERSHIP_TERM. False by default.
4359    pub contains: Option<bool>,
4360    /// Whether to negate the comparison result of this term during rule evaluation. This field is only relevant when type is left unset or set to CUSTOM_VARIABLE_TERM or REFERRER_TERM.
4361    pub negation: Option<bool>,
4362    /// Comparison operator of this term. This field is only relevant when type is left unset or set to CUSTOM_VARIABLE_TERM or REFERRER_TERM.
4363    pub operator: Option<String>,
4364    /// ID of the list in question. This field is only relevant when type is set to LIST_MEMBERSHIP_TERM.
4365    #[serde(rename = "remarketingListId")]
4366    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4367    pub remarketing_list_id: Option<i64>,
4368    /// List population term type determines the applicable fields in this object. If left unset or set to CUSTOM_VARIABLE_TERM, then variableName, variableFriendlyName, operator, value, and negation are applicable. If set to LIST_MEMBERSHIP_TERM then remarketingListId and contains are applicable. If set to REFERRER_TERM then operator, value, and negation are applicable.
4369    #[serde(rename = "type")]
4370    pub type_: Option<String>,
4371    /// Literal to compare the variable to. This field is only relevant when type is left unset or set to CUSTOM_VARIABLE_TERM or REFERRER_TERM.
4372    pub value: Option<String>,
4373    /// Friendly name of this term's variable. This is a read-only, auto-generated field. This field is only relevant when type is left unset or set to CUSTOM_VARIABLE_TERM.
4374    #[serde(rename = "variableFriendlyName")]
4375    pub variable_friendly_name: Option<String>,
4376    /// Name of the variable (U1, U2, etc.) being compared in this term. This field is only relevant when type is set to null, CUSTOM_VARIABLE_TERM or REFERRER_TERM.
4377    #[serde(rename = "variableName")]
4378    pub variable_name: Option<String>,
4379}
4380
4381impl common::Part for ListPopulationTerm {}
4382
4383/// Remarketing List Targeting Expression.
4384///
4385/// This type is not used in any activity, and only used as *part* of another schema.
4386///
4387#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4388#[serde_with::serde_as]
4389#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4390pub struct ListTargetingExpression {
4391    /// Expression describing which lists are being targeted by the ad.
4392    pub expression: Option<String>,
4393}
4394
4395impl common::Part for ListTargetingExpression {}
4396
4397/// Lookback configuration settings.
4398///
4399/// This type is not used in any activity, and only used as *part* of another schema.
4400///
4401#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4402#[serde_with::serde_as]
4403#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4404pub struct LookbackConfiguration {
4405    /// Lookback window, in days, from the last time a given user clicked on one of your ads. If you enter 0, clicks will not be considered as triggering events for floodlight tracking. If you leave this field blank, the default value for your account will be used. Acceptable values are 0 to 90, inclusive.
4406    #[serde(rename = "clickDuration")]
4407    pub click_duration: Option<i32>,
4408    /// Lookback window, in days, from the last time a given user viewed one of your ads. If you enter 0, impressions will not be considered as triggering events for floodlight tracking. If you leave this field blank, the default value for your account will be used. Acceptable values are 0 to 90, inclusive.
4409    #[serde(rename = "postImpressionActivitiesDuration")]
4410    pub post_impression_activities_duration: Option<i32>,
4411}
4412
4413impl common::Part for LookbackConfiguration {}
4414
4415/// Represents a metric.
4416///
4417/// This type is not used in any activity, and only used as *part* of another schema.
4418///
4419#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4420#[serde_with::serde_as]
4421#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4422pub struct Metric {
4423    /// The kind of resource this is, in this case dfareporting#metric.
4424    pub kind: Option<String>,
4425    /// The metric name, e.g. dfa:impressions
4426    pub name: Option<String>,
4427}
4428
4429impl common::Part for Metric {}
4430
4431/// Contains information about a metro region that can be targeted by ads.
4432///
4433/// # Activities
4434///
4435/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4436/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4437///
4438/// * [list metros](MetroListCall) (none)
4439#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4440#[serde_with::serde_as]
4441#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4442pub struct Metro {
4443    /// Country code of the country to which this metro region belongs.
4444    #[serde(rename = "countryCode")]
4445    pub country_code: Option<String>,
4446    /// DART ID of the country to which this metro region belongs.
4447    #[serde(rename = "countryDartId")]
4448    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4449    pub country_dart_id: Option<i64>,
4450    /// DART ID of this metro region.
4451    #[serde(rename = "dartId")]
4452    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4453    pub dart_id: Option<i64>,
4454    /// DMA ID of this metro region. This is the ID used for targeting and generating reports, and is equivalent to metro_code.
4455    #[serde(rename = "dmaId")]
4456    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4457    pub dma_id: Option<i64>,
4458    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#metro".
4459    pub kind: Option<String>,
4460    /// Metro code of this metro region. This is equivalent to dma_id.
4461    #[serde(rename = "metroCode")]
4462    pub metro_code: Option<String>,
4463    /// Name of this metro region.
4464    pub name: Option<String>,
4465}
4466
4467impl common::Resource for Metro {}
4468
4469/// Metro List Response
4470///
4471/// # Activities
4472///
4473/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4474/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4475///
4476/// * [list metros](MetroListCall) (response)
4477#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4478#[serde_with::serde_as]
4479#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4480pub struct MetrosListResponse {
4481    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#metrosListResponse".
4482    pub kind: Option<String>,
4483    /// Metro collection.
4484    pub metros: Option<Vec<Metro>>,
4485}
4486
4487impl common::ResponseResult for MetrosListResponse {}
4488
4489/// Contains information about a mobile app. Used as a landing page deep link.
4490///
4491/// # Activities
4492///
4493/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4494/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4495///
4496/// * [get mobile apps](MobileAppGetCall) (response)
4497/// * [list mobile apps](MobileAppListCall) (none)
4498#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4499#[serde_with::serde_as]
4500#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4501pub struct MobileApp {
4502    /// Mobile app directory.
4503    pub directory: Option<String>,
4504    /// ID of this mobile app.
4505    pub id: Option<String>,
4506    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#mobileApp".
4507    pub kind: Option<String>,
4508    /// Publisher name.
4509    #[serde(rename = "publisherName")]
4510    pub publisher_name: Option<String>,
4511    /// Title of this mobile app.
4512    pub title: Option<String>,
4513}
4514
4515impl common::Resource for MobileApp {}
4516impl common::ResponseResult for MobileApp {}
4517
4518/// Mobile app List Response
4519///
4520/// # Activities
4521///
4522/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4523/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4524///
4525/// * [list mobile apps](MobileAppListCall) (response)
4526#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4527#[serde_with::serde_as]
4528#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4529pub struct MobileAppsListResponse {
4530    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#mobileAppsListResponse".
4531    pub kind: Option<String>,
4532    /// Mobile apps collection.
4533    #[serde(rename = "mobileApps")]
4534    pub mobile_apps: Option<Vec<MobileApp>>,
4535    /// Pagination token to be used for the next list operation.
4536    #[serde(rename = "nextPageToken")]
4537    pub next_page_token: Option<String>,
4538}
4539
4540impl common::ResponseResult for MobileAppsListResponse {}
4541
4542/// Contains information about a mobile carrier that can be targeted by ads.
4543///
4544/// # Activities
4545///
4546/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4547/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4548///
4549/// * [get mobile carriers](MobileCarrierGetCall) (response)
4550/// * [list mobile carriers](MobileCarrierListCall) (none)
4551#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4552#[serde_with::serde_as]
4553#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4554pub struct MobileCarrier {
4555    /// Country code of the country to which this mobile carrier belongs.
4556    #[serde(rename = "countryCode")]
4557    pub country_code: Option<String>,
4558    /// DART ID of the country to which this mobile carrier belongs.
4559    #[serde(rename = "countryDartId")]
4560    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4561    pub country_dart_id: Option<i64>,
4562    /// ID of this mobile carrier.
4563    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4564    pub id: Option<i64>,
4565    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#mobileCarrier".
4566    pub kind: Option<String>,
4567    /// Name of this mobile carrier.
4568    pub name: Option<String>,
4569}
4570
4571impl common::Resource for MobileCarrier {}
4572impl common::ResponseResult for MobileCarrier {}
4573
4574/// Mobile Carrier List Response
4575///
4576/// # Activities
4577///
4578/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4579/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4580///
4581/// * [list mobile carriers](MobileCarrierListCall) (response)
4582#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4583#[serde_with::serde_as]
4584#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4585pub struct MobileCarriersListResponse {
4586    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#mobileCarriersListResponse".
4587    pub kind: Option<String>,
4588    /// Mobile carrier collection.
4589    #[serde(rename = "mobileCarriers")]
4590    pub mobile_carriers: Option<Vec<MobileCarrier>>,
4591}
4592
4593impl common::ResponseResult for MobileCarriersListResponse {}
4594
4595/// Object Filter.
4596///
4597/// This type is not used in any activity, and only used as *part* of another schema.
4598///
4599#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4600#[serde_with::serde_as]
4601#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4602pub struct ObjectFilter {
4603    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#objectFilter".
4604    pub kind: Option<String>,
4605    /// Applicable when status is ASSIGNED. The user has access to objects with these object IDs.
4606    #[serde(rename = "objectIds")]
4607    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
4608    pub object_ids: Option<Vec<i64>>,
4609    /// Status of the filter. NONE means the user has access to none of the objects. ALL means the user has access to all objects. ASSIGNED means the user has access to the objects with IDs in the objectIds list.
4610    pub status: Option<String>,
4611}
4612
4613impl common::Part for ObjectFilter {}
4614
4615/// Offset Position.
4616///
4617/// This type is not used in any activity, and only used as *part* of another schema.
4618///
4619#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4620#[serde_with::serde_as]
4621#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4622pub struct OffsetPosition {
4623    /// Offset distance from left side of an asset or a window.
4624    pub left: Option<i32>,
4625    /// Offset distance from top side of an asset or a window.
4626    pub top: Option<i32>,
4627}
4628
4629impl common::Part for OffsetPosition {}
4630
4631/// Omniture Integration Settings.
4632///
4633/// This type is not used in any activity, and only used as *part* of another schema.
4634///
4635#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4636#[serde_with::serde_as]
4637#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4638pub struct OmnitureSettings {
4639    /// Whether placement cost data will be sent to Omniture. This property can be enabled only if omnitureIntegrationEnabled is true.
4640    #[serde(rename = "omnitureCostDataEnabled")]
4641    pub omniture_cost_data_enabled: Option<bool>,
4642    /// Whether Omniture integration is enabled. This property can be enabled only when the "Advanced Ad Serving" account setting is enabled.
4643    #[serde(rename = "omnitureIntegrationEnabled")]
4644    pub omniture_integration_enabled: Option<bool>,
4645}
4646
4647impl common::Part for OmnitureSettings {}
4648
4649/// Contains information about an operating system that can be targeted by ads.
4650///
4651/// # Activities
4652///
4653/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4654/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4655///
4656/// * [get operating systems](OperatingSystemGetCall) (response)
4657/// * [list operating systems](OperatingSystemListCall) (none)
4658#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4659#[serde_with::serde_as]
4660#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4661pub struct OperatingSystem {
4662    /// DART ID of this operating system. This is the ID used for targeting.
4663    #[serde(rename = "dartId")]
4664    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4665    pub dart_id: Option<i64>,
4666    /// Whether this operating system is for desktop.
4667    pub desktop: Option<bool>,
4668    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#operatingSystem".
4669    pub kind: Option<String>,
4670    /// Whether this operating system is for mobile.
4671    pub mobile: Option<bool>,
4672    /// Name of this operating system.
4673    pub name: Option<String>,
4674}
4675
4676impl common::Resource for OperatingSystem {}
4677impl common::ResponseResult for OperatingSystem {}
4678
4679/// Contains information about a particular version of an operating system that can be targeted by ads.
4680///
4681/// # Activities
4682///
4683/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4684/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4685///
4686/// * [get operating system versions](OperatingSystemVersionGetCall) (response)
4687/// * [list operating system versions](OperatingSystemVersionListCall) (none)
4688#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4689#[serde_with::serde_as]
4690#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4691pub struct OperatingSystemVersion {
4692    /// ID of this operating system version.
4693    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4694    pub id: Option<i64>,
4695    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#operatingSystemVersion".
4696    pub kind: Option<String>,
4697    /// Major version (leftmost number) of this operating system version.
4698    #[serde(rename = "majorVersion")]
4699    pub major_version: Option<String>,
4700    /// Minor version (number after the first dot) of this operating system version.
4701    #[serde(rename = "minorVersion")]
4702    pub minor_version: Option<String>,
4703    /// Name of this operating system version.
4704    pub name: Option<String>,
4705    /// Operating system of this operating system version.
4706    #[serde(rename = "operatingSystem")]
4707    pub operating_system: Option<OperatingSystem>,
4708}
4709
4710impl common::Resource for OperatingSystemVersion {}
4711impl common::ResponseResult for OperatingSystemVersion {}
4712
4713/// Operating System Version List Response
4714///
4715/// # Activities
4716///
4717/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4718/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4719///
4720/// * [list operating system versions](OperatingSystemVersionListCall) (response)
4721#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4722#[serde_with::serde_as]
4723#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4724pub struct OperatingSystemVersionsListResponse {
4725    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#operatingSystemVersionsListResponse".
4726    pub kind: Option<String>,
4727    /// Operating system version collection.
4728    #[serde(rename = "operatingSystemVersions")]
4729    pub operating_system_versions: Option<Vec<OperatingSystemVersion>>,
4730}
4731
4732impl common::ResponseResult for OperatingSystemVersionsListResponse {}
4733
4734/// Operating System List Response
4735///
4736/// # Activities
4737///
4738/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4739/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4740///
4741/// * [list operating systems](OperatingSystemListCall) (response)
4742#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4743#[serde_with::serde_as]
4744#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4745pub struct OperatingSystemsListResponse {
4746    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#operatingSystemsListResponse".
4747    pub kind: Option<String>,
4748    /// Operating system collection.
4749    #[serde(rename = "operatingSystems")]
4750    pub operating_systems: Option<Vec<OperatingSystem>>,
4751}
4752
4753impl common::ResponseResult for OperatingSystemsListResponse {}
4754
4755/// Creative optimization activity.
4756///
4757/// This type is not used in any activity, and only used as *part* of another schema.
4758///
4759#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4760#[serde_with::serde_as]
4761#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4762pub struct OptimizationActivity {
4763    /// Floodlight activity ID of this optimization activity. This is a required field.
4764    #[serde(rename = "floodlightActivityId")]
4765    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4766    pub floodlight_activity_id: Option<i64>,
4767    /// Dimension value for the ID of the floodlight activity. This is a read-only, auto-generated field.
4768    #[serde(rename = "floodlightActivityIdDimensionValue")]
4769    pub floodlight_activity_id_dimension_value: Option<DimensionValue>,
4770    /// Weight associated with this optimization. The weight assigned will be understood in proportion to the weights assigned to the other optimization activities. Value must be greater than or equal to 1.
4771    pub weight: Option<i32>,
4772}
4773
4774impl common::Part for OptimizationActivity {}
4775
4776/// Describes properties of a Planning order.
4777///
4778/// # Activities
4779///
4780/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4781/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4782///
4783/// * [get orders](OrderGetCall) (response)
4784/// * [list orders](OrderListCall) (none)
4785#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4786#[serde_with::serde_as]
4787#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4788pub struct Order {
4789    /// Account ID of this order.
4790    #[serde(rename = "accountId")]
4791    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4792    pub account_id: Option<i64>,
4793    /// Advertiser ID of this order.
4794    #[serde(rename = "advertiserId")]
4795    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4796    pub advertiser_id: Option<i64>,
4797    /// IDs for users that have to approve documents created for this order.
4798    #[serde(rename = "approverUserProfileIds")]
4799    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
4800    pub approver_user_profile_ids: Option<Vec<i64>>,
4801    /// Buyer invoice ID associated with this order.
4802    #[serde(rename = "buyerInvoiceId")]
4803    pub buyer_invoice_id: Option<String>,
4804    /// Name of the buyer organization.
4805    #[serde(rename = "buyerOrganizationName")]
4806    pub buyer_organization_name: Option<String>,
4807    /// Comments in this order.
4808    pub comments: Option<String>,
4809    /// Contacts for this order.
4810    pub contacts: Option<Vec<OrderContact>>,
4811    /// ID of this order. This is a read-only, auto-generated field.
4812    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4813    pub id: Option<i64>,
4814    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#order".
4815    pub kind: Option<String>,
4816    /// Information about the most recent modification of this order.
4817    #[serde(rename = "lastModifiedInfo")]
4818    pub last_modified_info: Option<LastModifiedInfo>,
4819    /// Name of this order.
4820    pub name: Option<String>,
4821    /// Notes of this order.
4822    pub notes: Option<String>,
4823    /// ID of the terms and conditions template used in this order.
4824    #[serde(rename = "planningTermId")]
4825    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4826    pub planning_term_id: Option<i64>,
4827    /// Project ID of this order.
4828    #[serde(rename = "projectId")]
4829    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4830    pub project_id: Option<i64>,
4831    /// Seller order ID associated with this order.
4832    #[serde(rename = "sellerOrderId")]
4833    pub seller_order_id: Option<String>,
4834    /// Name of the seller organization.
4835    #[serde(rename = "sellerOrganizationName")]
4836    pub seller_organization_name: Option<String>,
4837    /// Site IDs this order is associated with.
4838    #[serde(rename = "siteId")]
4839    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
4840    pub site_id: Option<Vec<i64>>,
4841    /// Free-form site names this order is associated with.
4842    #[serde(rename = "siteNames")]
4843    pub site_names: Option<Vec<String>>,
4844    /// Subaccount ID of this order.
4845    #[serde(rename = "subaccountId")]
4846    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4847    pub subaccount_id: Option<i64>,
4848    /// Terms and conditions of this order.
4849    #[serde(rename = "termsAndConditions")]
4850    pub terms_and_conditions: Option<String>,
4851}
4852
4853impl common::Resource for Order {}
4854impl common::ResponseResult for Order {}
4855
4856/// Contact of an order.
4857///
4858/// This type is not used in any activity, and only used as *part* of another schema.
4859///
4860#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4861#[serde_with::serde_as]
4862#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4863pub struct OrderContact {
4864    /// Free-form information about this contact. It could be any information related to this contact in addition to type, title, name, and signature user profile ID.
4865    #[serde(rename = "contactInfo")]
4866    pub contact_info: Option<String>,
4867    /// Name of this contact.
4868    #[serde(rename = "contactName")]
4869    pub contact_name: Option<String>,
4870    /// Title of this contact.
4871    #[serde(rename = "contactTitle")]
4872    pub contact_title: Option<String>,
4873    /// Type of this contact.
4874    #[serde(rename = "contactType")]
4875    pub contact_type: Option<String>,
4876    /// ID of the user profile containing the signature that will be embedded into order documents.
4877    #[serde(rename = "signatureUserProfileId")]
4878    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4879    pub signature_user_profile_id: Option<i64>,
4880}
4881
4882impl common::Part for OrderContact {}
4883
4884/// Contains properties of a Planning order document.
4885///
4886/// # Activities
4887///
4888/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4889/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4890///
4891/// * [get order documents](OrderDocumentGetCall) (response)
4892/// * [list order documents](OrderDocumentListCall) (none)
4893#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4894#[serde_with::serde_as]
4895#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4896pub struct OrderDocument {
4897    /// Account ID of this order document.
4898    #[serde(rename = "accountId")]
4899    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4900    pub account_id: Option<i64>,
4901    /// Advertiser ID of this order document.
4902    #[serde(rename = "advertiserId")]
4903    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4904    pub advertiser_id: Option<i64>,
4905    /// The amended order document ID of this order document. An order document can be created by optionally amending another order document so that the change history can be preserved.
4906    #[serde(rename = "amendedOrderDocumentId")]
4907    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4908    pub amended_order_document_id: Option<i64>,
4909    /// IDs of users who have approved this order document.
4910    #[serde(rename = "approvedByUserProfileIds")]
4911    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
4912    pub approved_by_user_profile_ids: Option<Vec<i64>>,
4913    /// Whether this order document is cancelled.
4914    pub cancelled: Option<bool>,
4915    /// Information about the creation of this order document.
4916    #[serde(rename = "createdInfo")]
4917    pub created_info: Option<LastModifiedInfo>,
4918    /// no description provided
4919    #[serde(rename = "effectiveDate")]
4920    pub effective_date: Option<chrono::NaiveDate>,
4921    /// ID of this order document.
4922    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4923    pub id: Option<i64>,
4924    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#orderDocument".
4925    pub kind: Option<String>,
4926    /// List of email addresses that received the last sent document.
4927    #[serde(rename = "lastSentRecipients")]
4928    pub last_sent_recipients: Option<Vec<String>>,
4929    /// no description provided
4930    #[serde(rename = "lastSentTime")]
4931    pub last_sent_time: Option<chrono::DateTime<chrono::offset::Utc>>,
4932    /// ID of the order from which this order document is created.
4933    #[serde(rename = "orderId")]
4934    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4935    pub order_id: Option<i64>,
4936    /// Project ID of this order document.
4937    #[serde(rename = "projectId")]
4938    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4939    pub project_id: Option<i64>,
4940    /// Whether this order document has been signed.
4941    pub signed: Option<bool>,
4942    /// Subaccount ID of this order document.
4943    #[serde(rename = "subaccountId")]
4944    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4945    pub subaccount_id: Option<i64>,
4946    /// Title of this order document.
4947    pub title: Option<String>,
4948    /// Type of this order document
4949    #[serde(rename = "type")]
4950    pub type_: Option<String>,
4951}
4952
4953impl common::Resource for OrderDocument {}
4954impl common::ResponseResult for OrderDocument {}
4955
4956/// Order document List Response
4957///
4958/// # Activities
4959///
4960/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4961/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4962///
4963/// * [list order documents](OrderDocumentListCall) (response)
4964#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4965#[serde_with::serde_as]
4966#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4967pub struct OrderDocumentsListResponse {
4968    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#orderDocumentsListResponse".
4969    pub kind: Option<String>,
4970    /// Pagination token to be used for the next list operation.
4971    #[serde(rename = "nextPageToken")]
4972    pub next_page_token: Option<String>,
4973    /// Order document collection
4974    #[serde(rename = "orderDocuments")]
4975    pub order_documents: Option<Vec<OrderDocument>>,
4976}
4977
4978impl common::ResponseResult for OrderDocumentsListResponse {}
4979
4980/// Order List Response
4981///
4982/// # Activities
4983///
4984/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4985/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4986///
4987/// * [list orders](OrderListCall) (response)
4988#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4989#[serde_with::serde_as]
4990#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4991pub struct OrdersListResponse {
4992    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#ordersListResponse".
4993    pub kind: Option<String>,
4994    /// Pagination token to be used for the next list operation.
4995    #[serde(rename = "nextPageToken")]
4996    pub next_page_token: Option<String>,
4997    /// Order collection.
4998    pub orders: Option<Vec<Order>>,
4999}
5000
5001impl common::ResponseResult for OrdersListResponse {}
5002
5003/// Represents fields that are compatible to be selected for a report of type "PATH_TO_CONVERSION".
5004///
5005/// This type is not used in any activity, and only used as *part* of another schema.
5006///
5007#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5008#[serde_with::serde_as]
5009#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5010pub struct PathToConversionReportCompatibleFields {
5011    /// Conversion dimensions which are compatible to be selected in the "conversionDimensions" section of the report.
5012    #[serde(rename = "conversionDimensions")]
5013    pub conversion_dimensions: Option<Vec<Dimension>>,
5014    /// Custom floodlight variables which are compatible to be selected in the "customFloodlightVariables" section of the report.
5015    #[serde(rename = "customFloodlightVariables")]
5016    pub custom_floodlight_variables: Option<Vec<Dimension>>,
5017    /// The kind of resource this is, in this case dfareporting#pathToConversionReportCompatibleFields.
5018    pub kind: Option<String>,
5019    /// Metrics which are compatible to be selected in the "metricNames" section of the report.
5020    pub metrics: Option<Vec<Metric>>,
5021    /// Per-interaction dimensions which are compatible to be selected in the "perInteractionDimensions" section of the report.
5022    #[serde(rename = "perInteractionDimensions")]
5023    pub per_interaction_dimensions: Option<Vec<Dimension>>,
5024}
5025
5026impl common::Part for PathToConversionReportCompatibleFields {}
5027
5028/// Contains properties of a placement.
5029///
5030/// # Activities
5031///
5032/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5033/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5034///
5035/// * [generatetags placements](PlacementGeneratetagCall) (none)
5036/// * [get placements](PlacementGetCall) (response)
5037/// * [insert placements](PlacementInsertCall) (request|response)
5038/// * [list placements](PlacementListCall) (none)
5039/// * [patch placements](PlacementPatchCall) (request|response)
5040/// * [update placements](PlacementUpdateCall) (request|response)
5041#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5042#[serde_with::serde_as]
5043#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5044pub struct Placement {
5045    /// Account ID of this placement. This field can be left blank.
5046    #[serde(rename = "accountId")]
5047    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5048    pub account_id: Option<i64>,
5049    /// Whether this placement opts out of ad blocking. When true, ad blocking is disabled for this placement. When false, the campaign and site settings take effect.
5050    #[serde(rename = "adBlockingOptOut")]
5051    pub ad_blocking_opt_out: Option<bool>,
5052    /// Additional sizes associated with this placement. When inserting or updating a placement, only the size ID field is used.
5053    #[serde(rename = "additionalSizes")]
5054    pub additional_sizes: Option<Vec<Size>>,
5055    /// Advertiser ID of this placement. This field can be left blank.
5056    #[serde(rename = "advertiserId")]
5057    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5058    pub advertiser_id: Option<i64>,
5059    /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field.
5060    #[serde(rename = "advertiserIdDimensionValue")]
5061    pub advertiser_id_dimension_value: Option<DimensionValue>,
5062    /// Whether this placement is archived.
5063    pub archived: Option<bool>,
5064    /// Campaign ID of this placement. This field is a required field on insertion.
5065    #[serde(rename = "campaignId")]
5066    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5067    pub campaign_id: Option<i64>,
5068    /// Dimension value for the ID of the campaign. This is a read-only, auto-generated field.
5069    #[serde(rename = "campaignIdDimensionValue")]
5070    pub campaign_id_dimension_value: Option<DimensionValue>,
5071    /// Comments for this placement.
5072    pub comment: Option<String>,
5073    /// Placement compatibility. DISPLAY and DISPLAY_INTERSTITIAL refer to rendering on desktop, on mobile devices or in mobile apps for regular or interstitial ads respectively. APP and APP_INTERSTITIAL are no longer allowed for new placement insertions. Instead, use DISPLAY or DISPLAY_INTERSTITIAL. IN_STREAM_VIDEO refers to rendering in in-stream video ads developed with the VAST standard. This field is required on insertion.
5074    pub compatibility: Option<String>,
5075    /// ID of the content category assigned to this placement.
5076    #[serde(rename = "contentCategoryId")]
5077    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5078    pub content_category_id: Option<i64>,
5079    /// Information about the creation of this placement. This is a read-only field.
5080    #[serde(rename = "createInfo")]
5081    pub create_info: Option<LastModifiedInfo>,
5082    /// Directory site ID of this placement. On insert, you must set either this field or the siteId field to specify the site associated with this placement. This is a required field that is read-only after insertion.
5083    #[serde(rename = "directorySiteId")]
5084    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5085    pub directory_site_id: Option<i64>,
5086    /// Dimension value for the ID of the directory site. This is a read-only, auto-generated field.
5087    #[serde(rename = "directorySiteIdDimensionValue")]
5088    pub directory_site_id_dimension_value: Option<DimensionValue>,
5089    /// External ID for this placement.
5090    #[serde(rename = "externalId")]
5091    pub external_id: Option<String>,
5092    /// ID of this placement. This is a read-only, auto-generated field.
5093    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5094    pub id: Option<i64>,
5095    /// Dimension value for the ID of this placement. This is a read-only, auto-generated field.
5096    #[serde(rename = "idDimensionValue")]
5097    pub id_dimension_value: Option<DimensionValue>,
5098    /// Key name of this placement. This is a read-only, auto-generated field.
5099    #[serde(rename = "keyName")]
5100    pub key_name: Option<String>,
5101    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#placement".
5102    pub kind: Option<String>,
5103    /// Information about the most recent modification of this placement. This is a read-only field.
5104    #[serde(rename = "lastModifiedInfo")]
5105    pub last_modified_info: Option<LastModifiedInfo>,
5106    /// Lookback window settings for this placement.
5107    #[serde(rename = "lookbackConfiguration")]
5108    pub lookback_configuration: Option<LookbackConfiguration>,
5109    /// Name of this placement.This is a required field and must be less than or equal to 256 characters long.
5110    pub name: Option<String>,
5111    /// Whether payment was approved for this placement. This is a read-only field relevant only to publisher-paid placements.
5112    #[serde(rename = "paymentApproved")]
5113    pub payment_approved: Option<bool>,
5114    /// Payment source for this placement. This is a required field that is read-only after insertion.
5115    #[serde(rename = "paymentSource")]
5116    pub payment_source: Option<String>,
5117    /// ID of this placement's group, if applicable.
5118    #[serde(rename = "placementGroupId")]
5119    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5120    pub placement_group_id: Option<i64>,
5121    /// Dimension value for the ID of the placement group. This is a read-only, auto-generated field.
5122    #[serde(rename = "placementGroupIdDimensionValue")]
5123    pub placement_group_id_dimension_value: Option<DimensionValue>,
5124    /// ID of the placement strategy assigned to this placement.
5125    #[serde(rename = "placementStrategyId")]
5126    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5127    pub placement_strategy_id: Option<i64>,
5128    /// Pricing schedule of this placement. This field is required on insertion, specifically subfields startDate, endDate and pricingType.
5129    #[serde(rename = "pricingSchedule")]
5130    pub pricing_schedule: Option<PricingSchedule>,
5131    /// Whether this placement is the primary placement of a roadblock (placement group). You cannot change this field from true to false. Setting this field to true will automatically set the primary field on the original primary placement of the roadblock to false, and it will automatically set the roadblock's primaryPlacementId field to the ID of this placement.
5132    pub primary: Option<bool>,
5133    /// Information about the last publisher update. This is a read-only field.
5134    #[serde(rename = "publisherUpdateInfo")]
5135    pub publisher_update_info: Option<LastModifiedInfo>,
5136    /// Site ID associated with this placement. On insert, you must set either this field or the directorySiteId field to specify the site associated with this placement. This is a required field that is read-only after insertion.
5137    #[serde(rename = "siteId")]
5138    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5139    pub site_id: Option<i64>,
5140    /// Dimension value for the ID of the site. This is a read-only, auto-generated field.
5141    #[serde(rename = "siteIdDimensionValue")]
5142    pub site_id_dimension_value: Option<DimensionValue>,
5143    /// Size associated with this placement. When inserting or updating a placement, only the size ID field is used. This field is required on insertion.
5144    pub size: Option<Size>,
5145    /// Whether creatives assigned to this placement must be SSL-compliant.
5146    #[serde(rename = "sslRequired")]
5147    pub ssl_required: Option<bool>,
5148    /// Third-party placement status.
5149    pub status: Option<String>,
5150    /// Subaccount ID of this placement. This field can be left blank.
5151    #[serde(rename = "subaccountId")]
5152    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5153    pub subaccount_id: Option<i64>,
5154    /// Tag formats to generate for this placement. This field is required on insertion. Acceptable values are: - "PLACEMENT_TAG_STANDARD" - "PLACEMENT_TAG_IFRAME_JAVASCRIPT" - "PLACEMENT_TAG_IFRAME_ILAYER" - "PLACEMENT_TAG_INTERNAL_REDIRECT" - "PLACEMENT_TAG_JAVASCRIPT" - "PLACEMENT_TAG_INTERSTITIAL_IFRAME_JAVASCRIPT" - "PLACEMENT_TAG_INTERSTITIAL_INTERNAL_REDIRECT" - "PLACEMENT_TAG_INTERSTITIAL_JAVASCRIPT" - "PLACEMENT_TAG_CLICK_COMMANDS" - "PLACEMENT_TAG_INSTREAM_VIDEO_PREFETCH" - "PLACEMENT_TAG_INSTREAM_VIDEO_PREFETCH_VAST_3" - "PLACEMENT_TAG_INSTREAM_VIDEO_PREFETCH_VAST_4" - "PLACEMENT_TAG_TRACKING" - "PLACEMENT_TAG_TRACKING_IFRAME" - "PLACEMENT_TAG_TRACKING_JAVASCRIPT"
5155    #[serde(rename = "tagFormats")]
5156    pub tag_formats: Option<Vec<String>>,
5157    /// Tag settings for this placement.
5158    #[serde(rename = "tagSetting")]
5159    pub tag_setting: Option<TagSetting>,
5160    /// Whether Verification and ActiveView are disabled for in-stream video creatives for this placement. The same setting videoActiveViewOptOut exists on the site level -- the opt out occurs if either of these settings are true. These settings are distinct from DirectorySites.settings.activeViewOptOut or Sites.siteSettings.activeViewOptOut which only apply to display ads. However, Accounts.activeViewOptOut opts out both video traffic, as well as display ads, from Verification and ActiveView.
5161    #[serde(rename = "videoActiveViewOptOut")]
5162    pub video_active_view_opt_out: Option<bool>,
5163    /// A collection of settings which affect video creatives served through this placement. Applicable to placements with IN_STREAM_VIDEO compatibility.
5164    #[serde(rename = "videoSettings")]
5165    pub video_settings: Option<VideoSettings>,
5166    /// VPAID adapter setting for this placement. Controls which VPAID format the measurement adapter will use for in-stream video creatives assigned to this placement. *Note:* Flash is no longer supported. This field now defaults to HTML5 when the following values are provided: FLASH, BOTH.
5167    #[serde(rename = "vpaidAdapterChoice")]
5168    pub vpaid_adapter_choice: Option<String>,
5169}
5170
5171impl common::RequestValue for Placement {}
5172impl common::Resource for Placement {}
5173impl common::ResponseResult for Placement {}
5174
5175/// Placement Assignment.
5176///
5177/// This type is not used in any activity, and only used as *part* of another schema.
5178///
5179#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5180#[serde_with::serde_as]
5181#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5182pub struct PlacementAssignment {
5183    /// Whether this placement assignment is active. When true, the placement will be included in the ad's rotation.
5184    pub active: Option<bool>,
5185    /// ID of the placement to be assigned. This is a required field.
5186    #[serde(rename = "placementId")]
5187    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5188    pub placement_id: Option<i64>,
5189    /// Dimension value for the ID of the placement. This is a read-only, auto-generated field.
5190    #[serde(rename = "placementIdDimensionValue")]
5191    pub placement_id_dimension_value: Option<DimensionValue>,
5192    /// Whether the placement to be assigned requires SSL. This is a read-only field that is auto-generated when the ad is inserted or updated.
5193    #[serde(rename = "sslRequired")]
5194    pub ssl_required: Option<bool>,
5195}
5196
5197impl common::Part for PlacementAssignment {}
5198
5199/// Contains properties of a package or roadblock.
5200///
5201/// # Activities
5202///
5203/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5204/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5205///
5206/// * [get placement groups](PlacementGroupGetCall) (response)
5207/// * [insert placement groups](PlacementGroupInsertCall) (request|response)
5208/// * [list placement groups](PlacementGroupListCall) (none)
5209/// * [patch placement groups](PlacementGroupPatchCall) (request|response)
5210/// * [update placement groups](PlacementGroupUpdateCall) (request|response)
5211#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5212#[serde_with::serde_as]
5213#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5214pub struct PlacementGroup {
5215    /// Account ID of this placement group. This is a read-only field that can be left blank.
5216    #[serde(rename = "accountId")]
5217    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5218    pub account_id: Option<i64>,
5219    /// Advertiser ID of this placement group. This is a required field on insertion.
5220    #[serde(rename = "advertiserId")]
5221    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5222    pub advertiser_id: Option<i64>,
5223    /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field.
5224    #[serde(rename = "advertiserIdDimensionValue")]
5225    pub advertiser_id_dimension_value: Option<DimensionValue>,
5226    /// Whether this placement group is archived.
5227    pub archived: Option<bool>,
5228    /// Campaign ID of this placement group. This field is required on insertion.
5229    #[serde(rename = "campaignId")]
5230    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5231    pub campaign_id: Option<i64>,
5232    /// Dimension value for the ID of the campaign. This is a read-only, auto-generated field.
5233    #[serde(rename = "campaignIdDimensionValue")]
5234    pub campaign_id_dimension_value: Option<DimensionValue>,
5235    /// IDs of placements which are assigned to this placement group. This is a read-only, auto-generated field.
5236    #[serde(rename = "childPlacementIds")]
5237    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
5238    pub child_placement_ids: Option<Vec<i64>>,
5239    /// Comments for this placement group.
5240    pub comment: Option<String>,
5241    /// ID of the content category assigned to this placement group.
5242    #[serde(rename = "contentCategoryId")]
5243    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5244    pub content_category_id: Option<i64>,
5245    /// Information about the creation of this placement group. This is a read-only field.
5246    #[serde(rename = "createInfo")]
5247    pub create_info: Option<LastModifiedInfo>,
5248    /// Directory site ID associated with this placement group. On insert, you must set either this field or the site_id field to specify the site associated with this placement group. This is a required field that is read-only after insertion.
5249    #[serde(rename = "directorySiteId")]
5250    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5251    pub directory_site_id: Option<i64>,
5252    /// Dimension value for the ID of the directory site. This is a read-only, auto-generated field.
5253    #[serde(rename = "directorySiteIdDimensionValue")]
5254    pub directory_site_id_dimension_value: Option<DimensionValue>,
5255    /// External ID for this placement.
5256    #[serde(rename = "externalId")]
5257    pub external_id: Option<String>,
5258    /// ID of this placement group. This is a read-only, auto-generated field.
5259    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5260    pub id: Option<i64>,
5261    /// Dimension value for the ID of this placement group. This is a read-only, auto-generated field.
5262    #[serde(rename = "idDimensionValue")]
5263    pub id_dimension_value: Option<DimensionValue>,
5264    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#placementGroup".
5265    pub kind: Option<String>,
5266    /// Information about the most recent modification of this placement group. This is a read-only field.
5267    #[serde(rename = "lastModifiedInfo")]
5268    pub last_modified_info: Option<LastModifiedInfo>,
5269    /// Name of this placement group. This is a required field and must be less than 256 characters long.
5270    pub name: Option<String>,
5271    /// Type of this placement group. A package is a simple group of placements that acts as a single pricing point for a group of tags. A roadblock is a group of placements that not only acts as a single pricing point, but also assumes that all the tags in it will be served at the same time. A roadblock requires one of its assigned placements to be marked as primary for reporting. This field is required on insertion.
5272    #[serde(rename = "placementGroupType")]
5273    pub placement_group_type: Option<String>,
5274    /// ID of the placement strategy assigned to this placement group.
5275    #[serde(rename = "placementStrategyId")]
5276    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5277    pub placement_strategy_id: Option<i64>,
5278    /// Pricing schedule of this placement group. This field is required on insertion.
5279    #[serde(rename = "pricingSchedule")]
5280    pub pricing_schedule: Option<PricingSchedule>,
5281    /// ID of the primary placement, used to calculate the media cost of a roadblock (placement group). Modifying this field will automatically modify the primary field on all affected roadblock child placements.
5282    #[serde(rename = "primaryPlacementId")]
5283    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5284    pub primary_placement_id: Option<i64>,
5285    /// Dimension value for the ID of the primary placement. This is a read-only, auto-generated field.
5286    #[serde(rename = "primaryPlacementIdDimensionValue")]
5287    pub primary_placement_id_dimension_value: Option<DimensionValue>,
5288    /// Site ID associated with this placement group. On insert, you must set either this field or the directorySiteId field to specify the site associated with this placement group. This is a required field that is read-only after insertion.
5289    #[serde(rename = "siteId")]
5290    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5291    pub site_id: Option<i64>,
5292    /// Dimension value for the ID of the site. This is a read-only, auto-generated field.
5293    #[serde(rename = "siteIdDimensionValue")]
5294    pub site_id_dimension_value: Option<DimensionValue>,
5295    /// Subaccount ID of this placement group. This is a read-only field that can be left blank.
5296    #[serde(rename = "subaccountId")]
5297    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5298    pub subaccount_id: Option<i64>,
5299}
5300
5301impl common::RequestValue for PlacementGroup {}
5302impl common::Resource for PlacementGroup {}
5303impl common::ResponseResult for PlacementGroup {}
5304
5305/// Placement Group List Response
5306///
5307/// # Activities
5308///
5309/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5310/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5311///
5312/// * [list placement groups](PlacementGroupListCall) (response)
5313#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5314#[serde_with::serde_as]
5315#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5316pub struct PlacementGroupsListResponse {
5317    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#placementGroupsListResponse".
5318    pub kind: Option<String>,
5319    /// Pagination token to be used for the next list operation.
5320    #[serde(rename = "nextPageToken")]
5321    pub next_page_token: Option<String>,
5322    /// Placement group collection.
5323    #[serde(rename = "placementGroups")]
5324    pub placement_groups: Option<Vec<PlacementGroup>>,
5325}
5326
5327impl common::ResponseResult for PlacementGroupsListResponse {}
5328
5329/// Placement Strategy List Response
5330///
5331/// # Activities
5332///
5333/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5334/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5335///
5336/// * [list placement strategies](PlacementStrategyListCall) (response)
5337#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5338#[serde_with::serde_as]
5339#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5340pub struct PlacementStrategiesListResponse {
5341    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#placementStrategiesListResponse".
5342    pub kind: Option<String>,
5343    /// Pagination token to be used for the next list operation.
5344    #[serde(rename = "nextPageToken")]
5345    pub next_page_token: Option<String>,
5346    /// Placement strategy collection.
5347    #[serde(rename = "placementStrategies")]
5348    pub placement_strategies: Option<Vec<PlacementStrategy>>,
5349}
5350
5351impl common::ResponseResult for PlacementStrategiesListResponse {}
5352
5353/// Contains properties of a placement strategy.
5354///
5355/// # Activities
5356///
5357/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5358/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5359///
5360/// * [get placement strategies](PlacementStrategyGetCall) (response)
5361/// * [insert placement strategies](PlacementStrategyInsertCall) (request|response)
5362/// * [patch placement strategies](PlacementStrategyPatchCall) (request|response)
5363/// * [update placement strategies](PlacementStrategyUpdateCall) (request|response)
5364#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5365#[serde_with::serde_as]
5366#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5367pub struct PlacementStrategy {
5368    /// Account ID of this placement strategy.This is a read-only field that can be left blank.
5369    #[serde(rename = "accountId")]
5370    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5371    pub account_id: Option<i64>,
5372    /// ID of this placement strategy. This is a read-only, auto-generated field.
5373    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5374    pub id: Option<i64>,
5375    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#placementStrategy".
5376    pub kind: Option<String>,
5377    /// Name of this placement strategy. This is a required field. It must be less than 256 characters long and unique among placement strategies of the same account.
5378    pub name: Option<String>,
5379}
5380
5381impl common::RequestValue for PlacementStrategy {}
5382impl common::ResponseResult for PlacementStrategy {}
5383
5384/// Placement Tag
5385///
5386/// This type is not used in any activity, and only used as *part* of another schema.
5387///
5388#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5389#[serde_with::serde_as]
5390#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5391pub struct PlacementTag {
5392    /// Placement ID
5393    #[serde(rename = "placementId")]
5394    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5395    pub placement_id: Option<i64>,
5396    /// Tags generated for this placement.
5397    #[serde(rename = "tagDatas")]
5398    pub tag_datas: Option<Vec<TagData>>,
5399}
5400
5401impl common::Part for PlacementTag {}
5402
5403/// Placement GenerateTags Response
5404///
5405/// # Activities
5406///
5407/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5408/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5409///
5410/// * [generatetags placements](PlacementGeneratetagCall) (response)
5411#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5412#[serde_with::serde_as]
5413#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5414pub struct PlacementsGenerateTagsResponse {
5415    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#placementsGenerateTagsResponse".
5416    pub kind: Option<String>,
5417    /// Set of generated tags for the specified placements.
5418    #[serde(rename = "placementTags")]
5419    pub placement_tags: Option<Vec<PlacementTag>>,
5420}
5421
5422impl common::ResponseResult for PlacementsGenerateTagsResponse {}
5423
5424/// Placement List Response
5425///
5426/// # Activities
5427///
5428/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5429/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5430///
5431/// * [list placements](PlacementListCall) (response)
5432#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5433#[serde_with::serde_as]
5434#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5435pub struct PlacementsListResponse {
5436    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#placementsListResponse".
5437    pub kind: Option<String>,
5438    /// Pagination token to be used for the next list operation.
5439    #[serde(rename = "nextPageToken")]
5440    pub next_page_token: Option<String>,
5441    /// Placement collection.
5442    pub placements: Option<Vec<Placement>>,
5443}
5444
5445impl common::ResponseResult for PlacementsListResponse {}
5446
5447/// Contains information about a platform type that can be targeted by ads.
5448///
5449/// # Activities
5450///
5451/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5452/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5453///
5454/// * [get platform types](PlatformTypeGetCall) (response)
5455/// * [list platform types](PlatformTypeListCall) (none)
5456#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5457#[serde_with::serde_as]
5458#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5459pub struct PlatformType {
5460    /// ID of this platform type.
5461    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5462    pub id: Option<i64>,
5463    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#platformType".
5464    pub kind: Option<String>,
5465    /// Name of this platform type.
5466    pub name: Option<String>,
5467}
5468
5469impl common::Resource for PlatformType {}
5470impl common::ResponseResult for PlatformType {}
5471
5472/// Platform Type List Response
5473///
5474/// # Activities
5475///
5476/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5477/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5478///
5479/// * [list platform types](PlatformTypeListCall) (response)
5480#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5481#[serde_with::serde_as]
5482#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5483pub struct PlatformTypesListResponse {
5484    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#platformTypesListResponse".
5485    pub kind: Option<String>,
5486    /// Platform type collection.
5487    #[serde(rename = "platformTypes")]
5488    pub platform_types: Option<Vec<PlatformType>>,
5489}
5490
5491impl common::ResponseResult for PlatformTypesListResponse {}
5492
5493/// Popup Window Properties.
5494///
5495/// This type is not used in any activity, and only used as *part* of another schema.
5496///
5497#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5498#[serde_with::serde_as]
5499#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5500pub struct PopupWindowProperties {
5501    /// Popup dimension for a creative. This is a read-only field. Applicable to the following creative types: all RICH_MEDIA and all VPAID
5502    pub dimension: Option<Size>,
5503    /// Upper-left corner coordinates of the popup window. Applicable if positionType is COORDINATES.
5504    pub offset: Option<OffsetPosition>,
5505    /// Popup window position either centered or at specific coordinate.
5506    #[serde(rename = "positionType")]
5507    pub position_type: Option<String>,
5508    /// Whether to display the browser address bar.
5509    #[serde(rename = "showAddressBar")]
5510    pub show_address_bar: Option<bool>,
5511    /// Whether to display the browser menu bar.
5512    #[serde(rename = "showMenuBar")]
5513    pub show_menu_bar: Option<bool>,
5514    /// Whether to display the browser scroll bar.
5515    #[serde(rename = "showScrollBar")]
5516    pub show_scroll_bar: Option<bool>,
5517    /// Whether to display the browser status bar.
5518    #[serde(rename = "showStatusBar")]
5519    pub show_status_bar: Option<bool>,
5520    /// Whether to display the browser tool bar.
5521    #[serde(rename = "showToolBar")]
5522    pub show_tool_bar: Option<bool>,
5523    /// Title of popup window.
5524    pub title: Option<String>,
5525}
5526
5527impl common::Part for PopupWindowProperties {}
5528
5529/// Contains information about a postal code that can be targeted by ads.
5530///
5531/// # Activities
5532///
5533/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5534/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5535///
5536/// * [get postal codes](PostalCodeGetCall) (response)
5537/// * [list postal codes](PostalCodeListCall) (none)
5538#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5539#[serde_with::serde_as]
5540#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5541pub struct PostalCode {
5542    /// Postal code. This is equivalent to the id field.
5543    pub code: Option<String>,
5544    /// Country code of the country to which this postal code belongs.
5545    #[serde(rename = "countryCode")]
5546    pub country_code: Option<String>,
5547    /// DART ID of the country to which this postal code belongs.
5548    #[serde(rename = "countryDartId")]
5549    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5550    pub country_dart_id: Option<i64>,
5551    /// ID of this postal code.
5552    pub id: Option<String>,
5553    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#postalCode".
5554    pub kind: Option<String>,
5555}
5556
5557impl common::Resource for PostalCode {}
5558impl common::ResponseResult for PostalCode {}
5559
5560/// Postal Code List Response
5561///
5562/// # Activities
5563///
5564/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5565/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5566///
5567/// * [list postal codes](PostalCodeListCall) (response)
5568#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5569#[serde_with::serde_as]
5570#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5571pub struct PostalCodesListResponse {
5572    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#postalCodesListResponse".
5573    pub kind: Option<String>,
5574    /// Postal code collection.
5575    #[serde(rename = "postalCodes")]
5576    pub postal_codes: Option<Vec<PostalCode>>,
5577}
5578
5579impl common::ResponseResult for PostalCodesListResponse {}
5580
5581/// Pricing Information
5582///
5583/// This type is not used in any activity, and only used as *part* of another schema.
5584///
5585#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5586#[serde_with::serde_as]
5587#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5588pub struct Pricing {
5589    /// Cap cost type of this inventory item.
5590    #[serde(rename = "capCostType")]
5591    pub cap_cost_type: Option<String>,
5592    /// no description provided
5593    #[serde(rename = "endDate")]
5594    pub end_date: Option<chrono::NaiveDate>,
5595    /// Flights of this inventory item. A flight (a.k.a. pricing period) represents the inventory item pricing information for a specific period of time.
5596    pub flights: Option<Vec<Flight>>,
5597    /// Group type of this inventory item if it represents a placement group. Is null otherwise. There are two type of placement groups: PLANNING_PLACEMENT_GROUP_TYPE_PACKAGE is a simple group of inventory items that acts as a single pricing point for a group of tags. PLANNING_PLACEMENT_GROUP_TYPE_ROADBLOCK is a group of inventory items that not only acts as a single pricing point, but also assumes that all the tags in it will be served at the same time. A roadblock requires one of its assigned inventory items to be marked as primary.
5598    #[serde(rename = "groupType")]
5599    pub group_type: Option<String>,
5600    /// Pricing type of this inventory item.
5601    #[serde(rename = "pricingType")]
5602    pub pricing_type: Option<String>,
5603    /// no description provided
5604    #[serde(rename = "startDate")]
5605    pub start_date: Option<chrono::NaiveDate>,
5606}
5607
5608impl common::Part for Pricing {}
5609
5610/// Pricing Schedule
5611///
5612/// This type is not used in any activity, and only used as *part* of another schema.
5613///
5614#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5615#[serde_with::serde_as]
5616#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5617pub struct PricingSchedule {
5618    /// Placement cap cost option.
5619    #[serde(rename = "capCostOption")]
5620    pub cap_cost_option: Option<String>,
5621    /// Whether cap costs are ignored by ad serving.
5622    #[serde(rename = "disregardOverdelivery")]
5623    pub disregard_overdelivery: Option<bool>,
5624    /// no description provided
5625    #[serde(rename = "endDate")]
5626    pub end_date: Option<chrono::NaiveDate>,
5627    /// Whether this placement is flighted. If true, pricing periods will be computed automatically.
5628    pub flighted: Option<bool>,
5629    /// Floodlight activity ID associated with this placement. This field should be set when placement pricing type is set to PRICING_TYPE_CPA.
5630    #[serde(rename = "floodlightActivityId")]
5631    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5632    pub floodlight_activity_id: Option<i64>,
5633    /// Pricing periods for this placement.
5634    #[serde(rename = "pricingPeriods")]
5635    pub pricing_periods: Option<Vec<PricingSchedulePricingPeriod>>,
5636    /// Placement pricing type. This field is required on insertion.
5637    #[serde(rename = "pricingType")]
5638    pub pricing_type: Option<String>,
5639    /// no description provided
5640    #[serde(rename = "startDate")]
5641    pub start_date: Option<chrono::NaiveDate>,
5642    /// no description provided
5643    #[serde(rename = "testingStartDate")]
5644    pub testing_start_date: Option<chrono::NaiveDate>,
5645}
5646
5647impl common::Part for PricingSchedule {}
5648
5649/// Pricing Period
5650///
5651/// This type is not used in any activity, and only used as *part* of another schema.
5652///
5653#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5654#[serde_with::serde_as]
5655#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5656pub struct PricingSchedulePricingPeriod {
5657    /// no description provided
5658    #[serde(rename = "endDate")]
5659    pub end_date: Option<chrono::NaiveDate>,
5660    /// Comments for this pricing period.
5661    #[serde(rename = "pricingComment")]
5662    pub pricing_comment: Option<String>,
5663    /// Rate or cost of this pricing period in nanos (i.e., multipled by 1000000000). Acceptable values are 0 to 1000000000000000000, inclusive.
5664    #[serde(rename = "rateOrCostNanos")]
5665    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5666    pub rate_or_cost_nanos: Option<i64>,
5667    /// no description provided
5668    #[serde(rename = "startDate")]
5669    pub start_date: Option<chrono::NaiveDate>,
5670    /// Units of this pricing period. Acceptable values are 0 to 10000000000, inclusive.
5671    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5672    pub units: Option<i64>,
5673}
5674
5675impl common::Part for PricingSchedulePricingPeriod {}
5676
5677/// Contains properties of a Planning project.
5678///
5679/// # Activities
5680///
5681/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5682/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5683///
5684/// * [get projects](ProjectGetCall) (response)
5685/// * [list projects](ProjectListCall) (none)
5686#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5687#[serde_with::serde_as]
5688#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5689pub struct Project {
5690    /// Account ID of this project.
5691    #[serde(rename = "accountId")]
5692    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5693    pub account_id: Option<i64>,
5694    /// Advertiser ID of this project.
5695    #[serde(rename = "advertiserId")]
5696    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5697    pub advertiser_id: Option<i64>,
5698    /// Audience age group of this project.
5699    #[serde(rename = "audienceAgeGroup")]
5700    pub audience_age_group: Option<String>,
5701    /// Audience gender of this project.
5702    #[serde(rename = "audienceGender")]
5703    pub audience_gender: Option<String>,
5704    /// Budget of this project in the currency specified by the current account. The value stored in this field represents only the non-fractional amount. For example, for USD, the smallest value that can be represented by this field is 1 US dollar.
5705    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5706    pub budget: Option<i64>,
5707    /// Client billing code of this project.
5708    #[serde(rename = "clientBillingCode")]
5709    pub client_billing_code: Option<String>,
5710    /// Name of the project client.
5711    #[serde(rename = "clientName")]
5712    pub client_name: Option<String>,
5713    /// no description provided
5714    #[serde(rename = "endDate")]
5715    pub end_date: Option<chrono::NaiveDate>,
5716    /// ID of this project. This is a read-only, auto-generated field.
5717    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5718    pub id: Option<i64>,
5719    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#project".
5720    pub kind: Option<String>,
5721    /// Information about the most recent modification of this project.
5722    #[serde(rename = "lastModifiedInfo")]
5723    pub last_modified_info: Option<LastModifiedInfo>,
5724    /// Name of this project.
5725    pub name: Option<String>,
5726    /// Overview of this project.
5727    pub overview: Option<String>,
5728    /// no description provided
5729    #[serde(rename = "startDate")]
5730    pub start_date: Option<chrono::NaiveDate>,
5731    /// Subaccount ID of this project.
5732    #[serde(rename = "subaccountId")]
5733    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5734    pub subaccount_id: Option<i64>,
5735    /// Number of clicks that the advertiser is targeting.
5736    #[serde(rename = "targetClicks")]
5737    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5738    pub target_clicks: Option<i64>,
5739    /// Number of conversions that the advertiser is targeting.
5740    #[serde(rename = "targetConversions")]
5741    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5742    pub target_conversions: Option<i64>,
5743    /// CPA that the advertiser is targeting.
5744    #[serde(rename = "targetCpaNanos")]
5745    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5746    pub target_cpa_nanos: Option<i64>,
5747    /// CPC that the advertiser is targeting.
5748    #[serde(rename = "targetCpcNanos")]
5749    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5750    pub target_cpc_nanos: Option<i64>,
5751    /// vCPM from Active View that the advertiser is targeting.
5752    #[serde(rename = "targetCpmActiveViewNanos")]
5753    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5754    pub target_cpm_active_view_nanos: Option<i64>,
5755    /// CPM that the advertiser is targeting.
5756    #[serde(rename = "targetCpmNanos")]
5757    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5758    pub target_cpm_nanos: Option<i64>,
5759    /// Number of impressions that the advertiser is targeting.
5760    #[serde(rename = "targetImpressions")]
5761    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5762    pub target_impressions: Option<i64>,
5763}
5764
5765impl common::Resource for Project {}
5766impl common::ResponseResult for Project {}
5767
5768/// Project List Response
5769///
5770/// # Activities
5771///
5772/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5773/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5774///
5775/// * [list projects](ProjectListCall) (response)
5776#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5777#[serde_with::serde_as]
5778#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5779pub struct ProjectsListResponse {
5780    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#projectsListResponse".
5781    pub kind: Option<String>,
5782    /// Pagination token to be used for the next list operation.
5783    #[serde(rename = "nextPageToken")]
5784    pub next_page_token: Option<String>,
5785    /// Project collection.
5786    pub projects: Option<Vec<Project>>,
5787}
5788
5789impl common::ResponseResult for ProjectsListResponse {}
5790
5791/// Represents fields that are compatible to be selected for a report of type "REACH".
5792///
5793/// This type is not used in any activity, and only used as *part* of another schema.
5794///
5795#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5796#[serde_with::serde_as]
5797#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5798pub struct ReachReportCompatibleFields {
5799    /// Dimensions which are compatible to be selected in the "dimensionFilters" section of the report.
5800    #[serde(rename = "dimensionFilters")]
5801    pub dimension_filters: Option<Vec<Dimension>>,
5802    /// Dimensions which are compatible to be selected in the "dimensions" section of the report.
5803    pub dimensions: Option<Vec<Dimension>>,
5804    /// The kind of resource this is, in this case dfareporting#reachReportCompatibleFields.
5805    pub kind: Option<String>,
5806    /// Metrics which are compatible to be selected in the "metricNames" section of the report.
5807    pub metrics: Option<Vec<Metric>>,
5808    /// Metrics which are compatible to be selected as activity metrics to pivot on in the "activities" section of the report.
5809    #[serde(rename = "pivotedActivityMetrics")]
5810    pub pivoted_activity_metrics: Option<Vec<Metric>>,
5811    /// Metrics which are compatible to be selected in the "reachByFrequencyMetricNames" section of the report.
5812    #[serde(rename = "reachByFrequencyMetrics")]
5813    pub reach_by_frequency_metrics: Option<Vec<Metric>>,
5814}
5815
5816impl common::Part for ReachReportCompatibleFields {}
5817
5818/// Represents a recipient.
5819///
5820/// This type is not used in any activity, and only used as *part* of another schema.
5821///
5822#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5823#[serde_with::serde_as]
5824#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5825pub struct Recipient {
5826    /// The delivery type for the recipient.
5827    #[serde(rename = "deliveryType")]
5828    pub delivery_type: Option<String>,
5829    /// The email address of the recipient.
5830    pub email: Option<String>,
5831    /// The kind of resource this is, in this case dfareporting#recipient.
5832    pub kind: Option<String>,
5833}
5834
5835impl common::Part for Recipient {}
5836
5837/// Contains information about a region that can be targeted by ads.
5838///
5839/// # Activities
5840///
5841/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5842/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5843///
5844/// * [list regions](RegionListCall) (none)
5845#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5846#[serde_with::serde_as]
5847#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5848pub struct Region {
5849    /// Country code of the country to which this region belongs.
5850    #[serde(rename = "countryCode")]
5851    pub country_code: Option<String>,
5852    /// DART ID of the country to which this region belongs.
5853    #[serde(rename = "countryDartId")]
5854    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5855    pub country_dart_id: Option<i64>,
5856    /// DART ID of this region.
5857    #[serde(rename = "dartId")]
5858    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5859    pub dart_id: Option<i64>,
5860    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#region".
5861    pub kind: Option<String>,
5862    /// Name of this region.
5863    pub name: Option<String>,
5864    /// Region code.
5865    #[serde(rename = "regionCode")]
5866    pub region_code: Option<String>,
5867}
5868
5869impl common::Resource for Region {}
5870
5871/// Region List Response
5872///
5873/// # Activities
5874///
5875/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5876/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5877///
5878/// * [list regions](RegionListCall) (response)
5879#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5880#[serde_with::serde_as]
5881#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5882pub struct RegionsListResponse {
5883    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#regionsListResponse".
5884    pub kind: Option<String>,
5885    /// Region collection.
5886    pub regions: Option<Vec<Region>>,
5887}
5888
5889impl common::ResponseResult for RegionsListResponse {}
5890
5891/// Contains properties of a remarketing list. Remarketing enables you to create lists of users who have performed specific actions on a site, then target ads to members of those lists. This resource can be used to manage remarketing lists that are owned by your advertisers. To see all remarketing lists that are visible to your advertisers, including those that are shared to your advertiser or account, use the TargetableRemarketingLists resource.
5892///
5893/// # Activities
5894///
5895/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5896/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5897///
5898/// * [get remarketing lists](RemarketingListGetCall) (response)
5899/// * [insert remarketing lists](RemarketingListInsertCall) (request|response)
5900/// * [list remarketing lists](RemarketingListListCall) (none)
5901/// * [patch remarketing lists](RemarketingListPatchCall) (request|response)
5902/// * [update remarketing lists](RemarketingListUpdateCall) (request|response)
5903#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5904#[serde_with::serde_as]
5905#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5906pub struct RemarketingList {
5907    /// Account ID of this remarketing list. This is a read-only, auto-generated field that is only returned in GET requests.
5908    #[serde(rename = "accountId")]
5909    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5910    pub account_id: Option<i64>,
5911    /// Whether this remarketing list is active.
5912    pub active: Option<bool>,
5913    /// Dimension value for the advertiser ID that owns this remarketing list. This is a required field.
5914    #[serde(rename = "advertiserId")]
5915    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5916    pub advertiser_id: Option<i64>,
5917    /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field.
5918    #[serde(rename = "advertiserIdDimensionValue")]
5919    pub advertiser_id_dimension_value: Option<DimensionValue>,
5920    /// Remarketing list description.
5921    pub description: Option<String>,
5922    /// Remarketing list ID. This is a read-only, auto-generated field.
5923    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5924    pub id: Option<i64>,
5925    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#remarketingList".
5926    pub kind: Option<String>,
5927    /// Number of days that a user should remain in the remarketing list without an impression. Acceptable values are 1 to 540, inclusive.
5928    #[serde(rename = "lifeSpan")]
5929    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5930    pub life_span: Option<i64>,
5931    /// Rule used to populate the remarketing list with users.
5932    #[serde(rename = "listPopulationRule")]
5933    pub list_population_rule: Option<ListPopulationRule>,
5934    /// Number of users currently in the list. This is a read-only field.
5935    #[serde(rename = "listSize")]
5936    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5937    pub list_size: Option<i64>,
5938    /// Product from which this remarketing list was originated.
5939    #[serde(rename = "listSource")]
5940    pub list_source: Option<String>,
5941    /// Name of the remarketing list. This is a required field. Must be no greater than 128 characters long.
5942    pub name: Option<String>,
5943    /// Subaccount ID of this remarketing list. This is a read-only, auto-generated field that is only returned in GET requests.
5944    #[serde(rename = "subaccountId")]
5945    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5946    pub subaccount_id: Option<i64>,
5947}
5948
5949impl common::RequestValue for RemarketingList {}
5950impl common::Resource for RemarketingList {}
5951impl common::ResponseResult for RemarketingList {}
5952
5953/// Contains properties of a remarketing list’s sharing information. Sharing allows other accounts or advertisers to target to your remarketing lists. This resource can be used to manage remarketing list sharing to other accounts and advertisers.
5954///
5955/// # Activities
5956///
5957/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5958/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5959///
5960/// * [get remarketing list shares](RemarketingListShareGetCall) (response)
5961/// * [patch remarketing list shares](RemarketingListSharePatchCall) (request|response)
5962/// * [update remarketing list shares](RemarketingListShareUpdateCall) (request|response)
5963#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5964#[serde_with::serde_as]
5965#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5966pub struct RemarketingListShare {
5967    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#remarketingListShare".
5968    pub kind: Option<String>,
5969    /// Remarketing list ID. This is a read-only, auto-generated field.
5970    #[serde(rename = "remarketingListId")]
5971    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5972    pub remarketing_list_id: Option<i64>,
5973    /// Accounts that the remarketing list is shared with.
5974    #[serde(rename = "sharedAccountIds")]
5975    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
5976    pub shared_account_ids: Option<Vec<i64>>,
5977    /// Advertisers that the remarketing list is shared with.
5978    #[serde(rename = "sharedAdvertiserIds")]
5979    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
5980    pub shared_advertiser_ids: Option<Vec<i64>>,
5981}
5982
5983impl common::RequestValue for RemarketingListShare {}
5984impl common::Resource for RemarketingListShare {}
5985impl common::ResponseResult for RemarketingListShare {}
5986
5987/// Remarketing list response
5988///
5989/// # Activities
5990///
5991/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5992/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5993///
5994/// * [list remarketing lists](RemarketingListListCall) (response)
5995#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5996#[serde_with::serde_as]
5997#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5998pub struct RemarketingListsListResponse {
5999    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#remarketingListsListResponse".
6000    pub kind: Option<String>,
6001    /// Pagination token to be used for the next list operation.
6002    #[serde(rename = "nextPageToken")]
6003    pub next_page_token: Option<String>,
6004    /// Remarketing list collection.
6005    #[serde(rename = "remarketingLists")]
6006    pub remarketing_lists: Option<Vec<RemarketingList>>,
6007}
6008
6009impl common::ResponseResult for RemarketingListsListResponse {}
6010
6011/// Represents a Report resource.
6012///
6013/// # Activities
6014///
6015/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6016/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6017///
6018/// * [compatible fields query reports](ReportCompatibleFieldQueryCall) (request)
6019/// * [files get reports](ReportFileGetCall) (none)
6020/// * [files list reports](ReportFileListCall) (none)
6021/// * [delete reports](ReportDeleteCall) (none)
6022/// * [get reports](ReportGetCall) (response)
6023/// * [insert reports](ReportInsertCall) (request|response)
6024/// * [list reports](ReportListCall) (none)
6025/// * [patch reports](ReportPatchCall) (request|response)
6026/// * [run reports](ReportRunCall) (none)
6027/// * [update reports](ReportUpdateCall) (request|response)
6028#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6029#[serde_with::serde_as]
6030#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6031pub struct Report {
6032    /// The account ID to which this report belongs.
6033    #[serde(rename = "accountId")]
6034    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6035    pub account_id: Option<i64>,
6036    /// The report criteria for a report of type "STANDARD".
6037    pub criteria: Option<ReportCriteria>,
6038    /// The report criteria for a report of type "CROSS_DIMENSION_REACH".
6039    #[serde(rename = "crossDimensionReachCriteria")]
6040    pub cross_dimension_reach_criteria: Option<ReportCrossDimensionReachCriteria>,
6041    /// The report's email delivery settings.
6042    pub delivery: Option<ReportDelivery>,
6043    /// The eTag of this response for caching purposes.
6044    pub etag: Option<String>,
6045    /// The filename used when generating report files for this report.
6046    #[serde(rename = "fileName")]
6047    pub file_name: Option<String>,
6048    /// The report criteria for a report of type "FLOODLIGHT".
6049    #[serde(rename = "floodlightCriteria")]
6050    pub floodlight_criteria: Option<ReportFloodlightCriteria>,
6051    /// The output format of the report. If not specified, default format is "CSV". Note that the actual format in the completed report file might differ if for instance the report's size exceeds the format's capabilities. "CSV" will then be the fallback format.
6052    pub format: Option<String>,
6053    /// The unique ID identifying this report resource.
6054    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6055    pub id: Option<i64>,
6056    /// The kind of resource this is, in this case dfareporting#report.
6057    pub kind: Option<String>,
6058    /// The timestamp (in milliseconds since epoch) of when this report was last modified.
6059    #[serde(rename = "lastModifiedTime")]
6060    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6061    pub last_modified_time: Option<u64>,
6062    /// The name of the report.
6063    pub name: Option<String>,
6064    /// The user profile id of the owner of this report.
6065    #[serde(rename = "ownerProfileId")]
6066    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6067    pub owner_profile_id: Option<i64>,
6068    /// The report criteria for a report of type "PATH_TO_CONVERSION".
6069    #[serde(rename = "pathToConversionCriteria")]
6070    pub path_to_conversion_criteria: Option<ReportPathToConversionCriteria>,
6071    /// The report criteria for a report of type "REACH".
6072    #[serde(rename = "reachCriteria")]
6073    pub reach_criteria: Option<ReportReachCriteria>,
6074    /// The report's schedule. Can only be set if the report's 'dateRange' is a relative date range and the relative date range is not "TODAY".
6075    pub schedule: Option<ReportSchedule>,
6076    /// The subaccount ID to which this report belongs if applicable.
6077    #[serde(rename = "subAccountId")]
6078    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6079    pub sub_account_id: Option<i64>,
6080    /// The type of the report.
6081    #[serde(rename = "type")]
6082    pub type_: Option<String>,
6083}
6084
6085impl common::RequestValue for Report {}
6086impl common::Resource for Report {}
6087impl common::ResponseResult for Report {}
6088
6089/// Represents fields that are compatible to be selected for a report of type "STANDARD".
6090///
6091/// This type is not used in any activity, and only used as *part* of another schema.
6092///
6093#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6094#[serde_with::serde_as]
6095#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6096pub struct ReportCompatibleFields {
6097    /// Dimensions which are compatible to be selected in the "dimensionFilters" section of the report.
6098    #[serde(rename = "dimensionFilters")]
6099    pub dimension_filters: Option<Vec<Dimension>>,
6100    /// Dimensions which are compatible to be selected in the "dimensions" section of the report.
6101    pub dimensions: Option<Vec<Dimension>>,
6102    /// The kind of resource this is, in this case dfareporting#reportCompatibleFields.
6103    pub kind: Option<String>,
6104    /// Metrics which are compatible to be selected in the "metricNames" section of the report.
6105    pub metrics: Option<Vec<Metric>>,
6106    /// Metrics which are compatible to be selected as activity metrics to pivot on in the "activities" section of the report.
6107    #[serde(rename = "pivotedActivityMetrics")]
6108    pub pivoted_activity_metrics: Option<Vec<Metric>>,
6109}
6110
6111impl common::Part for ReportCompatibleFields {}
6112
6113/// Represents the list of reports.
6114///
6115/// # Activities
6116///
6117/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6118/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6119///
6120/// * [list reports](ReportListCall) (response)
6121#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6122#[serde_with::serde_as]
6123#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6124pub struct ReportList {
6125    /// The eTag of this response for caching purposes.
6126    pub etag: Option<String>,
6127    /// The reports returned in this response.
6128    pub items: Option<Vec<Report>>,
6129    /// The kind of list this is, in this case dfareporting#reportList.
6130    pub kind: Option<String>,
6131    /// Continuation token used to page through reports. To retrieve the next page of results, set the next request's "pageToken" to the value of this field. The page token is only valid for a limited amount of time and should not be persisted.
6132    #[serde(rename = "nextPageToken")]
6133    pub next_page_token: Option<String>,
6134}
6135
6136impl common::ResponseResult for ReportList {}
6137
6138/// Reporting Configuration
6139///
6140/// This type is not used in any activity, and only used as *part* of another schema.
6141///
6142#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6143#[serde_with::serde_as]
6144#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6145pub struct ReportsConfiguration {
6146    /// Whether the exposure to conversion report is enabled. This report shows detailed pathway information on up to 10 of the most recent ad exposures seen by a user before converting.
6147    #[serde(rename = "exposureToConversionEnabled")]
6148    pub exposure_to_conversion_enabled: Option<bool>,
6149    /// Default lookback windows for new advertisers in this account.
6150    #[serde(rename = "lookbackConfiguration")]
6151    pub lookback_configuration: Option<LookbackConfiguration>,
6152    /// Report generation time zone ID of this account. This is a required field that can only be changed by a superuser. Acceptable values are: - "1" for "America/New_York" - "2" for "Europe/London" - "3" for "Europe/Paris" - "4" for "Africa/Johannesburg" - "5" for "Asia/Jerusalem" - "6" for "Asia/Shanghai" - "7" for "Asia/Hong_Kong" - "8" for "Asia/Tokyo" - "9" for "Australia/Sydney" - "10" for "Asia/Dubai" - "11" for "America/Los_Angeles" - "12" for "Pacific/Auckland" - "13" for "America/Sao_Paulo" - "16" for "America/Asuncion" - "17" for "America/Chicago" - "18" for "America/Denver" - "19" for "America/St_Johns" - "20" for "Asia/Dhaka" - "21" for "Asia/Jakarta" - "22" for "Asia/Kabul" - "23" for "Asia/Karachi" - "24" for "Asia/Calcutta" - "25" for "Asia/Pyongyang" - "26" for "Asia/Rangoon" - "27" for "Atlantic/Cape_Verde" - "28" for "Atlantic/South_Georgia" - "29" for "Australia/Adelaide" - "30" for "Australia/Lord_Howe" - "31" for "Europe/Moscow" - "32" for "Pacific/Kiritimati" - "35" for "Pacific/Norfolk" - "36" for "Pacific/Tongatapu"
6153    #[serde(rename = "reportGenerationTimeZoneId")]
6154    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6155    pub report_generation_time_zone_id: Option<i64>,
6156}
6157
6158impl common::Part for ReportsConfiguration {}
6159
6160/// Rich Media Exit Override.
6161///
6162/// This type is not used in any activity, and only used as *part* of another schema.
6163///
6164#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6165#[serde_with::serde_as]
6166#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6167pub struct RichMediaExitOverride {
6168    /// Click-through URL of this rich media exit override. Applicable if the enabled field is set to true.
6169    #[serde(rename = "clickThroughUrl")]
6170    pub click_through_url: Option<ClickThroughUrl>,
6171    /// Whether to use the clickThroughUrl. If false, the creative-level exit will be used.
6172    pub enabled: Option<bool>,
6173    /// ID for the override to refer to a specific exit in the creative.
6174    #[serde(rename = "exitId")]
6175    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6176    pub exit_id: Option<i64>,
6177}
6178
6179impl common::Part for RichMediaExitOverride {}
6180
6181/// A rule associates an asset with a targeting template for asset-level targeting. Applicable to INSTREAM_VIDEO creatives.
6182///
6183/// This type is not used in any activity, and only used as *part* of another schema.
6184///
6185#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6186#[serde_with::serde_as]
6187#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6188pub struct Rule {
6189    /// A creativeAssets[].id. This should refer to one of the parent assets in this creative. This is a required field.
6190    #[serde(rename = "assetId")]
6191    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6192    pub asset_id: Option<i64>,
6193    /// A user-friendly name for this rule. This is a required field.
6194    pub name: Option<String>,
6195    /// A targeting template ID. The targeting from the targeting template will be used to determine whether this asset should be served. This is a required field.
6196    #[serde(rename = "targetingTemplateId")]
6197    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6198    pub targeting_template_id: Option<i64>,
6199}
6200
6201impl common::Part for Rule {}
6202
6203/// Contains properties of a site.
6204///
6205/// # Activities
6206///
6207/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6208/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6209///
6210/// * [get sites](SiteGetCall) (response)
6211/// * [insert sites](SiteInsertCall) (request|response)
6212/// * [list sites](SiteListCall) (none)
6213/// * [patch sites](SitePatchCall) (request|response)
6214/// * [update sites](SiteUpdateCall) (request|response)
6215#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6216#[serde_with::serde_as]
6217#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6218pub struct Site {
6219    /// Account ID of this site. This is a read-only field that can be left blank.
6220    #[serde(rename = "accountId")]
6221    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6222    pub account_id: Option<i64>,
6223    /// Whether this site is approved.
6224    pub approved: Option<bool>,
6225    /// Directory site associated with this site. This is a required field that is read-only after insertion.
6226    #[serde(rename = "directorySiteId")]
6227    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6228    pub directory_site_id: Option<i64>,
6229    /// Dimension value for the ID of the directory site. This is a read-only, auto-generated field.
6230    #[serde(rename = "directorySiteIdDimensionValue")]
6231    pub directory_site_id_dimension_value: Option<DimensionValue>,
6232    /// ID of this site. This is a read-only, auto-generated field.
6233    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6234    pub id: Option<i64>,
6235    /// Dimension value for the ID of this site. This is a read-only, auto-generated field.
6236    #[serde(rename = "idDimensionValue")]
6237    pub id_dimension_value: Option<DimensionValue>,
6238    /// Key name of this site. This is a read-only, auto-generated field.
6239    #[serde(rename = "keyName")]
6240    pub key_name: Option<String>,
6241    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#site".
6242    pub kind: Option<String>,
6243    /// Name of this site.This is a required field. Must be less than 128 characters long. If this site is under a subaccount, the name must be unique among sites of the same subaccount. Otherwise, this site is a top-level site, and the name must be unique among top-level sites of the same account.
6244    pub name: Option<String>,
6245    /// Site contacts.
6246    #[serde(rename = "siteContacts")]
6247    pub site_contacts: Option<Vec<SiteContact>>,
6248    /// Site-wide settings.
6249    #[serde(rename = "siteSettings")]
6250    pub site_settings: Option<SiteSettings>,
6251    /// Subaccount ID of this site. This is a read-only field that can be left blank.
6252    #[serde(rename = "subaccountId")]
6253    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6254    pub subaccount_id: Option<i64>,
6255    /// Default video settings for new placements created under this site. This value will be used to populate the placements.videoSettings field, when no value is specified for the new placement.
6256    #[serde(rename = "videoSettings")]
6257    pub video_settings: Option<SiteVideoSettings>,
6258}
6259
6260impl common::RequestValue for Site {}
6261impl common::Resource for Site {}
6262impl common::ResponseResult for Site {}
6263
6264/// Companion Settings
6265///
6266/// This type is not used in any activity, and only used as *part* of another schema.
6267///
6268#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6269#[serde_with::serde_as]
6270#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6271pub struct SiteCompanionSetting {
6272    /// Whether companions are disabled for this site template.
6273    #[serde(rename = "companionsDisabled")]
6274    pub companions_disabled: Option<bool>,
6275    /// Allowlist of companion sizes to be served via this site template. Set this list to null or empty to serve all companion sizes.
6276    #[serde(rename = "enabledSizes")]
6277    pub enabled_sizes: Option<Vec<Size>>,
6278    /// Whether to serve only static images as companions.
6279    #[serde(rename = "imageOnly")]
6280    pub image_only: Option<bool>,
6281    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#siteCompanionSetting".
6282    pub kind: Option<String>,
6283}
6284
6285impl common::Part for SiteCompanionSetting {}
6286
6287/// Site Contact
6288///
6289/// This type is not used in any activity, and only used as *part* of another schema.
6290///
6291#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6292#[serde_with::serde_as]
6293#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6294pub struct SiteContact {
6295    /// Address of this site contact.
6296    pub address: Option<String>,
6297    /// Site contact type.
6298    #[serde(rename = "contactType")]
6299    pub contact_type: Option<String>,
6300    /// Email address of this site contact. This is a required field.
6301    pub email: Option<String>,
6302    /// First name of this site contact.
6303    #[serde(rename = "firstName")]
6304    pub first_name: Option<String>,
6305    /// ID of this site contact. This is a read-only, auto-generated field.
6306    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6307    pub id: Option<i64>,
6308    /// Last name of this site contact.
6309    #[serde(rename = "lastName")]
6310    pub last_name: Option<String>,
6311    /// Primary phone number of this site contact.
6312    pub phone: Option<String>,
6313    /// Title or designation of this site contact.
6314    pub title: Option<String>,
6315}
6316
6317impl common::Part for SiteContact {}
6318
6319/// Site Settings
6320///
6321/// This type is not used in any activity, and only used as *part* of another schema.
6322///
6323#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6324#[serde_with::serde_as]
6325#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6326pub struct SiteSettings {
6327    /// Whether active view creatives are disabled for this site.
6328    #[serde(rename = "activeViewOptOut")]
6329    pub active_view_opt_out: Option<bool>,
6330    /// Whether this site opts out of ad blocking. When true, ad blocking is disabled for all placements under the site, regardless of the individual placement settings. When false, the campaign and placement settings take effect.
6331    #[serde(rename = "adBlockingOptOut")]
6332    pub ad_blocking_opt_out: Option<bool>,
6333    /// Whether new cookies are disabled for this site.
6334    #[serde(rename = "disableNewCookie")]
6335    pub disable_new_cookie: Option<bool>,
6336    /// Configuration settings for dynamic and image floodlight tags.
6337    #[serde(rename = "tagSetting")]
6338    pub tag_setting: Option<TagSetting>,
6339    /// Whether Verification and ActiveView for in-stream video creatives are disabled by default for new placements created under this site. This value will be used to populate the placement.videoActiveViewOptOut field, when no value is specified for the new placement.
6340    #[serde(rename = "videoActiveViewOptOutTemplate")]
6341    pub video_active_view_opt_out_template: Option<bool>,
6342    /// Default VPAID adapter setting for new placements created under this site. This value will be used to populate the placements.vpaidAdapterChoice field, when no value is specified for the new placement. Controls which VPAID format the measurement adapter will use for in-stream video creatives assigned to the placement. The publisher's specifications will typically determine this setting. For VPAID creatives, the adapter format will match the VPAID format (HTML5 VPAID creatives use the HTML5 adapter). *Note:* Flash is no longer supported. This field now defaults to HTML5 when the following values are provided: FLASH, BOTH.
6343    #[serde(rename = "vpaidAdapterChoiceTemplate")]
6344    pub vpaid_adapter_choice_template: Option<String>,
6345}
6346
6347impl common::Part for SiteSettings {}
6348
6349/// Skippable Settings
6350///
6351/// This type is not used in any activity, and only used as *part* of another schema.
6352///
6353#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6354#[serde_with::serde_as]
6355#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6356pub struct SiteSkippableSetting {
6357    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#siteSkippableSetting".
6358    pub kind: Option<String>,
6359    /// Amount of time to play videos served to this site template before counting a view. Applicable when skippable is true.
6360    #[serde(rename = "progressOffset")]
6361    pub progress_offset: Option<VideoOffset>,
6362    /// Amount of time to play videos served to this site before the skip button should appear. Applicable when skippable is true.
6363    #[serde(rename = "skipOffset")]
6364    pub skip_offset: Option<VideoOffset>,
6365    /// Whether the user can skip creatives served to this site. This will act as default for new placements created under this site.
6366    pub skippable: Option<bool>,
6367}
6368
6369impl common::Part for SiteSkippableSetting {}
6370
6371/// Transcode Settings
6372///
6373/// This type is not used in any activity, and only used as *part* of another schema.
6374///
6375#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6376#[serde_with::serde_as]
6377#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6378pub struct SiteTranscodeSetting {
6379    /// Allowlist of video formats to be served to this site template. Set this list to null or empty to serve all video formats.
6380    #[serde(rename = "enabledVideoFormats")]
6381    pub enabled_video_formats: Option<Vec<i32>>,
6382    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#siteTranscodeSetting".
6383    pub kind: Option<String>,
6384}
6385
6386impl common::Part for SiteTranscodeSetting {}
6387
6388/// Video Settings
6389///
6390/// This type is not used in any activity, and only used as *part* of another schema.
6391///
6392#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6393#[serde_with::serde_as]
6394#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6395pub struct SiteVideoSettings {
6396    /// Settings for the companion creatives of video creatives served to this site.
6397    #[serde(rename = "companionSettings")]
6398    pub companion_settings: Option<SiteCompanionSetting>,
6399    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#siteVideoSettings".
6400    pub kind: Option<String>,
6401    /// Orientation of a site template used for video. This will act as default for new placements created under this site.
6402    pub orientation: Option<String>,
6403    /// Settings for the skippability of video creatives served to this site. This will act as default for new placements created under this site.
6404    #[serde(rename = "skippableSettings")]
6405    pub skippable_settings: Option<SiteSkippableSetting>,
6406    /// Settings for the transcodes of video creatives served to this site. This will act as default for new placements created under this site.
6407    #[serde(rename = "transcodeSettings")]
6408    pub transcode_settings: Option<SiteTranscodeSetting>,
6409}
6410
6411impl common::Part for SiteVideoSettings {}
6412
6413/// Site List Response
6414///
6415/// # Activities
6416///
6417/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6418/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6419///
6420/// * [list sites](SiteListCall) (response)
6421#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6422#[serde_with::serde_as]
6423#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6424pub struct SitesListResponse {
6425    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#sitesListResponse".
6426    pub kind: Option<String>,
6427    /// Pagination token to be used for the next list operation.
6428    #[serde(rename = "nextPageToken")]
6429    pub next_page_token: Option<String>,
6430    /// Site collection.
6431    pub sites: Option<Vec<Site>>,
6432}
6433
6434impl common::ResponseResult for SitesListResponse {}
6435
6436/// Represents the dimensions of ads, placements, creatives, or creative assets.
6437///
6438/// # Activities
6439///
6440/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6441/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6442///
6443/// * [get sizes](SizeGetCall) (response)
6444/// * [insert sizes](SizeInsertCall) (request|response)
6445/// * [list sizes](SizeListCall) (none)
6446#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6447#[serde_with::serde_as]
6448#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6449pub struct Size {
6450    /// Height of this size. Acceptable values are 0 to 32767, inclusive.
6451    pub height: Option<i32>,
6452    /// IAB standard size. This is a read-only, auto-generated field.
6453    pub iab: Option<bool>,
6454    /// ID of this size. This is a read-only, auto-generated field.
6455    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6456    pub id: Option<i64>,
6457    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#size".
6458    pub kind: Option<String>,
6459    /// Width of this size. Acceptable values are 0 to 32767, inclusive.
6460    pub width: Option<i32>,
6461}
6462
6463impl common::RequestValue for Size {}
6464impl common::Resource for Size {}
6465impl common::ResponseResult for Size {}
6466
6467/// Size List Response
6468///
6469/// # Activities
6470///
6471/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6472/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6473///
6474/// * [list sizes](SizeListCall) (response)
6475#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6476#[serde_with::serde_as]
6477#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6478pub struct SizesListResponse {
6479    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#sizesListResponse".
6480    pub kind: Option<String>,
6481    /// Size collection.
6482    pub sizes: Option<Vec<Size>>,
6483}
6484
6485impl common::ResponseResult for SizesListResponse {}
6486
6487/// Skippable Settings
6488///
6489/// This type is not used in any activity, and only used as *part* of another schema.
6490///
6491#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6492#[serde_with::serde_as]
6493#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6494pub struct SkippableSetting {
6495    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#skippableSetting".
6496    pub kind: Option<String>,
6497    /// Amount of time to play videos served to this placement before counting a view. Applicable when skippable is true.
6498    #[serde(rename = "progressOffset")]
6499    pub progress_offset: Option<VideoOffset>,
6500    /// Amount of time to play videos served to this placement before the skip button should appear. Applicable when skippable is true.
6501    #[serde(rename = "skipOffset")]
6502    pub skip_offset: Option<VideoOffset>,
6503    /// Whether the user can skip creatives served to this placement.
6504    pub skippable: Option<bool>,
6505}
6506
6507impl common::Part for SkippableSetting {}
6508
6509/// Represents a sorted dimension.
6510///
6511/// This type is not used in any activity, and only used as *part* of another schema.
6512///
6513#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6514#[serde_with::serde_as]
6515#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6516pub struct SortedDimension {
6517    /// The kind of resource this is, in this case dfareporting#sortedDimension.
6518    pub kind: Option<String>,
6519    /// The name of the dimension.
6520    pub name: Option<String>,
6521    /// An optional sort order for the dimension column.
6522    #[serde(rename = "sortOrder")]
6523    pub sort_order: Option<String>,
6524}
6525
6526impl common::Part for SortedDimension {}
6527
6528/// Contains properties of a Campaign Manager subaccount.
6529///
6530/// # Activities
6531///
6532/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6533/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6534///
6535/// * [get subaccounts](SubaccountGetCall) (response)
6536/// * [insert subaccounts](SubaccountInsertCall) (request|response)
6537/// * [list subaccounts](SubaccountListCall) (none)
6538/// * [patch subaccounts](SubaccountPatchCall) (request|response)
6539/// * [update subaccounts](SubaccountUpdateCall) (request|response)
6540#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6541#[serde_with::serde_as]
6542#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6543pub struct Subaccount {
6544    /// ID of the account that contains this subaccount. This is a read-only field that can be left blank.
6545    #[serde(rename = "accountId")]
6546    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6547    pub account_id: Option<i64>,
6548    /// IDs of the available user role permissions for this subaccount.
6549    #[serde(rename = "availablePermissionIds")]
6550    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
6551    pub available_permission_ids: Option<Vec<i64>>,
6552    /// ID of this subaccount. This is a read-only, auto-generated field.
6553    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6554    pub id: Option<i64>,
6555    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#subaccount".
6556    pub kind: Option<String>,
6557    /// Name of this subaccount. This is a required field. Must be less than 128 characters long and be unique among subaccounts of the same account.
6558    pub name: Option<String>,
6559}
6560
6561impl common::RequestValue for Subaccount {}
6562impl common::Resource for Subaccount {}
6563impl common::ResponseResult for Subaccount {}
6564
6565/// Subaccount List Response
6566///
6567/// # Activities
6568///
6569/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6570/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6571///
6572/// * [list subaccounts](SubaccountListCall) (response)
6573#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6574#[serde_with::serde_as]
6575#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6576pub struct SubaccountsListResponse {
6577    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#subaccountsListResponse".
6578    pub kind: Option<String>,
6579    /// Pagination token to be used for the next list operation.
6580    #[serde(rename = "nextPageToken")]
6581    pub next_page_token: Option<String>,
6582    /// Subaccount collection.
6583    pub subaccounts: Option<Vec<Subaccount>>,
6584}
6585
6586impl common::ResponseResult for SubaccountsListResponse {}
6587
6588/// Placement Tag Data
6589///
6590/// This type is not used in any activity, and only used as *part* of another schema.
6591///
6592#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6593#[serde_with::serde_as]
6594#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6595pub struct TagData {
6596    /// Ad associated with this placement tag. Applicable only when format is PLACEMENT_TAG_TRACKING.
6597    #[serde(rename = "adId")]
6598    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6599    pub ad_id: Option<i64>,
6600    /// Tag string to record a click.
6601    #[serde(rename = "clickTag")]
6602    pub click_tag: Option<String>,
6603    /// Creative associated with this placement tag. Applicable only when format is PLACEMENT_TAG_TRACKING.
6604    #[serde(rename = "creativeId")]
6605    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6606    pub creative_id: Option<i64>,
6607    /// TagData tag format of this tag.
6608    pub format: Option<String>,
6609    /// Tag string for serving an ad.
6610    #[serde(rename = "impressionTag")]
6611    pub impression_tag: Option<String>,
6612}
6613
6614impl common::Part for TagData {}
6615
6616/// Tag Settings
6617///
6618/// This type is not used in any activity, and only used as *part* of another schema.
6619///
6620#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6621#[serde_with::serde_as]
6622#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6623pub struct TagSetting {
6624    /// Additional key-values to be included in tags. Each key-value pair must be of the form key=value, and pairs must be separated by a semicolon (;). Keys and values must not contain commas. For example, id=2;color=red is a valid value for this field.
6625    #[serde(rename = "additionalKeyValues")]
6626    pub additional_key_values: Option<String>,
6627    /// Whether static landing page URLs should be included in the tags. This setting applies only to placements.
6628    #[serde(rename = "includeClickThroughUrls")]
6629    pub include_click_through_urls: Option<bool>,
6630    /// Whether click-tracking string should be included in the tags.
6631    #[serde(rename = "includeClickTracking")]
6632    pub include_click_tracking: Option<bool>,
6633    /// Option specifying how keywords are embedded in ad tags. This setting can be used to specify whether keyword placeholders are inserted in placement tags for this site. Publishers can then add keywords to those placeholders.
6634    #[serde(rename = "keywordOption")]
6635    pub keyword_option: Option<String>,
6636}
6637
6638impl common::Part for TagSetting {}
6639
6640/// Dynamic and Image Tag Settings.
6641///
6642/// This type is not used in any activity, and only used as *part* of another schema.
6643///
6644#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6645#[serde_with::serde_as]
6646#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6647pub struct TagSettings {
6648    /// Whether dynamic floodlight tags are enabled.
6649    #[serde(rename = "dynamicTagEnabled")]
6650    pub dynamic_tag_enabled: Option<bool>,
6651    /// Whether image tags are enabled.
6652    #[serde(rename = "imageTagEnabled")]
6653    pub image_tag_enabled: Option<bool>,
6654}
6655
6656impl common::Part for TagSettings {}
6657
6658/// Target Window.
6659///
6660/// This type is not used in any activity, and only used as *part* of another schema.
6661///
6662#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6663#[serde_with::serde_as]
6664#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6665pub struct TargetWindow {
6666    /// User-entered value.
6667    #[serde(rename = "customHtml")]
6668    pub custom_html: Option<String>,
6669    /// Type of browser window for which the backup image of the flash creative can be displayed.
6670    #[serde(rename = "targetWindowOption")]
6671    pub target_window_option: Option<String>,
6672}
6673
6674impl common::Part for TargetWindow {}
6675
6676/// Contains properties of a targetable remarketing list. Remarketing enables you to create lists of users who have performed specific actions on a site, then target ads to members of those lists. This resource is a read-only view of a remarketing list to be used to faciliate targeting ads to specific lists. Remarketing lists that are owned by your advertisers and those that are shared to your advertisers or account are accessible via this resource. To manage remarketing lists that are owned by your advertisers, use the RemarketingLists resource.
6677///
6678/// # Activities
6679///
6680/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6681/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6682///
6683/// * [get targetable remarketing lists](TargetableRemarketingListGetCall) (response)
6684/// * [list targetable remarketing lists](TargetableRemarketingListListCall) (none)
6685#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6686#[serde_with::serde_as]
6687#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6688pub struct TargetableRemarketingList {
6689    /// Account ID of this remarketing list. This is a read-only, auto-generated field that is only returned in GET requests.
6690    #[serde(rename = "accountId")]
6691    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6692    pub account_id: Option<i64>,
6693    /// Whether this targetable remarketing list is active.
6694    pub active: Option<bool>,
6695    /// Dimension value for the advertiser ID that owns this targetable remarketing list.
6696    #[serde(rename = "advertiserId")]
6697    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6698    pub advertiser_id: Option<i64>,
6699    /// Dimension value for the ID of the advertiser.
6700    #[serde(rename = "advertiserIdDimensionValue")]
6701    pub advertiser_id_dimension_value: Option<DimensionValue>,
6702    /// Targetable remarketing list description.
6703    pub description: Option<String>,
6704    /// Targetable remarketing list ID.
6705    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6706    pub id: Option<i64>,
6707    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#targetableRemarketingList".
6708    pub kind: Option<String>,
6709    /// Number of days that a user should remain in the targetable remarketing list without an impression.
6710    #[serde(rename = "lifeSpan")]
6711    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6712    pub life_span: Option<i64>,
6713    /// Number of users currently in the list. This is a read-only field.
6714    #[serde(rename = "listSize")]
6715    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6716    pub list_size: Option<i64>,
6717    /// Product from which this targetable remarketing list was originated.
6718    #[serde(rename = "listSource")]
6719    pub list_source: Option<String>,
6720    /// Name of the targetable remarketing list. Is no greater than 128 characters long.
6721    pub name: Option<String>,
6722    /// Subaccount ID of this remarketing list. This is a read-only, auto-generated field that is only returned in GET requests.
6723    #[serde(rename = "subaccountId")]
6724    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6725    pub subaccount_id: Option<i64>,
6726}
6727
6728impl common::Resource for TargetableRemarketingList {}
6729impl common::ResponseResult for TargetableRemarketingList {}
6730
6731/// Targetable remarketing list response
6732///
6733/// # Activities
6734///
6735/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6736/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6737///
6738/// * [list targetable remarketing lists](TargetableRemarketingListListCall) (response)
6739#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6740#[serde_with::serde_as]
6741#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6742pub struct TargetableRemarketingListsListResponse {
6743    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#targetableRemarketingListsListResponse".
6744    pub kind: Option<String>,
6745    /// Pagination token to be used for the next list operation.
6746    #[serde(rename = "nextPageToken")]
6747    pub next_page_token: Option<String>,
6748    /// Targetable remarketing list collection.
6749    #[serde(rename = "targetableRemarketingLists")]
6750    pub targetable_remarketing_lists: Option<Vec<TargetableRemarketingList>>,
6751}
6752
6753impl common::ResponseResult for TargetableRemarketingListsListResponse {}
6754
6755/// Contains properties of a targeting template. A targeting template encapsulates targeting information which can be reused across multiple ads.
6756///
6757/// # Activities
6758///
6759/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6760/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6761///
6762/// * [get targeting templates](TargetingTemplateGetCall) (response)
6763/// * [insert targeting templates](TargetingTemplateInsertCall) (request|response)
6764/// * [list targeting templates](TargetingTemplateListCall) (none)
6765/// * [patch targeting templates](TargetingTemplatePatchCall) (request|response)
6766/// * [update targeting templates](TargetingTemplateUpdateCall) (request|response)
6767#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6768#[serde_with::serde_as]
6769#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6770pub struct TargetingTemplate {
6771    /// Account ID of this targeting template. This field, if left unset, will be auto-generated on insert and is read-only after insert.
6772    #[serde(rename = "accountId")]
6773    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6774    pub account_id: Option<i64>,
6775    /// Advertiser ID of this targeting template. This is a required field on insert and is read-only after insert.
6776    #[serde(rename = "advertiserId")]
6777    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6778    pub advertiser_id: Option<i64>,
6779    /// Dimension value for the ID of the advertiser. This is a read-only, auto-generated field.
6780    #[serde(rename = "advertiserIdDimensionValue")]
6781    pub advertiser_id_dimension_value: Option<DimensionValue>,
6782    /// Time and day targeting criteria.
6783    #[serde(rename = "dayPartTargeting")]
6784    pub day_part_targeting: Option<DayPartTargeting>,
6785    /// Geographical targeting criteria.
6786    #[serde(rename = "geoTargeting")]
6787    pub geo_targeting: Option<GeoTargeting>,
6788    /// ID of this targeting template. This is a read-only, auto-generated field.
6789    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6790    pub id: Option<i64>,
6791    /// Key-value targeting criteria.
6792    #[serde(rename = "keyValueTargetingExpression")]
6793    pub key_value_targeting_expression: Option<KeyValueTargetingExpression>,
6794    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#targetingTemplate".
6795    pub kind: Option<String>,
6796    /// Language targeting criteria.
6797    #[serde(rename = "languageTargeting")]
6798    pub language_targeting: Option<LanguageTargeting>,
6799    /// Remarketing list targeting criteria.
6800    #[serde(rename = "listTargetingExpression")]
6801    pub list_targeting_expression: Option<ListTargetingExpression>,
6802    /// Name of this targeting template. This field is required. It must be less than 256 characters long and unique within an advertiser.
6803    pub name: Option<String>,
6804    /// Subaccount ID of this targeting template. This field, if left unset, will be auto-generated on insert and is read-only after insert.
6805    #[serde(rename = "subaccountId")]
6806    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6807    pub subaccount_id: Option<i64>,
6808    /// Technology platform targeting criteria.
6809    #[serde(rename = "technologyTargeting")]
6810    pub technology_targeting: Option<TechnologyTargeting>,
6811}
6812
6813impl common::RequestValue for TargetingTemplate {}
6814impl common::Resource for TargetingTemplate {}
6815impl common::ResponseResult for TargetingTemplate {}
6816
6817/// Targeting Template List Response
6818///
6819/// # Activities
6820///
6821/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6822/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6823///
6824/// * [list targeting templates](TargetingTemplateListCall) (response)
6825#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6826#[serde_with::serde_as]
6827#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6828pub struct TargetingTemplatesListResponse {
6829    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#targetingTemplatesListResponse".
6830    pub kind: Option<String>,
6831    /// Pagination token to be used for the next list operation.
6832    #[serde(rename = "nextPageToken")]
6833    pub next_page_token: Option<String>,
6834    /// Targeting template collection.
6835    #[serde(rename = "targetingTemplates")]
6836    pub targeting_templates: Option<Vec<TargetingTemplate>>,
6837}
6838
6839impl common::ResponseResult for TargetingTemplatesListResponse {}
6840
6841/// Technology Targeting.
6842///
6843/// This type is not used in any activity, and only used as *part* of another schema.
6844///
6845#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6846#[serde_with::serde_as]
6847#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6848pub struct TechnologyTargeting {
6849    /// Browsers that this ad targets. For each browser either set browserVersionId or dartId along with the version numbers. If both are specified, only browserVersionId will be used. The other fields are populated automatically when the ad is inserted or updated.
6850    pub browsers: Option<Vec<Browser>>,
6851    /// Connection types that this ad targets. For each connection type only id is required. The other fields are populated automatically when the ad is inserted or updated.
6852    #[serde(rename = "connectionTypes")]
6853    pub connection_types: Option<Vec<ConnectionType>>,
6854    /// Mobile carriers that this ad targets. For each mobile carrier only id is required, and the other fields are populated automatically when the ad is inserted or updated. If targeting a mobile carrier, do not set targeting for any zip codes.
6855    #[serde(rename = "mobileCarriers")]
6856    pub mobile_carriers: Option<Vec<MobileCarrier>>,
6857    /// Operating system versions that this ad targets. To target all versions, use operatingSystems. For each operating system version, only id is required. The other fields are populated automatically when the ad is inserted or updated. If targeting an operating system version, do not set targeting for the corresponding operating system in operatingSystems.
6858    #[serde(rename = "operatingSystemVersions")]
6859    pub operating_system_versions: Option<Vec<OperatingSystemVersion>>,
6860    /// Operating systems that this ad targets. To target specific versions, use operatingSystemVersions. For each operating system only dartId is required. The other fields are populated automatically when the ad is inserted or updated. If targeting an operating system, do not set targeting for operating system versions for the same operating system.
6861    #[serde(rename = "operatingSystems")]
6862    pub operating_systems: Option<Vec<OperatingSystem>>,
6863    /// Platform types that this ad targets. For example, desktop, mobile, or tablet. For each platform type, only id is required, and the other fields are populated automatically when the ad is inserted or updated.
6864    #[serde(rename = "platformTypes")]
6865    pub platform_types: Option<Vec<PlatformType>>,
6866}
6867
6868impl common::Part for TechnologyTargeting {}
6869
6870/// Third Party Authentication Token
6871///
6872/// This type is not used in any activity, and only used as *part* of another schema.
6873///
6874#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6875#[serde_with::serde_as]
6876#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6877pub struct ThirdPartyAuthenticationToken {
6878    /// Name of the third-party authentication token.
6879    pub name: Option<String>,
6880    /// Value of the third-party authentication token. This is a read-only, auto-generated field.
6881    pub value: Option<String>,
6882}
6883
6884impl common::Part for ThirdPartyAuthenticationToken {}
6885
6886/// Third-party Tracking URL.
6887///
6888/// This type is not used in any activity, and only used as *part* of another schema.
6889///
6890#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6891#[serde_with::serde_as]
6892#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6893pub struct ThirdPartyTrackingUrl {
6894    /// Third-party URL type for in-stream video and in-stream audio creatives.
6895    #[serde(rename = "thirdPartyUrlType")]
6896    pub third_party_url_type: Option<String>,
6897    /// URL for the specified third-party URL type.
6898    pub url: Option<String>,
6899}
6900
6901impl common::Part for ThirdPartyTrackingUrl {}
6902
6903/// Transcode Settings
6904///
6905/// This type is not used in any activity, and only used as *part* of another schema.
6906///
6907#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6908#[serde_with::serde_as]
6909#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6910pub struct TranscodeSetting {
6911    /// Allowlist of video formats to be served to this placement. Set this list to null or empty to serve all video formats.
6912    #[serde(rename = "enabledVideoFormats")]
6913    pub enabled_video_formats: Option<Vec<i32>>,
6914    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#transcodeSetting".
6915    pub kind: Option<String>,
6916}
6917
6918impl common::Part for TranscodeSetting {}
6919
6920/// A Universal Ad ID as per the VAST 4.0 spec. Applicable to the following creative types: INSTREAM_AUDIO, INSTREAM_VIDEO and VPAID.
6921///
6922/// This type is not used in any activity, and only used as *part* of another schema.
6923///
6924#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6925#[serde_with::serde_as]
6926#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6927pub struct UniversalAdId {
6928    /// Registry used for the Ad ID value.
6929    pub registry: Option<String>,
6930    /// ID value for this creative. Only alphanumeric characters and the following symbols are valid: "_/\-". Maximum length is 64 characters. Read only when registry is DCM.
6931    pub value: Option<String>,
6932}
6933
6934impl common::Part for UniversalAdId {}
6935
6936/// User Defined Variable configuration.
6937///
6938/// This type is not used in any activity, and only used as *part* of another schema.
6939///
6940#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6941#[serde_with::serde_as]
6942#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6943pub struct UserDefinedVariableConfiguration {
6944    /// Data type for the variable. This is a required field.
6945    #[serde(rename = "dataType")]
6946    pub data_type: Option<String>,
6947    /// User-friendly name for the variable which will appear in reports. This is a required field, must be less than 64 characters long, and cannot contain the following characters: ""<>".
6948    #[serde(rename = "reportName")]
6949    pub report_name: Option<String>,
6950    /// Variable name in the tag. This is a required field.
6951    #[serde(rename = "variableType")]
6952    pub variable_type: Option<String>,
6953}
6954
6955impl common::Part for UserDefinedVariableConfiguration {}
6956
6957/// A UserProfile resource lets you list all DFA user profiles that are associated with a Google user account. The profile_id needs to be specified in other API requests.
6958///
6959/// # Activities
6960///
6961/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
6962/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
6963///
6964/// * [get user profiles](UserProfileGetCall) (response)
6965/// * [list user profiles](UserProfileListCall) (none)
6966#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
6967#[serde_with::serde_as]
6968#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
6969pub struct UserProfile {
6970    /// The account ID to which this profile belongs.
6971    #[serde(rename = "accountId")]
6972    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6973    pub account_id: Option<i64>,
6974    /// The account name this profile belongs to.
6975    #[serde(rename = "accountName")]
6976    pub account_name: Option<String>,
6977    /// Etag of this resource.
6978    pub etag: Option<String>,
6979    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#userProfile".
6980    pub kind: Option<String>,
6981    /// The unique ID of the user profile.
6982    #[serde(rename = "profileId")]
6983    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6984    pub profile_id: Option<i64>,
6985    /// The sub account ID this profile belongs to if applicable.
6986    #[serde(rename = "subAccountId")]
6987    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
6988    pub sub_account_id: Option<i64>,
6989    /// The sub account name this profile belongs to if applicable.
6990    #[serde(rename = "subAccountName")]
6991    pub sub_account_name: Option<String>,
6992    /// The user name.
6993    #[serde(rename = "userName")]
6994    pub user_name: Option<String>,
6995}
6996
6997impl common::Resource for UserProfile {}
6998impl common::ResponseResult for UserProfile {}
6999
7000/// Represents the list of user profiles.
7001///
7002/// # Activities
7003///
7004/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
7005/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
7006///
7007/// * [list user profiles](UserProfileListCall) (response)
7008#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7009#[serde_with::serde_as]
7010#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7011pub struct UserProfileList {
7012    /// Etag of this resource.
7013    pub etag: Option<String>,
7014    /// The user profiles returned in this response.
7015    pub items: Option<Vec<UserProfile>>,
7016    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#userProfileList".
7017    pub kind: Option<String>,
7018}
7019
7020impl common::ResponseResult for UserProfileList {}
7021
7022/// Contains properties of auser role, which is used to manage user access.
7023///
7024/// # Activities
7025///
7026/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
7027/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
7028///
7029/// * [delete user roles](UserRoleDeleteCall) (none)
7030/// * [get user roles](UserRoleGetCall) (response)
7031/// * [insert user roles](UserRoleInsertCall) (request|response)
7032/// * [list user roles](UserRoleListCall) (none)
7033/// * [patch user roles](UserRolePatchCall) (request|response)
7034/// * [update user roles](UserRoleUpdateCall) (request|response)
7035#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7036#[serde_with::serde_as]
7037#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7038pub struct UserRole {
7039    /// Account ID of this user role. This is a read-only field that can be left blank.
7040    #[serde(rename = "accountId")]
7041    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
7042    pub account_id: Option<i64>,
7043    /// Whether this is a default user role. Default user roles are created by the system for the account/subaccount and cannot be modified or deleted. Each default user role comes with a basic set of preassigned permissions.
7044    #[serde(rename = "defaultUserRole")]
7045    pub default_user_role: Option<bool>,
7046    /// ID of this user role. This is a read-only, auto-generated field.
7047    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
7048    pub id: Option<i64>,
7049    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#userRole".
7050    pub kind: Option<String>,
7051    /// Name of this user role. This is a required field. Must be less than 256 characters long. If this user role is under a subaccount, the name must be unique among sites of the same subaccount. Otherwise, this user role is a top-level user role, and the name must be unique among top-level user roles of the same account.
7052    pub name: Option<String>,
7053    /// ID of the user role that this user role is based on or copied from. This is a required field.
7054    #[serde(rename = "parentUserRoleId")]
7055    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
7056    pub parent_user_role_id: Option<i64>,
7057    /// List of permissions associated with this user role.
7058    pub permissions: Option<Vec<UserRolePermission>>,
7059    /// Subaccount ID of this user role. This is a read-only field that can be left blank.
7060    #[serde(rename = "subaccountId")]
7061    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
7062    pub subaccount_id: Option<i64>,
7063}
7064
7065impl common::RequestValue for UserRole {}
7066impl common::Resource for UserRole {}
7067impl common::ResponseResult for UserRole {}
7068
7069/// Contains properties of a user role permission.
7070///
7071/// # Activities
7072///
7073/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
7074/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
7075///
7076/// * [get user role permissions](UserRolePermissionGetCall) (response)
7077/// * [list user role permissions](UserRolePermissionListCall) (none)
7078#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7079#[serde_with::serde_as]
7080#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7081pub struct UserRolePermission {
7082    /// Levels of availability for a user role permission.
7083    pub availability: Option<String>,
7084    /// ID of this user role permission.
7085    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
7086    pub id: Option<i64>,
7087    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#userRolePermission".
7088    pub kind: Option<String>,
7089    /// Name of this user role permission.
7090    pub name: Option<String>,
7091    /// ID of the permission group that this user role permission belongs to.
7092    #[serde(rename = "permissionGroupId")]
7093    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
7094    pub permission_group_id: Option<i64>,
7095}
7096
7097impl common::Resource for UserRolePermission {}
7098impl common::ResponseResult for UserRolePermission {}
7099
7100/// Represents a grouping of related user role permissions.
7101///
7102/// # Activities
7103///
7104/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
7105/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
7106///
7107/// * [get user role permission groups](UserRolePermissionGroupGetCall) (response)
7108/// * [list user role permission groups](UserRolePermissionGroupListCall) (none)
7109#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7110#[serde_with::serde_as]
7111#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7112pub struct UserRolePermissionGroup {
7113    /// ID of this user role permission.
7114    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
7115    pub id: Option<i64>,
7116    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#userRolePermissionGroup".
7117    pub kind: Option<String>,
7118    /// Name of this user role permission group.
7119    pub name: Option<String>,
7120}
7121
7122impl common::Resource for UserRolePermissionGroup {}
7123impl common::ResponseResult for UserRolePermissionGroup {}
7124
7125/// User Role Permission Group List Response
7126///
7127/// # Activities
7128///
7129/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
7130/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
7131///
7132/// * [list user role permission groups](UserRolePermissionGroupListCall) (response)
7133#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7134#[serde_with::serde_as]
7135#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7136pub struct UserRolePermissionGroupsListResponse {
7137    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#userRolePermissionGroupsListResponse".
7138    pub kind: Option<String>,
7139    /// User role permission group collection.
7140    #[serde(rename = "userRolePermissionGroups")]
7141    pub user_role_permission_groups: Option<Vec<UserRolePermissionGroup>>,
7142}
7143
7144impl common::ResponseResult for UserRolePermissionGroupsListResponse {}
7145
7146/// User Role Permission List Response
7147///
7148/// # Activities
7149///
7150/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
7151/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
7152///
7153/// * [list user role permissions](UserRolePermissionListCall) (response)
7154#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7155#[serde_with::serde_as]
7156#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7157pub struct UserRolePermissionsListResponse {
7158    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#userRolePermissionsListResponse".
7159    pub kind: Option<String>,
7160    /// User role permission collection.
7161    #[serde(rename = "userRolePermissions")]
7162    pub user_role_permissions: Option<Vec<UserRolePermission>>,
7163}
7164
7165impl common::ResponseResult for UserRolePermissionsListResponse {}
7166
7167/// User Role List Response
7168///
7169/// # Activities
7170///
7171/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
7172/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
7173///
7174/// * [list user roles](UserRoleListCall) (response)
7175#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7176#[serde_with::serde_as]
7177#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7178pub struct UserRolesListResponse {
7179    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#userRolesListResponse".
7180    pub kind: Option<String>,
7181    /// Pagination token to be used for the next list operation.
7182    #[serde(rename = "nextPageToken")]
7183    pub next_page_token: Option<String>,
7184    /// User role collection.
7185    #[serde(rename = "userRoles")]
7186    pub user_roles: Option<Vec<UserRole>>,
7187}
7188
7189impl common::ResponseResult for UserRolesListResponse {}
7190
7191/// Contains information about supported video formats.
7192///
7193/// # Activities
7194///
7195/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
7196/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
7197///
7198/// * [get video formats](VideoFormatGetCall) (response)
7199/// * [list video formats](VideoFormatListCall) (none)
7200#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7201#[serde_with::serde_as]
7202#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7203pub struct VideoFormat {
7204    /// File type of the video format.
7205    #[serde(rename = "fileType")]
7206    pub file_type: Option<String>,
7207    /// ID of the video format.
7208    pub id: Option<i32>,
7209    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#videoFormat".
7210    pub kind: Option<String>,
7211    /// The resolution of this video format.
7212    pub resolution: Option<Size>,
7213    /// The target bit rate of this video format.
7214    #[serde(rename = "targetBitRate")]
7215    pub target_bit_rate: Option<i32>,
7216}
7217
7218impl common::Resource for VideoFormat {}
7219impl common::ResponseResult for VideoFormat {}
7220
7221/// Video Format List Response
7222///
7223/// # Activities
7224///
7225/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
7226/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
7227///
7228/// * [list video formats](VideoFormatListCall) (response)
7229#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7230#[serde_with::serde_as]
7231#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7232pub struct VideoFormatsListResponse {
7233    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#videoFormatsListResponse".
7234    pub kind: Option<String>,
7235    /// Video format collection.
7236    #[serde(rename = "videoFormats")]
7237    pub video_formats: Option<Vec<VideoFormat>>,
7238}
7239
7240impl common::ResponseResult for VideoFormatsListResponse {}
7241
7242/// Video Offset
7243///
7244/// This type is not used in any activity, and only used as *part* of another schema.
7245///
7246#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7247#[serde_with::serde_as]
7248#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7249pub struct VideoOffset {
7250    /// Duration, as a percentage of video duration. Do not set when offsetSeconds is set. Acceptable values are 0 to 100, inclusive.
7251    #[serde(rename = "offsetPercentage")]
7252    pub offset_percentage: Option<i32>,
7253    /// Duration, in seconds. Do not set when offsetPercentage is set. Acceptable values are 0 to 86399, inclusive.
7254    #[serde(rename = "offsetSeconds")]
7255    pub offset_seconds: Option<i32>,
7256}
7257
7258impl common::Part for VideoOffset {}
7259
7260/// Video Settings
7261///
7262/// This type is not used in any activity, and only used as *part* of another schema.
7263///
7264#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7265#[serde_with::serde_as]
7266#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7267pub struct VideoSettings {
7268    /// Settings for the companion creatives of video creatives served to this placement.
7269    #[serde(rename = "companionSettings")]
7270    pub companion_settings: Option<CompanionSetting>,
7271    /// Identifies what kind of resource this is. Value: the fixed string "dfareporting#videoSettings".
7272    pub kind: Option<String>,
7273    /// Orientation of a video placement. If this value is set, placement will return assets matching the specified orientation.
7274    pub orientation: Option<String>,
7275    /// Settings for the skippability of video creatives served to this placement. If this object is provided, the creative-level skippable settings will be overridden.
7276    #[serde(rename = "skippableSettings")]
7277    pub skippable_settings: Option<SkippableSetting>,
7278    /// Settings for the transcodes of video creatives served to this placement. If this object is provided, the creative-level transcode settings will be overridden.
7279    #[serde(rename = "transcodeSettings")]
7280    pub transcode_settings: Option<TranscodeSetting>,
7281}
7282
7283impl common::Part for VideoSettings {}
7284
7285/// The URLs where the completed report file can be downloaded.
7286///
7287/// This type is not used in any activity, and only used as *part* of another schema.
7288///
7289#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7290#[serde_with::serde_as]
7291#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7292pub struct FileUrls {
7293    /// The URL for downloading the report data through the API.
7294    #[serde(rename = "apiUrl")]
7295    pub api_url: Option<String>,
7296    /// The URL for downloading the report data through a browser.
7297    #[serde(rename = "browserUrl")]
7298    pub browser_url: Option<String>,
7299}
7300
7301impl common::NestedType for FileUrls {}
7302impl common::Part for FileUrls {}
7303
7304/// The report criteria for a report of type "STANDARD".
7305///
7306/// This type is not used in any activity, and only used as *part* of another schema.
7307///
7308#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7309#[serde_with::serde_as]
7310#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7311pub struct ReportCriteria {
7312    /// Activity group.
7313    pub activities: Option<Activities>,
7314    /// Custom Rich Media Events group.
7315    #[serde(rename = "customRichMediaEvents")]
7316    pub custom_rich_media_events: Option<CustomRichMediaEvents>,
7317    /// The date range for which this report should be run.
7318    #[serde(rename = "dateRange")]
7319    pub date_range: Option<DateRange>,
7320    /// The list of filters on which dimensions are filtered. Filters for different dimensions are ANDed, filters for the same dimension are grouped together and ORed.
7321    #[serde(rename = "dimensionFilters")]
7322    pub dimension_filters: Option<Vec<DimensionValue>>,
7323    /// The list of standard dimensions the report should include.
7324    pub dimensions: Option<Vec<SortedDimension>>,
7325    /// The list of names of metrics the report should include.
7326    #[serde(rename = "metricNames")]
7327    pub metric_names: Option<Vec<String>>,
7328}
7329
7330impl common::NestedType for ReportCriteria {}
7331impl common::Part for ReportCriteria {}
7332
7333/// The report criteria for a report of type "CROSS_DIMENSION_REACH".
7334///
7335/// This type is not used in any activity, and only used as *part* of another schema.
7336///
7337#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7338#[serde_with::serde_as]
7339#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7340pub struct ReportCrossDimensionReachCriteria {
7341    /// The list of dimensions the report should include.
7342    pub breakdown: Option<Vec<SortedDimension>>,
7343    /// The date range this report should be run for.
7344    #[serde(rename = "dateRange")]
7345    pub date_range: Option<DateRange>,
7346    /// The dimension option.
7347    pub dimension: Option<String>,
7348    /// The list of filters on which dimensions are filtered.
7349    #[serde(rename = "dimensionFilters")]
7350    pub dimension_filters: Option<Vec<DimensionValue>>,
7351    /// The list of names of metrics the report should include.
7352    #[serde(rename = "metricNames")]
7353    pub metric_names: Option<Vec<String>>,
7354    /// The list of names of overlap metrics the report should include.
7355    #[serde(rename = "overlapMetricNames")]
7356    pub overlap_metric_names: Option<Vec<String>>,
7357    /// Whether the report is pivoted or not. Defaults to true.
7358    pub pivoted: Option<bool>,
7359}
7360
7361impl common::NestedType for ReportCrossDimensionReachCriteria {}
7362impl common::Part for ReportCrossDimensionReachCriteria {}
7363
7364/// The report's email delivery settings.
7365///
7366/// This type is not used in any activity, and only used as *part* of another schema.
7367///
7368#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7369#[serde_with::serde_as]
7370#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7371pub struct ReportDelivery {
7372    /// Whether the report should be emailed to the report owner.
7373    #[serde(rename = "emailOwner")]
7374    pub email_owner: Option<bool>,
7375    /// The type of delivery for the owner to receive, if enabled.
7376    #[serde(rename = "emailOwnerDeliveryType")]
7377    pub email_owner_delivery_type: Option<String>,
7378    /// The message to be sent with each email.
7379    pub message: Option<String>,
7380    /// The list of recipients to which to email the report.
7381    pub recipients: Option<Vec<Recipient>>,
7382}
7383
7384impl common::NestedType for ReportDelivery {}
7385impl common::Part for ReportDelivery {}
7386
7387/// The report criteria for a report of type "FLOODLIGHT".
7388///
7389/// This type is not used in any activity, and only used as *part* of another schema.
7390///
7391#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7392#[serde_with::serde_as]
7393#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7394pub struct ReportFloodlightCriteria {
7395    /// The list of custom rich media events to include.
7396    #[serde(rename = "customRichMediaEvents")]
7397    pub custom_rich_media_events: Option<Vec<DimensionValue>>,
7398    /// The date range this report should be run for.
7399    #[serde(rename = "dateRange")]
7400    pub date_range: Option<DateRange>,
7401    /// The list of filters on which dimensions are filtered. Filters for different dimensions are ANDed, filters for the same dimension are grouped together and ORed.
7402    #[serde(rename = "dimensionFilters")]
7403    pub dimension_filters: Option<Vec<DimensionValue>>,
7404    /// The list of dimensions the report should include.
7405    pub dimensions: Option<Vec<SortedDimension>>,
7406    /// The floodlight ID for which to show data in this report. All advertisers associated with that ID will automatically be added. The dimension of the value needs to be 'dfa:floodlightConfigId'.
7407    #[serde(rename = "floodlightConfigId")]
7408    pub floodlight_config_id: Option<DimensionValue>,
7409    /// The list of names of metrics the report should include.
7410    #[serde(rename = "metricNames")]
7411    pub metric_names: Option<Vec<String>>,
7412    /// The properties of the report.
7413    #[serde(rename = "reportProperties")]
7414    pub report_properties: Option<ReportFloodlightCriteriaReportProperties>,
7415}
7416
7417impl common::NestedType for ReportFloodlightCriteria {}
7418impl common::Part for ReportFloodlightCriteria {}
7419
7420/// The properties of the report.
7421///
7422/// This type is not used in any activity, and only used as *part* of another schema.
7423///
7424#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7425#[serde_with::serde_as]
7426#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7427pub struct ReportFloodlightCriteriaReportProperties {
7428    /// Include conversions that have no cookie, but do have an exposure path.
7429    #[serde(rename = "includeAttributedIPConversions")]
7430    pub include_attributed_ip_conversions: Option<bool>,
7431    /// Include conversions of users with a DoubleClick cookie but without an exposure. That means the user did not click or see an ad from the advertiser within the Floodlight group, or that the interaction happened outside the lookback window.
7432    #[serde(rename = "includeUnattributedCookieConversions")]
7433    pub include_unattributed_cookie_conversions: Option<bool>,
7434    /// Include conversions that have no associated cookies and no exposures. It’s therefore impossible to know how the user was exposed to your ads during the lookback window prior to a conversion.
7435    #[serde(rename = "includeUnattributedIPConversions")]
7436    pub include_unattributed_ip_conversions: Option<bool>,
7437}
7438
7439impl common::NestedType for ReportFloodlightCriteriaReportProperties {}
7440impl common::Part for ReportFloodlightCriteriaReportProperties {}
7441
7442/// The report criteria for a report of type "PATH_TO_CONVERSION".
7443///
7444/// This type is not used in any activity, and only used as *part* of another schema.
7445///
7446#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7447#[serde_with::serde_as]
7448#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7449pub struct ReportPathToConversionCriteria {
7450    /// The list of 'dfa:activity' values to filter on.
7451    #[serde(rename = "activityFilters")]
7452    pub activity_filters: Option<Vec<DimensionValue>>,
7453    /// The list of conversion dimensions the report should include.
7454    #[serde(rename = "conversionDimensions")]
7455    pub conversion_dimensions: Option<Vec<SortedDimension>>,
7456    /// The list of custom floodlight variables the report should include.
7457    #[serde(rename = "customFloodlightVariables")]
7458    pub custom_floodlight_variables: Option<Vec<SortedDimension>>,
7459    /// The list of custom rich media events to include.
7460    #[serde(rename = "customRichMediaEvents")]
7461    pub custom_rich_media_events: Option<Vec<DimensionValue>>,
7462    /// The date range this report should be run for.
7463    #[serde(rename = "dateRange")]
7464    pub date_range: Option<DateRange>,
7465    /// The floodlight ID for which to show data in this report. All advertisers associated with that ID will automatically be added. The dimension of the value needs to be 'dfa:floodlightConfigId'.
7466    #[serde(rename = "floodlightConfigId")]
7467    pub floodlight_config_id: Option<DimensionValue>,
7468    /// The list of names of metrics the report should include.
7469    #[serde(rename = "metricNames")]
7470    pub metric_names: Option<Vec<String>>,
7471    /// The list of per interaction dimensions the report should include.
7472    #[serde(rename = "perInteractionDimensions")]
7473    pub per_interaction_dimensions: Option<Vec<SortedDimension>>,
7474    /// The properties of the report.
7475    #[serde(rename = "reportProperties")]
7476    pub report_properties: Option<ReportPathToConversionCriteriaReportProperties>,
7477}
7478
7479impl common::NestedType for ReportPathToConversionCriteria {}
7480impl common::Part for ReportPathToConversionCriteria {}
7481
7482/// The properties of the report.
7483///
7484/// This type is not used in any activity, and only used as *part* of another schema.
7485///
7486#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7487#[serde_with::serde_as]
7488#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7489pub struct ReportPathToConversionCriteriaReportProperties {
7490    /// CM360 checks to see if a click interaction occurred within the specified period of time before a conversion. By default the value is pulled from Floodlight or you can manually enter a custom value. Valid values: 1-90.
7491    #[serde(rename = "clicksLookbackWindow")]
7492    pub clicks_lookback_window: Option<i32>,
7493    /// CM360 checks to see if an impression interaction occurred within the specified period of time before a conversion. By default the value is pulled from Floodlight or you can manually enter a custom value. Valid values: 1-90.
7494    #[serde(rename = "impressionsLookbackWindow")]
7495    pub impressions_lookback_window: Option<i32>,
7496    /// Deprecated: has no effect.
7497    #[serde(rename = "includeAttributedIPConversions")]
7498    pub include_attributed_ip_conversions: Option<bool>,
7499    /// Include conversions of users with a DoubleClick cookie but without an exposure. That means the user did not click or see an ad from the advertiser within the Floodlight group, or that the interaction happened outside the lookback window.
7500    #[serde(rename = "includeUnattributedCookieConversions")]
7501    pub include_unattributed_cookie_conversions: Option<bool>,
7502    /// Include conversions that have no associated cookies and no exposures. It’s therefore impossible to know how the user was exposed to your ads during the lookback window prior to a conversion.
7503    #[serde(rename = "includeUnattributedIPConversions")]
7504    pub include_unattributed_ip_conversions: Option<bool>,
7505    /// The maximum number of click interactions to include in the report. Advertisers currently paying for E2C reports get up to 200 (100 clicks, 100 impressions). If another advertiser in your network is paying for E2C, you can have up to 5 total exposures per report.
7506    #[serde(rename = "maximumClickInteractions")]
7507    pub maximum_click_interactions: Option<i32>,
7508    /// The maximum number of click interactions to include in the report. Advertisers currently paying for E2C reports get up to 200 (100 clicks, 100 impressions). If another advertiser in your network is paying for E2C, you can have up to 5 total exposures per report.
7509    #[serde(rename = "maximumImpressionInteractions")]
7510    pub maximum_impression_interactions: Option<i32>,
7511    /// The maximum amount of time that can take place between interactions (clicks or impressions) by the same user. Valid values: 1-90.
7512    #[serde(rename = "maximumInteractionGap")]
7513    pub maximum_interaction_gap: Option<i32>,
7514    /// Enable pivoting on interaction path.
7515    #[serde(rename = "pivotOnInteractionPath")]
7516    pub pivot_on_interaction_path: Option<bool>,
7517}
7518
7519impl common::NestedType for ReportPathToConversionCriteriaReportProperties {}
7520impl common::Part for ReportPathToConversionCriteriaReportProperties {}
7521
7522/// The report criteria for a report of type "REACH".
7523///
7524/// This type is not used in any activity, and only used as *part* of another schema.
7525///
7526#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7527#[serde_with::serde_as]
7528#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7529pub struct ReportReachCriteria {
7530    /// Activity group.
7531    pub activities: Option<Activities>,
7532    /// Custom Rich Media Events group.
7533    #[serde(rename = "customRichMediaEvents")]
7534    pub custom_rich_media_events: Option<CustomRichMediaEvents>,
7535    /// The date range this report should be run for.
7536    #[serde(rename = "dateRange")]
7537    pub date_range: Option<DateRange>,
7538    /// The list of filters on which dimensions are filtered. Filters for different dimensions are ANDed, filters for the same dimension are grouped together and ORed.
7539    #[serde(rename = "dimensionFilters")]
7540    pub dimension_filters: Option<Vec<DimensionValue>>,
7541    /// The list of dimensions the report should include.
7542    pub dimensions: Option<Vec<SortedDimension>>,
7543    /// Whether to enable all reach dimension combinations in the report. Defaults to false. If enabled, the date range of the report should be within the last 42 days.
7544    #[serde(rename = "enableAllDimensionCombinations")]
7545    pub enable_all_dimension_combinations: Option<bool>,
7546    /// The list of names of metrics the report should include.
7547    #[serde(rename = "metricNames")]
7548    pub metric_names: Option<Vec<String>>,
7549    /// The list of names of Reach By Frequency metrics the report should include.
7550    #[serde(rename = "reachByFrequencyMetricNames")]
7551    pub reach_by_frequency_metric_names: Option<Vec<String>>,
7552}
7553
7554impl common::NestedType for ReportReachCriteria {}
7555impl common::Part for ReportReachCriteria {}
7556
7557/// The report's schedule. Can only be set if the report's 'dateRange' is a relative date range and the relative date range is not "TODAY".
7558///
7559/// This type is not used in any activity, and only used as *part* of another schema.
7560///
7561#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
7562#[serde_with::serde_as]
7563#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
7564pub struct ReportSchedule {
7565    /// Whether the schedule is active or not. Must be set to either true or false.
7566    pub active: Option<bool>,
7567    /// Defines every how many days, weeks or months the report should be run. Needs to be set when "repeats" is either "DAILY", "WEEKLY" or "MONTHLY".
7568    pub every: Option<i32>,
7569    /// no description provided
7570    #[serde(rename = "expirationDate")]
7571    pub expiration_date: Option<chrono::NaiveDate>,
7572    /// The interval for which the report is repeated. Note: - "DAILY" also requires field "every" to be set. - "WEEKLY" also requires fields "every" and "repeatsOnWeekDays" to be set. - "MONTHLY" also requires fields "every" and "runsOnDayOfMonth" to be set.
7573    pub repeats: Option<String>,
7574    /// List of week days "WEEKLY" on which scheduled reports should run.
7575    #[serde(rename = "repeatsOnWeekDays")]
7576    pub repeats_on_week_days: Option<Vec<String>>,
7577    /// Enum to define for "MONTHLY" scheduled reports whether reports should be repeated on the same day of the month as "startDate" or the same day of the week of the month. Example: If 'startDate' is Monday, April 2nd 2012 (2012-04-02), "DAY_OF_MONTH" would run subsequent reports on the 2nd of every Month, and "WEEK_OF_MONTH" would run subsequent reports on the first Monday of the month.
7578    #[serde(rename = "runsOnDayOfMonth")]
7579    pub runs_on_day_of_month: Option<String>,
7580    /// no description provided
7581    #[serde(rename = "startDate")]
7582    pub start_date: Option<chrono::NaiveDate>,
7583}
7584
7585impl common::NestedType for ReportSchedule {}
7586impl common::Part for ReportSchedule {}
7587
7588// ###################
7589// MethodBuilders ###
7590// #################
7591
7592/// A builder providing access to all methods supported on *accountActiveAdSummary* resources.
7593/// It is not used directly, but through the [`Dfareporting`] hub.
7594///
7595/// # Example
7596///
7597/// Instantiate a resource builder
7598///
7599/// ```test_harness,no_run
7600/// extern crate hyper;
7601/// extern crate hyper_rustls;
7602/// extern crate google_dfareporting3d3 as dfareporting3d3;
7603///
7604/// # async fn dox() {
7605/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7606///
7607/// let secret: yup_oauth2::ApplicationSecret = Default::default();
7608/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7609///     secret,
7610///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7611/// ).build().await.unwrap();
7612///
7613/// let client = hyper_util::client::legacy::Client::builder(
7614///     hyper_util::rt::TokioExecutor::new()
7615/// )
7616/// .build(
7617///     hyper_rustls::HttpsConnectorBuilder::new()
7618///         .with_native_roots()
7619///         .unwrap()
7620///         .https_or_http()
7621///         .enable_http1()
7622///         .build()
7623/// );
7624/// let mut hub = Dfareporting::new(client, auth);
7625/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
7626/// // like `get(...)`
7627/// // to build up your call.
7628/// let rb = hub.account_active_ad_summaries();
7629/// # }
7630/// ```
7631pub struct AccountActiveAdSummaryMethods<'a, C>
7632where
7633    C: 'a,
7634{
7635    hub: &'a Dfareporting<C>,
7636}
7637
7638impl<'a, C> common::MethodsBuilder for AccountActiveAdSummaryMethods<'a, C> {}
7639
7640impl<'a, C> AccountActiveAdSummaryMethods<'a, C> {
7641    /// Create a builder to help you perform the following task:
7642    ///
7643    /// Gets the account's active ad summary by account ID.
7644    ///
7645    /// # Arguments
7646    ///
7647    /// * `profileId` - User profile ID associated with this request.
7648    /// * `summaryAccountId` - Account ID.
7649    pub fn get(
7650        &self,
7651        profile_id: i64,
7652        summary_account_id: i64,
7653    ) -> AccountActiveAdSummaryGetCall<'a, C> {
7654        AccountActiveAdSummaryGetCall {
7655            hub: self.hub,
7656            _profile_id: profile_id,
7657            _summary_account_id: summary_account_id,
7658            _delegate: Default::default(),
7659            _additional_params: Default::default(),
7660            _scopes: Default::default(),
7661        }
7662    }
7663}
7664
7665/// A builder providing access to all methods supported on *accountPermissionGroup* resources.
7666/// It is not used directly, but through the [`Dfareporting`] hub.
7667///
7668/// # Example
7669///
7670/// Instantiate a resource builder
7671///
7672/// ```test_harness,no_run
7673/// extern crate hyper;
7674/// extern crate hyper_rustls;
7675/// extern crate google_dfareporting3d3 as dfareporting3d3;
7676///
7677/// # async fn dox() {
7678/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7679///
7680/// let secret: yup_oauth2::ApplicationSecret = Default::default();
7681/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7682///     secret,
7683///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7684/// ).build().await.unwrap();
7685///
7686/// let client = hyper_util::client::legacy::Client::builder(
7687///     hyper_util::rt::TokioExecutor::new()
7688/// )
7689/// .build(
7690///     hyper_rustls::HttpsConnectorBuilder::new()
7691///         .with_native_roots()
7692///         .unwrap()
7693///         .https_or_http()
7694///         .enable_http1()
7695///         .build()
7696/// );
7697/// let mut hub = Dfareporting::new(client, auth);
7698/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
7699/// // like `get(...)` and `list(...)`
7700/// // to build up your call.
7701/// let rb = hub.account_permission_groups();
7702/// # }
7703/// ```
7704pub struct AccountPermissionGroupMethods<'a, C>
7705where
7706    C: 'a,
7707{
7708    hub: &'a Dfareporting<C>,
7709}
7710
7711impl<'a, C> common::MethodsBuilder for AccountPermissionGroupMethods<'a, C> {}
7712
7713impl<'a, C> AccountPermissionGroupMethods<'a, C> {
7714    /// Create a builder to help you perform the following task:
7715    ///
7716    /// Gets one account permission group by ID.
7717    ///
7718    /// # Arguments
7719    ///
7720    /// * `profileId` - User profile ID associated with this request.
7721    /// * `id` - Account permission group ID.
7722    pub fn get(&self, profile_id: i64, id: i64) -> AccountPermissionGroupGetCall<'a, C> {
7723        AccountPermissionGroupGetCall {
7724            hub: self.hub,
7725            _profile_id: profile_id,
7726            _id: id,
7727            _delegate: Default::default(),
7728            _additional_params: Default::default(),
7729            _scopes: Default::default(),
7730        }
7731    }
7732
7733    /// Create a builder to help you perform the following task:
7734    ///
7735    /// Retrieves the list of account permission groups.
7736    ///
7737    /// # Arguments
7738    ///
7739    /// * `profileId` - User profile ID associated with this request.
7740    pub fn list(&self, profile_id: i64) -> AccountPermissionGroupListCall<'a, C> {
7741        AccountPermissionGroupListCall {
7742            hub: self.hub,
7743            _profile_id: profile_id,
7744            _delegate: Default::default(),
7745            _additional_params: Default::default(),
7746            _scopes: Default::default(),
7747        }
7748    }
7749}
7750
7751/// A builder providing access to all methods supported on *accountPermission* resources.
7752/// It is not used directly, but through the [`Dfareporting`] hub.
7753///
7754/// # Example
7755///
7756/// Instantiate a resource builder
7757///
7758/// ```test_harness,no_run
7759/// extern crate hyper;
7760/// extern crate hyper_rustls;
7761/// extern crate google_dfareporting3d3 as dfareporting3d3;
7762///
7763/// # async fn dox() {
7764/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7765///
7766/// let secret: yup_oauth2::ApplicationSecret = Default::default();
7767/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7768///     secret,
7769///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7770/// ).build().await.unwrap();
7771///
7772/// let client = hyper_util::client::legacy::Client::builder(
7773///     hyper_util::rt::TokioExecutor::new()
7774/// )
7775/// .build(
7776///     hyper_rustls::HttpsConnectorBuilder::new()
7777///         .with_native_roots()
7778///         .unwrap()
7779///         .https_or_http()
7780///         .enable_http1()
7781///         .build()
7782/// );
7783/// let mut hub = Dfareporting::new(client, auth);
7784/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
7785/// // like `get(...)` and `list(...)`
7786/// // to build up your call.
7787/// let rb = hub.account_permissions();
7788/// # }
7789/// ```
7790pub struct AccountPermissionMethods<'a, C>
7791where
7792    C: 'a,
7793{
7794    hub: &'a Dfareporting<C>,
7795}
7796
7797impl<'a, C> common::MethodsBuilder for AccountPermissionMethods<'a, C> {}
7798
7799impl<'a, C> AccountPermissionMethods<'a, C> {
7800    /// Create a builder to help you perform the following task:
7801    ///
7802    /// Gets one account permission by ID.
7803    ///
7804    /// # Arguments
7805    ///
7806    /// * `profileId` - User profile ID associated with this request.
7807    /// * `id` - Account permission ID.
7808    pub fn get(&self, profile_id: i64, id: i64) -> AccountPermissionGetCall<'a, C> {
7809        AccountPermissionGetCall {
7810            hub: self.hub,
7811            _profile_id: profile_id,
7812            _id: id,
7813            _delegate: Default::default(),
7814            _additional_params: Default::default(),
7815            _scopes: Default::default(),
7816        }
7817    }
7818
7819    /// Create a builder to help you perform the following task:
7820    ///
7821    /// Retrieves the list of account permissions.
7822    ///
7823    /// # Arguments
7824    ///
7825    /// * `profileId` - User profile ID associated with this request.
7826    pub fn list(&self, profile_id: i64) -> AccountPermissionListCall<'a, C> {
7827        AccountPermissionListCall {
7828            hub: self.hub,
7829            _profile_id: profile_id,
7830            _delegate: Default::default(),
7831            _additional_params: Default::default(),
7832            _scopes: Default::default(),
7833        }
7834    }
7835}
7836
7837/// A builder providing access to all methods supported on *accountUserProfile* resources.
7838/// It is not used directly, but through the [`Dfareporting`] hub.
7839///
7840/// # Example
7841///
7842/// Instantiate a resource builder
7843///
7844/// ```test_harness,no_run
7845/// extern crate hyper;
7846/// extern crate hyper_rustls;
7847/// extern crate google_dfareporting3d3 as dfareporting3d3;
7848///
7849/// # async fn dox() {
7850/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7851///
7852/// let secret: yup_oauth2::ApplicationSecret = Default::default();
7853/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7854///     secret,
7855///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7856/// ).build().await.unwrap();
7857///
7858/// let client = hyper_util::client::legacy::Client::builder(
7859///     hyper_util::rt::TokioExecutor::new()
7860/// )
7861/// .build(
7862///     hyper_rustls::HttpsConnectorBuilder::new()
7863///         .with_native_roots()
7864///         .unwrap()
7865///         .https_or_http()
7866///         .enable_http1()
7867///         .build()
7868/// );
7869/// let mut hub = Dfareporting::new(client, auth);
7870/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
7871/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
7872/// // to build up your call.
7873/// let rb = hub.account_user_profiles();
7874/// # }
7875/// ```
7876pub struct AccountUserProfileMethods<'a, C>
7877where
7878    C: 'a,
7879{
7880    hub: &'a Dfareporting<C>,
7881}
7882
7883impl<'a, C> common::MethodsBuilder for AccountUserProfileMethods<'a, C> {}
7884
7885impl<'a, C> AccountUserProfileMethods<'a, C> {
7886    /// Create a builder to help you perform the following task:
7887    ///
7888    /// Gets one account user profile by ID.
7889    ///
7890    /// # Arguments
7891    ///
7892    /// * `profileId` - User profile ID associated with this request.
7893    /// * `id` - User profile ID.
7894    pub fn get(&self, profile_id: i64, id: i64) -> AccountUserProfileGetCall<'a, C> {
7895        AccountUserProfileGetCall {
7896            hub: self.hub,
7897            _profile_id: profile_id,
7898            _id: id,
7899            _delegate: Default::default(),
7900            _additional_params: Default::default(),
7901            _scopes: Default::default(),
7902        }
7903    }
7904
7905    /// Create a builder to help you perform the following task:
7906    ///
7907    /// Inserts a new account user profile.
7908    ///
7909    /// # Arguments
7910    ///
7911    /// * `request` - No description provided.
7912    /// * `profileId` - User profile ID associated with this request.
7913    pub fn insert(
7914        &self,
7915        request: AccountUserProfile,
7916        profile_id: i64,
7917    ) -> AccountUserProfileInsertCall<'a, C> {
7918        AccountUserProfileInsertCall {
7919            hub: self.hub,
7920            _request: request,
7921            _profile_id: profile_id,
7922            _delegate: Default::default(),
7923            _additional_params: Default::default(),
7924            _scopes: Default::default(),
7925        }
7926    }
7927
7928    /// Create a builder to help you perform the following task:
7929    ///
7930    /// Retrieves a list of account user profiles, possibly filtered. This method supports paging.
7931    ///
7932    /// # Arguments
7933    ///
7934    /// * `profileId` - User profile ID associated with this request.
7935    pub fn list(&self, profile_id: i64) -> AccountUserProfileListCall<'a, C> {
7936        AccountUserProfileListCall {
7937            hub: self.hub,
7938            _profile_id: profile_id,
7939            _user_role_id: Default::default(),
7940            _subaccount_id: Default::default(),
7941            _sort_order: Default::default(),
7942            _sort_field: Default::default(),
7943            _search_string: Default::default(),
7944            _page_token: Default::default(),
7945            _max_results: Default::default(),
7946            _ids: Default::default(),
7947            _active: Default::default(),
7948            _delegate: Default::default(),
7949            _additional_params: Default::default(),
7950            _scopes: Default::default(),
7951        }
7952    }
7953
7954    /// Create a builder to help you perform the following task:
7955    ///
7956    /// Updates an existing account user profile. This method supports patch semantics.
7957    ///
7958    /// # Arguments
7959    ///
7960    /// * `request` - No description provided.
7961    /// * `profileId` - User profile ID associated with this request.
7962    /// * `id` - AccountUserProfile ID.
7963    pub fn patch(
7964        &self,
7965        request: AccountUserProfile,
7966        profile_id: i64,
7967        id: i64,
7968    ) -> AccountUserProfilePatchCall<'a, C> {
7969        AccountUserProfilePatchCall {
7970            hub: self.hub,
7971            _request: request,
7972            _profile_id: profile_id,
7973            _id: id,
7974            _delegate: Default::default(),
7975            _additional_params: Default::default(),
7976            _scopes: Default::default(),
7977        }
7978    }
7979
7980    /// Create a builder to help you perform the following task:
7981    ///
7982    /// Updates an existing account user profile.
7983    ///
7984    /// # Arguments
7985    ///
7986    /// * `request` - No description provided.
7987    /// * `profileId` - User profile ID associated with this request.
7988    pub fn update(
7989        &self,
7990        request: AccountUserProfile,
7991        profile_id: i64,
7992    ) -> AccountUserProfileUpdateCall<'a, C> {
7993        AccountUserProfileUpdateCall {
7994            hub: self.hub,
7995            _request: request,
7996            _profile_id: profile_id,
7997            _delegate: Default::default(),
7998            _additional_params: Default::default(),
7999            _scopes: Default::default(),
8000        }
8001    }
8002}
8003
8004/// A builder providing access to all methods supported on *account* resources.
8005/// It is not used directly, but through the [`Dfareporting`] hub.
8006///
8007/// # Example
8008///
8009/// Instantiate a resource builder
8010///
8011/// ```test_harness,no_run
8012/// extern crate hyper;
8013/// extern crate hyper_rustls;
8014/// extern crate google_dfareporting3d3 as dfareporting3d3;
8015///
8016/// # async fn dox() {
8017/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8018///
8019/// let secret: yup_oauth2::ApplicationSecret = Default::default();
8020/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8021///     secret,
8022///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8023/// ).build().await.unwrap();
8024///
8025/// let client = hyper_util::client::legacy::Client::builder(
8026///     hyper_util::rt::TokioExecutor::new()
8027/// )
8028/// .build(
8029///     hyper_rustls::HttpsConnectorBuilder::new()
8030///         .with_native_roots()
8031///         .unwrap()
8032///         .https_or_http()
8033///         .enable_http1()
8034///         .build()
8035/// );
8036/// let mut hub = Dfareporting::new(client, auth);
8037/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
8038/// // like `get(...)`, `list(...)`, `patch(...)` and `update(...)`
8039/// // to build up your call.
8040/// let rb = hub.accounts();
8041/// # }
8042/// ```
8043pub struct AccountMethods<'a, C>
8044where
8045    C: 'a,
8046{
8047    hub: &'a Dfareporting<C>,
8048}
8049
8050impl<'a, C> common::MethodsBuilder for AccountMethods<'a, C> {}
8051
8052impl<'a, C> AccountMethods<'a, C> {
8053    /// Create a builder to help you perform the following task:
8054    ///
8055    /// Gets one account by ID.
8056    ///
8057    /// # Arguments
8058    ///
8059    /// * `profileId` - User profile ID associated with this request.
8060    /// * `id` - Account ID.
8061    pub fn get(&self, profile_id: i64, id: i64) -> AccountGetCall<'a, C> {
8062        AccountGetCall {
8063            hub: self.hub,
8064            _profile_id: profile_id,
8065            _id: id,
8066            _delegate: Default::default(),
8067            _additional_params: Default::default(),
8068            _scopes: Default::default(),
8069        }
8070    }
8071
8072    /// Create a builder to help you perform the following task:
8073    ///
8074    /// Retrieves the list of accounts, possibly filtered. This method supports paging.
8075    ///
8076    /// # Arguments
8077    ///
8078    /// * `profileId` - User profile ID associated with this request.
8079    pub fn list(&self, profile_id: i64) -> AccountListCall<'a, C> {
8080        AccountListCall {
8081            hub: self.hub,
8082            _profile_id: profile_id,
8083            _sort_order: Default::default(),
8084            _sort_field: Default::default(),
8085            _search_string: Default::default(),
8086            _page_token: Default::default(),
8087            _max_results: Default::default(),
8088            _ids: Default::default(),
8089            _active: Default::default(),
8090            _delegate: Default::default(),
8091            _additional_params: Default::default(),
8092            _scopes: Default::default(),
8093        }
8094    }
8095
8096    /// Create a builder to help you perform the following task:
8097    ///
8098    /// Updates an existing account. This method supports patch semantics.
8099    ///
8100    /// # Arguments
8101    ///
8102    /// * `request` - No description provided.
8103    /// * `profileId` - User profile ID associated with this request.
8104    /// * `id` - Account ID.
8105    pub fn patch(&self, request: Account, profile_id: i64, id: i64) -> AccountPatchCall<'a, C> {
8106        AccountPatchCall {
8107            hub: self.hub,
8108            _request: request,
8109            _profile_id: profile_id,
8110            _id: id,
8111            _delegate: Default::default(),
8112            _additional_params: Default::default(),
8113            _scopes: Default::default(),
8114        }
8115    }
8116
8117    /// Create a builder to help you perform the following task:
8118    ///
8119    /// Updates an existing account.
8120    ///
8121    /// # Arguments
8122    ///
8123    /// * `request` - No description provided.
8124    /// * `profileId` - User profile ID associated with this request.
8125    pub fn update(&self, request: Account, profile_id: i64) -> AccountUpdateCall<'a, C> {
8126        AccountUpdateCall {
8127            hub: self.hub,
8128            _request: request,
8129            _profile_id: profile_id,
8130            _delegate: Default::default(),
8131            _additional_params: Default::default(),
8132            _scopes: Default::default(),
8133        }
8134    }
8135}
8136
8137/// A builder providing access to all methods supported on *ad* resources.
8138/// It is not used directly, but through the [`Dfareporting`] hub.
8139///
8140/// # Example
8141///
8142/// Instantiate a resource builder
8143///
8144/// ```test_harness,no_run
8145/// extern crate hyper;
8146/// extern crate hyper_rustls;
8147/// extern crate google_dfareporting3d3 as dfareporting3d3;
8148///
8149/// # async fn dox() {
8150/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8151///
8152/// let secret: yup_oauth2::ApplicationSecret = Default::default();
8153/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8154///     secret,
8155///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8156/// ).build().await.unwrap();
8157///
8158/// let client = hyper_util::client::legacy::Client::builder(
8159///     hyper_util::rt::TokioExecutor::new()
8160/// )
8161/// .build(
8162///     hyper_rustls::HttpsConnectorBuilder::new()
8163///         .with_native_roots()
8164///         .unwrap()
8165///         .https_or_http()
8166///         .enable_http1()
8167///         .build()
8168/// );
8169/// let mut hub = Dfareporting::new(client, auth);
8170/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
8171/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
8172/// // to build up your call.
8173/// let rb = hub.ads();
8174/// # }
8175/// ```
8176pub struct AdMethods<'a, C>
8177where
8178    C: 'a,
8179{
8180    hub: &'a Dfareporting<C>,
8181}
8182
8183impl<'a, C> common::MethodsBuilder for AdMethods<'a, C> {}
8184
8185impl<'a, C> AdMethods<'a, C> {
8186    /// Create a builder to help you perform the following task:
8187    ///
8188    /// Gets one ad by ID.
8189    ///
8190    /// # Arguments
8191    ///
8192    /// * `profileId` - User profile ID associated with this request.
8193    /// * `id` - Ad ID.
8194    pub fn get(&self, profile_id: i64, id: i64) -> AdGetCall<'a, C> {
8195        AdGetCall {
8196            hub: self.hub,
8197            _profile_id: profile_id,
8198            _id: id,
8199            _delegate: Default::default(),
8200            _additional_params: Default::default(),
8201            _scopes: Default::default(),
8202        }
8203    }
8204
8205    /// Create a builder to help you perform the following task:
8206    ///
8207    /// Inserts a new ad.
8208    ///
8209    /// # Arguments
8210    ///
8211    /// * `request` - No description provided.
8212    /// * `profileId` - User profile ID associated with this request.
8213    pub fn insert(&self, request: Ad, profile_id: i64) -> AdInsertCall<'a, C> {
8214        AdInsertCall {
8215            hub: self.hub,
8216            _request: request,
8217            _profile_id: profile_id,
8218            _delegate: Default::default(),
8219            _additional_params: Default::default(),
8220            _scopes: Default::default(),
8221        }
8222    }
8223
8224    /// Create a builder to help you perform the following task:
8225    ///
8226    /// Retrieves a list of ads, possibly filtered. This method supports paging.
8227    ///
8228    /// # Arguments
8229    ///
8230    /// * `profileId` - User profile ID associated with this request.
8231    pub fn list(&self, profile_id: i64) -> AdListCall<'a, C> {
8232        AdListCall {
8233            hub: self.hub,
8234            _profile_id: profile_id,
8235            _type_: Default::default(),
8236            _ssl_required: Default::default(),
8237            _ssl_compliant: Default::default(),
8238            _sort_order: Default::default(),
8239            _sort_field: Default::default(),
8240            _size_ids: Default::default(),
8241            _search_string: Default::default(),
8242            _remarketing_list_ids: Default::default(),
8243            _placement_ids: Default::default(),
8244            _page_token: Default::default(),
8245            _overridden_event_tag_id: Default::default(),
8246            _max_results: Default::default(),
8247            _landing_page_ids: Default::default(),
8248            _ids: Default::default(),
8249            _dynamic_click_tracker: Default::default(),
8250            _creative_optimization_configuration_ids: Default::default(),
8251            _creative_ids: Default::default(),
8252            _compatibility: Default::default(),
8253            _campaign_ids: Default::default(),
8254            _audience_segment_ids: Default::default(),
8255            _archived: Default::default(),
8256            _advertiser_id: Default::default(),
8257            _active: Default::default(),
8258            _delegate: Default::default(),
8259            _additional_params: Default::default(),
8260            _scopes: Default::default(),
8261        }
8262    }
8263
8264    /// Create a builder to help you perform the following task:
8265    ///
8266    /// Updates an existing ad. This method supports patch semantics.
8267    ///
8268    /// # Arguments
8269    ///
8270    /// * `request` - No description provided.
8271    /// * `profileId` - User profile ID associated with this request.
8272    /// * `id` - Ad ID.
8273    pub fn patch(&self, request: Ad, profile_id: i64, id: i64) -> AdPatchCall<'a, C> {
8274        AdPatchCall {
8275            hub: self.hub,
8276            _request: request,
8277            _profile_id: profile_id,
8278            _id: id,
8279            _delegate: Default::default(),
8280            _additional_params: Default::default(),
8281            _scopes: Default::default(),
8282        }
8283    }
8284
8285    /// Create a builder to help you perform the following task:
8286    ///
8287    /// Updates an existing ad.
8288    ///
8289    /// # Arguments
8290    ///
8291    /// * `request` - No description provided.
8292    /// * `profileId` - User profile ID associated with this request.
8293    pub fn update(&self, request: Ad, profile_id: i64) -> AdUpdateCall<'a, C> {
8294        AdUpdateCall {
8295            hub: self.hub,
8296            _request: request,
8297            _profile_id: profile_id,
8298            _delegate: Default::default(),
8299            _additional_params: Default::default(),
8300            _scopes: Default::default(),
8301        }
8302    }
8303}
8304
8305/// A builder providing access to all methods supported on *advertiserGroup* resources.
8306/// It is not used directly, but through the [`Dfareporting`] hub.
8307///
8308/// # Example
8309///
8310/// Instantiate a resource builder
8311///
8312/// ```test_harness,no_run
8313/// extern crate hyper;
8314/// extern crate hyper_rustls;
8315/// extern crate google_dfareporting3d3 as dfareporting3d3;
8316///
8317/// # async fn dox() {
8318/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8319///
8320/// let secret: yup_oauth2::ApplicationSecret = Default::default();
8321/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8322///     secret,
8323///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8324/// ).build().await.unwrap();
8325///
8326/// let client = hyper_util::client::legacy::Client::builder(
8327///     hyper_util::rt::TokioExecutor::new()
8328/// )
8329/// .build(
8330///     hyper_rustls::HttpsConnectorBuilder::new()
8331///         .with_native_roots()
8332///         .unwrap()
8333///         .https_or_http()
8334///         .enable_http1()
8335///         .build()
8336/// );
8337/// let mut hub = Dfareporting::new(client, auth);
8338/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
8339/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
8340/// // to build up your call.
8341/// let rb = hub.advertiser_groups();
8342/// # }
8343/// ```
8344pub struct AdvertiserGroupMethods<'a, C>
8345where
8346    C: 'a,
8347{
8348    hub: &'a Dfareporting<C>,
8349}
8350
8351impl<'a, C> common::MethodsBuilder for AdvertiserGroupMethods<'a, C> {}
8352
8353impl<'a, C> AdvertiserGroupMethods<'a, C> {
8354    /// Create a builder to help you perform the following task:
8355    ///
8356    /// Deletes an existing advertiser group.
8357    ///
8358    /// # Arguments
8359    ///
8360    /// * `profileId` - User profile ID associated with this request.
8361    /// * `id` - Advertiser group ID.
8362    pub fn delete(&self, profile_id: i64, id: i64) -> AdvertiserGroupDeleteCall<'a, C> {
8363        AdvertiserGroupDeleteCall {
8364            hub: self.hub,
8365            _profile_id: profile_id,
8366            _id: id,
8367            _delegate: Default::default(),
8368            _additional_params: Default::default(),
8369            _scopes: Default::default(),
8370        }
8371    }
8372
8373    /// Create a builder to help you perform the following task:
8374    ///
8375    /// Gets one advertiser group by ID.
8376    ///
8377    /// # Arguments
8378    ///
8379    /// * `profileId` - User profile ID associated with this request.
8380    /// * `id` - Advertiser group ID.
8381    pub fn get(&self, profile_id: i64, id: i64) -> AdvertiserGroupGetCall<'a, C> {
8382        AdvertiserGroupGetCall {
8383            hub: self.hub,
8384            _profile_id: profile_id,
8385            _id: id,
8386            _delegate: Default::default(),
8387            _additional_params: Default::default(),
8388            _scopes: Default::default(),
8389        }
8390    }
8391
8392    /// Create a builder to help you perform the following task:
8393    ///
8394    /// Inserts a new advertiser group.
8395    ///
8396    /// # Arguments
8397    ///
8398    /// * `request` - No description provided.
8399    /// * `profileId` - User profile ID associated with this request.
8400    pub fn insert(
8401        &self,
8402        request: AdvertiserGroup,
8403        profile_id: i64,
8404    ) -> AdvertiserGroupInsertCall<'a, C> {
8405        AdvertiserGroupInsertCall {
8406            hub: self.hub,
8407            _request: request,
8408            _profile_id: profile_id,
8409            _delegate: Default::default(),
8410            _additional_params: Default::default(),
8411            _scopes: Default::default(),
8412        }
8413    }
8414
8415    /// Create a builder to help you perform the following task:
8416    ///
8417    /// Retrieves a list of advertiser groups, possibly filtered. This method supports paging.
8418    ///
8419    /// # Arguments
8420    ///
8421    /// * `profileId` - User profile ID associated with this request.
8422    pub fn list(&self, profile_id: i64) -> AdvertiserGroupListCall<'a, C> {
8423        AdvertiserGroupListCall {
8424            hub: self.hub,
8425            _profile_id: profile_id,
8426            _sort_order: Default::default(),
8427            _sort_field: Default::default(),
8428            _search_string: Default::default(),
8429            _page_token: Default::default(),
8430            _max_results: Default::default(),
8431            _ids: Default::default(),
8432            _delegate: Default::default(),
8433            _additional_params: Default::default(),
8434            _scopes: Default::default(),
8435        }
8436    }
8437
8438    /// Create a builder to help you perform the following task:
8439    ///
8440    /// Updates an existing advertiser group. This method supports patch semantics.
8441    ///
8442    /// # Arguments
8443    ///
8444    /// * `request` - No description provided.
8445    /// * `profileId` - User profile ID associated with this request.
8446    /// * `id` - AdvertiserGroup ID.
8447    pub fn patch(
8448        &self,
8449        request: AdvertiserGroup,
8450        profile_id: i64,
8451        id: i64,
8452    ) -> AdvertiserGroupPatchCall<'a, C> {
8453        AdvertiserGroupPatchCall {
8454            hub: self.hub,
8455            _request: request,
8456            _profile_id: profile_id,
8457            _id: id,
8458            _delegate: Default::default(),
8459            _additional_params: Default::default(),
8460            _scopes: Default::default(),
8461        }
8462    }
8463
8464    /// Create a builder to help you perform the following task:
8465    ///
8466    /// Updates an existing advertiser group.
8467    ///
8468    /// # Arguments
8469    ///
8470    /// * `request` - No description provided.
8471    /// * `profileId` - User profile ID associated with this request.
8472    pub fn update(
8473        &self,
8474        request: AdvertiserGroup,
8475        profile_id: i64,
8476    ) -> AdvertiserGroupUpdateCall<'a, C> {
8477        AdvertiserGroupUpdateCall {
8478            hub: self.hub,
8479            _request: request,
8480            _profile_id: profile_id,
8481            _delegate: Default::default(),
8482            _additional_params: Default::default(),
8483            _scopes: Default::default(),
8484        }
8485    }
8486}
8487
8488/// A builder providing access to all methods supported on *advertiserLandingPage* resources.
8489/// It is not used directly, but through the [`Dfareporting`] hub.
8490///
8491/// # Example
8492///
8493/// Instantiate a resource builder
8494///
8495/// ```test_harness,no_run
8496/// extern crate hyper;
8497/// extern crate hyper_rustls;
8498/// extern crate google_dfareporting3d3 as dfareporting3d3;
8499///
8500/// # async fn dox() {
8501/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8502///
8503/// let secret: yup_oauth2::ApplicationSecret = Default::default();
8504/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8505///     secret,
8506///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8507/// ).build().await.unwrap();
8508///
8509/// let client = hyper_util::client::legacy::Client::builder(
8510///     hyper_util::rt::TokioExecutor::new()
8511/// )
8512/// .build(
8513///     hyper_rustls::HttpsConnectorBuilder::new()
8514///         .with_native_roots()
8515///         .unwrap()
8516///         .https_or_http()
8517///         .enable_http1()
8518///         .build()
8519/// );
8520/// let mut hub = Dfareporting::new(client, auth);
8521/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
8522/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
8523/// // to build up your call.
8524/// let rb = hub.advertiser_landing_pages();
8525/// # }
8526/// ```
8527pub struct AdvertiserLandingPageMethods<'a, C>
8528where
8529    C: 'a,
8530{
8531    hub: &'a Dfareporting<C>,
8532}
8533
8534impl<'a, C> common::MethodsBuilder for AdvertiserLandingPageMethods<'a, C> {}
8535
8536impl<'a, C> AdvertiserLandingPageMethods<'a, C> {
8537    /// Create a builder to help you perform the following task:
8538    ///
8539    /// Gets one landing page by ID.
8540    ///
8541    /// # Arguments
8542    ///
8543    /// * `profileId` - User profile ID associated with this request.
8544    /// * `id` - Landing page ID.
8545    pub fn get(&self, profile_id: i64, id: i64) -> AdvertiserLandingPageGetCall<'a, C> {
8546        AdvertiserLandingPageGetCall {
8547            hub: self.hub,
8548            _profile_id: profile_id,
8549            _id: id,
8550            _delegate: Default::default(),
8551            _additional_params: Default::default(),
8552            _scopes: Default::default(),
8553        }
8554    }
8555
8556    /// Create a builder to help you perform the following task:
8557    ///
8558    /// Inserts a new landing page.
8559    ///
8560    /// # Arguments
8561    ///
8562    /// * `request` - No description provided.
8563    /// * `profileId` - User profile ID associated with this request.
8564    pub fn insert(
8565        &self,
8566        request: LandingPage,
8567        profile_id: i64,
8568    ) -> AdvertiserLandingPageInsertCall<'a, C> {
8569        AdvertiserLandingPageInsertCall {
8570            hub: self.hub,
8571            _request: request,
8572            _profile_id: profile_id,
8573            _delegate: Default::default(),
8574            _additional_params: Default::default(),
8575            _scopes: Default::default(),
8576        }
8577    }
8578
8579    /// Create a builder to help you perform the following task:
8580    ///
8581    /// Retrieves a list of landing pages.
8582    ///
8583    /// # Arguments
8584    ///
8585    /// * `profileId` - User profile ID associated with this request.
8586    pub fn list(&self, profile_id: i64) -> AdvertiserLandingPageListCall<'a, C> {
8587        AdvertiserLandingPageListCall {
8588            hub: self.hub,
8589            _profile_id: profile_id,
8590            _subaccount_id: Default::default(),
8591            _sort_order: Default::default(),
8592            _sort_field: Default::default(),
8593            _search_string: Default::default(),
8594            _page_token: Default::default(),
8595            _max_results: Default::default(),
8596            _ids: Default::default(),
8597            _campaign_ids: Default::default(),
8598            _archived: Default::default(),
8599            _advertiser_ids: Default::default(),
8600            _delegate: Default::default(),
8601            _additional_params: Default::default(),
8602            _scopes: Default::default(),
8603        }
8604    }
8605
8606    /// Create a builder to help you perform the following task:
8607    ///
8608    /// Updates an existing advertiser landing page. This method supports patch semantics.
8609    ///
8610    /// # Arguments
8611    ///
8612    /// * `request` - No description provided.
8613    /// * `profileId` - User profile ID associated with this request.
8614    /// * `id` - LandingPage ID.
8615    pub fn patch(
8616        &self,
8617        request: LandingPage,
8618        profile_id: i64,
8619        id: i64,
8620    ) -> AdvertiserLandingPagePatchCall<'a, C> {
8621        AdvertiserLandingPagePatchCall {
8622            hub: self.hub,
8623            _request: request,
8624            _profile_id: profile_id,
8625            _id: id,
8626            _delegate: Default::default(),
8627            _additional_params: Default::default(),
8628            _scopes: Default::default(),
8629        }
8630    }
8631
8632    /// Create a builder to help you perform the following task:
8633    ///
8634    /// Updates an existing landing page.
8635    ///
8636    /// # Arguments
8637    ///
8638    /// * `request` - No description provided.
8639    /// * `profileId` - User profile ID associated with this request.
8640    pub fn update(
8641        &self,
8642        request: LandingPage,
8643        profile_id: i64,
8644    ) -> AdvertiserLandingPageUpdateCall<'a, C> {
8645        AdvertiserLandingPageUpdateCall {
8646            hub: self.hub,
8647            _request: request,
8648            _profile_id: profile_id,
8649            _delegate: Default::default(),
8650            _additional_params: Default::default(),
8651            _scopes: Default::default(),
8652        }
8653    }
8654}
8655
8656/// A builder providing access to all methods supported on *advertiser* resources.
8657/// It is not used directly, but through the [`Dfareporting`] hub.
8658///
8659/// # Example
8660///
8661/// Instantiate a resource builder
8662///
8663/// ```test_harness,no_run
8664/// extern crate hyper;
8665/// extern crate hyper_rustls;
8666/// extern crate google_dfareporting3d3 as dfareporting3d3;
8667///
8668/// # async fn dox() {
8669/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8670///
8671/// let secret: yup_oauth2::ApplicationSecret = Default::default();
8672/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8673///     secret,
8674///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8675/// ).build().await.unwrap();
8676///
8677/// let client = hyper_util::client::legacy::Client::builder(
8678///     hyper_util::rt::TokioExecutor::new()
8679/// )
8680/// .build(
8681///     hyper_rustls::HttpsConnectorBuilder::new()
8682///         .with_native_roots()
8683///         .unwrap()
8684///         .https_or_http()
8685///         .enable_http1()
8686///         .build()
8687/// );
8688/// let mut hub = Dfareporting::new(client, auth);
8689/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
8690/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
8691/// // to build up your call.
8692/// let rb = hub.advertisers();
8693/// # }
8694/// ```
8695pub struct AdvertiserMethods<'a, C>
8696where
8697    C: 'a,
8698{
8699    hub: &'a Dfareporting<C>,
8700}
8701
8702impl<'a, C> common::MethodsBuilder for AdvertiserMethods<'a, C> {}
8703
8704impl<'a, C> AdvertiserMethods<'a, C> {
8705    /// Create a builder to help you perform the following task:
8706    ///
8707    /// Gets one advertiser by ID.
8708    ///
8709    /// # Arguments
8710    ///
8711    /// * `profileId` - User profile ID associated with this request.
8712    /// * `id` - Advertiser ID.
8713    pub fn get(&self, profile_id: i64, id: i64) -> AdvertiserGetCall<'a, C> {
8714        AdvertiserGetCall {
8715            hub: self.hub,
8716            _profile_id: profile_id,
8717            _id: id,
8718            _delegate: Default::default(),
8719            _additional_params: Default::default(),
8720            _scopes: Default::default(),
8721        }
8722    }
8723
8724    /// Create a builder to help you perform the following task:
8725    ///
8726    /// Inserts a new advertiser.
8727    ///
8728    /// # Arguments
8729    ///
8730    /// * `request` - No description provided.
8731    /// * `profileId` - User profile ID associated with this request.
8732    pub fn insert(&self, request: Advertiser, profile_id: i64) -> AdvertiserInsertCall<'a, C> {
8733        AdvertiserInsertCall {
8734            hub: self.hub,
8735            _request: request,
8736            _profile_id: profile_id,
8737            _delegate: Default::default(),
8738            _additional_params: Default::default(),
8739            _scopes: Default::default(),
8740        }
8741    }
8742
8743    /// Create a builder to help you perform the following task:
8744    ///
8745    /// Retrieves a list of advertisers, possibly filtered. This method supports paging.
8746    ///
8747    /// # Arguments
8748    ///
8749    /// * `profileId` - User profile ID associated with this request.
8750    pub fn list(&self, profile_id: i64) -> AdvertiserListCall<'a, C> {
8751        AdvertiserListCall {
8752            hub: self.hub,
8753            _profile_id: profile_id,
8754            _subaccount_id: Default::default(),
8755            _status: Default::default(),
8756            _sort_order: Default::default(),
8757            _sort_field: Default::default(),
8758            _search_string: Default::default(),
8759            _page_token: Default::default(),
8760            _only_parent: Default::default(),
8761            _max_results: Default::default(),
8762            _include_advertisers_without_groups_only: Default::default(),
8763            _ids: Default::default(),
8764            _floodlight_configuration_ids: Default::default(),
8765            _advertiser_group_ids: Default::default(),
8766            _delegate: Default::default(),
8767            _additional_params: Default::default(),
8768            _scopes: Default::default(),
8769        }
8770    }
8771
8772    /// Create a builder to help you perform the following task:
8773    ///
8774    /// Updates an existing advertiser. This method supports patch semantics.
8775    ///
8776    /// # Arguments
8777    ///
8778    /// * `request` - No description provided.
8779    /// * `profileId` - User profile ID associated with this request.
8780    /// * `id` - Advertiser ID.
8781    pub fn patch(
8782        &self,
8783        request: Advertiser,
8784        profile_id: i64,
8785        id: i64,
8786    ) -> AdvertiserPatchCall<'a, C> {
8787        AdvertiserPatchCall {
8788            hub: self.hub,
8789            _request: request,
8790            _profile_id: profile_id,
8791            _id: id,
8792            _delegate: Default::default(),
8793            _additional_params: Default::default(),
8794            _scopes: Default::default(),
8795        }
8796    }
8797
8798    /// Create a builder to help you perform the following task:
8799    ///
8800    /// Updates an existing advertiser.
8801    ///
8802    /// # Arguments
8803    ///
8804    /// * `request` - No description provided.
8805    /// * `profileId` - User profile ID associated with this request.
8806    pub fn update(&self, request: Advertiser, profile_id: i64) -> AdvertiserUpdateCall<'a, C> {
8807        AdvertiserUpdateCall {
8808            hub: self.hub,
8809            _request: request,
8810            _profile_id: profile_id,
8811            _delegate: Default::default(),
8812            _additional_params: Default::default(),
8813            _scopes: Default::default(),
8814        }
8815    }
8816}
8817
8818/// A builder providing access to all methods supported on *browser* resources.
8819/// It is not used directly, but through the [`Dfareporting`] hub.
8820///
8821/// # Example
8822///
8823/// Instantiate a resource builder
8824///
8825/// ```test_harness,no_run
8826/// extern crate hyper;
8827/// extern crate hyper_rustls;
8828/// extern crate google_dfareporting3d3 as dfareporting3d3;
8829///
8830/// # async fn dox() {
8831/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8832///
8833/// let secret: yup_oauth2::ApplicationSecret = Default::default();
8834/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8835///     secret,
8836///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8837/// ).build().await.unwrap();
8838///
8839/// let client = hyper_util::client::legacy::Client::builder(
8840///     hyper_util::rt::TokioExecutor::new()
8841/// )
8842/// .build(
8843///     hyper_rustls::HttpsConnectorBuilder::new()
8844///         .with_native_roots()
8845///         .unwrap()
8846///         .https_or_http()
8847///         .enable_http1()
8848///         .build()
8849/// );
8850/// let mut hub = Dfareporting::new(client, auth);
8851/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
8852/// // like `list(...)`
8853/// // to build up your call.
8854/// let rb = hub.browsers();
8855/// # }
8856/// ```
8857pub struct BrowserMethods<'a, C>
8858where
8859    C: 'a,
8860{
8861    hub: &'a Dfareporting<C>,
8862}
8863
8864impl<'a, C> common::MethodsBuilder for BrowserMethods<'a, C> {}
8865
8866impl<'a, C> BrowserMethods<'a, C> {
8867    /// Create a builder to help you perform the following task:
8868    ///
8869    /// Retrieves a list of browsers.
8870    ///
8871    /// # Arguments
8872    ///
8873    /// * `profileId` - User profile ID associated with this request.
8874    pub fn list(&self, profile_id: i64) -> BrowserListCall<'a, C> {
8875        BrowserListCall {
8876            hub: self.hub,
8877            _profile_id: profile_id,
8878            _delegate: Default::default(),
8879            _additional_params: Default::default(),
8880            _scopes: Default::default(),
8881        }
8882    }
8883}
8884
8885/// A builder providing access to all methods supported on *campaignCreativeAssociation* resources.
8886/// It is not used directly, but through the [`Dfareporting`] hub.
8887///
8888/// # Example
8889///
8890/// Instantiate a resource builder
8891///
8892/// ```test_harness,no_run
8893/// extern crate hyper;
8894/// extern crate hyper_rustls;
8895/// extern crate google_dfareporting3d3 as dfareporting3d3;
8896///
8897/// # async fn dox() {
8898/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8899///
8900/// let secret: yup_oauth2::ApplicationSecret = Default::default();
8901/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8902///     secret,
8903///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8904/// ).build().await.unwrap();
8905///
8906/// let client = hyper_util::client::legacy::Client::builder(
8907///     hyper_util::rt::TokioExecutor::new()
8908/// )
8909/// .build(
8910///     hyper_rustls::HttpsConnectorBuilder::new()
8911///         .with_native_roots()
8912///         .unwrap()
8913///         .https_or_http()
8914///         .enable_http1()
8915///         .build()
8916/// );
8917/// let mut hub = Dfareporting::new(client, auth);
8918/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
8919/// // like `insert(...)` and `list(...)`
8920/// // to build up your call.
8921/// let rb = hub.campaign_creative_associations();
8922/// # }
8923/// ```
8924pub struct CampaignCreativeAssociationMethods<'a, C>
8925where
8926    C: 'a,
8927{
8928    hub: &'a Dfareporting<C>,
8929}
8930
8931impl<'a, C> common::MethodsBuilder for CampaignCreativeAssociationMethods<'a, C> {}
8932
8933impl<'a, C> CampaignCreativeAssociationMethods<'a, C> {
8934    /// Create a builder to help you perform the following task:
8935    ///
8936    /// Associates a creative with the specified campaign. This method creates a default ad with dimensions matching the creative in the campaign if such a default ad does not exist already.
8937    ///
8938    /// # Arguments
8939    ///
8940    /// * `request` - No description provided.
8941    /// * `profileId` - User profile ID associated with this request.
8942    /// * `campaignId` - Campaign ID in this association.
8943    pub fn insert(
8944        &self,
8945        request: CampaignCreativeAssociation,
8946        profile_id: i64,
8947        campaign_id: i64,
8948    ) -> CampaignCreativeAssociationInsertCall<'a, C> {
8949        CampaignCreativeAssociationInsertCall {
8950            hub: self.hub,
8951            _request: request,
8952            _profile_id: profile_id,
8953            _campaign_id: campaign_id,
8954            _delegate: Default::default(),
8955            _additional_params: Default::default(),
8956            _scopes: Default::default(),
8957        }
8958    }
8959
8960    /// Create a builder to help you perform the following task:
8961    ///
8962    /// Retrieves the list of creative IDs associated with the specified campaign. This method supports paging.
8963    ///
8964    /// # Arguments
8965    ///
8966    /// * `profileId` - User profile ID associated with this request.
8967    /// * `campaignId` - Campaign ID in this association.
8968    pub fn list(
8969        &self,
8970        profile_id: i64,
8971        campaign_id: i64,
8972    ) -> CampaignCreativeAssociationListCall<'a, C> {
8973        CampaignCreativeAssociationListCall {
8974            hub: self.hub,
8975            _profile_id: profile_id,
8976            _campaign_id: campaign_id,
8977            _sort_order: Default::default(),
8978            _page_token: Default::default(),
8979            _max_results: Default::default(),
8980            _delegate: Default::default(),
8981            _additional_params: Default::default(),
8982            _scopes: Default::default(),
8983        }
8984    }
8985}
8986
8987/// A builder providing access to all methods supported on *campaign* resources.
8988/// It is not used directly, but through the [`Dfareporting`] hub.
8989///
8990/// # Example
8991///
8992/// Instantiate a resource builder
8993///
8994/// ```test_harness,no_run
8995/// extern crate hyper;
8996/// extern crate hyper_rustls;
8997/// extern crate google_dfareporting3d3 as dfareporting3d3;
8998///
8999/// # async fn dox() {
9000/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9001///
9002/// let secret: yup_oauth2::ApplicationSecret = Default::default();
9003/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9004///     secret,
9005///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9006/// ).build().await.unwrap();
9007///
9008/// let client = hyper_util::client::legacy::Client::builder(
9009///     hyper_util::rt::TokioExecutor::new()
9010/// )
9011/// .build(
9012///     hyper_rustls::HttpsConnectorBuilder::new()
9013///         .with_native_roots()
9014///         .unwrap()
9015///         .https_or_http()
9016///         .enable_http1()
9017///         .build()
9018/// );
9019/// let mut hub = Dfareporting::new(client, auth);
9020/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
9021/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
9022/// // to build up your call.
9023/// let rb = hub.campaigns();
9024/// # }
9025/// ```
9026pub struct CampaignMethods<'a, C>
9027where
9028    C: 'a,
9029{
9030    hub: &'a Dfareporting<C>,
9031}
9032
9033impl<'a, C> common::MethodsBuilder for CampaignMethods<'a, C> {}
9034
9035impl<'a, C> CampaignMethods<'a, C> {
9036    /// Create a builder to help you perform the following task:
9037    ///
9038    /// Gets one campaign by ID.
9039    ///
9040    /// # Arguments
9041    ///
9042    /// * `profileId` - User profile ID associated with this request.
9043    /// * `id` - Campaign ID.
9044    pub fn get(&self, profile_id: i64, id: i64) -> CampaignGetCall<'a, C> {
9045        CampaignGetCall {
9046            hub: self.hub,
9047            _profile_id: profile_id,
9048            _id: id,
9049            _delegate: Default::default(),
9050            _additional_params: Default::default(),
9051            _scopes: Default::default(),
9052        }
9053    }
9054
9055    /// Create a builder to help you perform the following task:
9056    ///
9057    /// Inserts a new campaign.
9058    ///
9059    /// # Arguments
9060    ///
9061    /// * `request` - No description provided.
9062    /// * `profileId` - User profile ID associated with this request.
9063    pub fn insert(&self, request: Campaign, profile_id: i64) -> CampaignInsertCall<'a, C> {
9064        CampaignInsertCall {
9065            hub: self.hub,
9066            _request: request,
9067            _profile_id: profile_id,
9068            _delegate: Default::default(),
9069            _additional_params: Default::default(),
9070            _scopes: Default::default(),
9071        }
9072    }
9073
9074    /// Create a builder to help you perform the following task:
9075    ///
9076    /// Retrieves a list of campaigns, possibly filtered. This method supports paging.
9077    ///
9078    /// # Arguments
9079    ///
9080    /// * `profileId` - User profile ID associated with this request.
9081    pub fn list(&self, profile_id: i64) -> CampaignListCall<'a, C> {
9082        CampaignListCall {
9083            hub: self.hub,
9084            _profile_id: profile_id,
9085            _subaccount_id: Default::default(),
9086            _sort_order: Default::default(),
9087            _sort_field: Default::default(),
9088            _search_string: Default::default(),
9089            _page_token: Default::default(),
9090            _overridden_event_tag_id: Default::default(),
9091            _max_results: Default::default(),
9092            _ids: Default::default(),
9093            _excluded_ids: Default::default(),
9094            _at_least_one_optimization_activity: Default::default(),
9095            _archived: Default::default(),
9096            _advertiser_ids: Default::default(),
9097            _advertiser_group_ids: Default::default(),
9098            _delegate: Default::default(),
9099            _additional_params: Default::default(),
9100            _scopes: Default::default(),
9101        }
9102    }
9103
9104    /// Create a builder to help you perform the following task:
9105    ///
9106    /// Updates an existing campaign. This method supports patch semantics.
9107    ///
9108    /// # Arguments
9109    ///
9110    /// * `request` - No description provided.
9111    /// * `profileId` - User profile ID associated with this request.
9112    /// * `id` - Campaign ID.
9113    pub fn patch(&self, request: Campaign, profile_id: i64, id: i64) -> CampaignPatchCall<'a, C> {
9114        CampaignPatchCall {
9115            hub: self.hub,
9116            _request: request,
9117            _profile_id: profile_id,
9118            _id: id,
9119            _delegate: Default::default(),
9120            _additional_params: Default::default(),
9121            _scopes: Default::default(),
9122        }
9123    }
9124
9125    /// Create a builder to help you perform the following task:
9126    ///
9127    /// Updates an existing campaign.
9128    ///
9129    /// # Arguments
9130    ///
9131    /// * `request` - No description provided.
9132    /// * `profileId` - User profile ID associated with this request.
9133    pub fn update(&self, request: Campaign, profile_id: i64) -> CampaignUpdateCall<'a, C> {
9134        CampaignUpdateCall {
9135            hub: self.hub,
9136            _request: request,
9137            _profile_id: profile_id,
9138            _delegate: Default::default(),
9139            _additional_params: Default::default(),
9140            _scopes: Default::default(),
9141        }
9142    }
9143}
9144
9145/// A builder providing access to all methods supported on *changeLog* resources.
9146/// It is not used directly, but through the [`Dfareporting`] hub.
9147///
9148/// # Example
9149///
9150/// Instantiate a resource builder
9151///
9152/// ```test_harness,no_run
9153/// extern crate hyper;
9154/// extern crate hyper_rustls;
9155/// extern crate google_dfareporting3d3 as dfareporting3d3;
9156///
9157/// # async fn dox() {
9158/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9159///
9160/// let secret: yup_oauth2::ApplicationSecret = Default::default();
9161/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9162///     secret,
9163///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9164/// ).build().await.unwrap();
9165///
9166/// let client = hyper_util::client::legacy::Client::builder(
9167///     hyper_util::rt::TokioExecutor::new()
9168/// )
9169/// .build(
9170///     hyper_rustls::HttpsConnectorBuilder::new()
9171///         .with_native_roots()
9172///         .unwrap()
9173///         .https_or_http()
9174///         .enable_http1()
9175///         .build()
9176/// );
9177/// let mut hub = Dfareporting::new(client, auth);
9178/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
9179/// // like `get(...)` and `list(...)`
9180/// // to build up your call.
9181/// let rb = hub.change_logs();
9182/// # }
9183/// ```
9184pub struct ChangeLogMethods<'a, C>
9185where
9186    C: 'a,
9187{
9188    hub: &'a Dfareporting<C>,
9189}
9190
9191impl<'a, C> common::MethodsBuilder for ChangeLogMethods<'a, C> {}
9192
9193impl<'a, C> ChangeLogMethods<'a, C> {
9194    /// Create a builder to help you perform the following task:
9195    ///
9196    /// Gets one change log by ID.
9197    ///
9198    /// # Arguments
9199    ///
9200    /// * `profileId` - User profile ID associated with this request.
9201    /// * `id` - Change log ID.
9202    pub fn get(&self, profile_id: i64, id: i64) -> ChangeLogGetCall<'a, C> {
9203        ChangeLogGetCall {
9204            hub: self.hub,
9205            _profile_id: profile_id,
9206            _id: id,
9207            _delegate: Default::default(),
9208            _additional_params: Default::default(),
9209            _scopes: Default::default(),
9210        }
9211    }
9212
9213    /// Create a builder to help you perform the following task:
9214    ///
9215    /// Retrieves a list of change logs. This method supports paging.
9216    ///
9217    /// # Arguments
9218    ///
9219    /// * `profileId` - User profile ID associated with this request.
9220    pub fn list(&self, profile_id: i64) -> ChangeLogListCall<'a, C> {
9221        ChangeLogListCall {
9222            hub: self.hub,
9223            _profile_id: profile_id,
9224            _user_profile_ids: Default::default(),
9225            _search_string: Default::default(),
9226            _page_token: Default::default(),
9227            _object_type: Default::default(),
9228            _object_ids: Default::default(),
9229            _min_change_time: Default::default(),
9230            _max_results: Default::default(),
9231            _max_change_time: Default::default(),
9232            _ids: Default::default(),
9233            _action: Default::default(),
9234            _delegate: Default::default(),
9235            _additional_params: Default::default(),
9236            _scopes: Default::default(),
9237        }
9238    }
9239}
9240
9241/// A builder providing access to all methods supported on *city* resources.
9242/// It is not used directly, but through the [`Dfareporting`] hub.
9243///
9244/// # Example
9245///
9246/// Instantiate a resource builder
9247///
9248/// ```test_harness,no_run
9249/// extern crate hyper;
9250/// extern crate hyper_rustls;
9251/// extern crate google_dfareporting3d3 as dfareporting3d3;
9252///
9253/// # async fn dox() {
9254/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9255///
9256/// let secret: yup_oauth2::ApplicationSecret = Default::default();
9257/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9258///     secret,
9259///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9260/// ).build().await.unwrap();
9261///
9262/// let client = hyper_util::client::legacy::Client::builder(
9263///     hyper_util::rt::TokioExecutor::new()
9264/// )
9265/// .build(
9266///     hyper_rustls::HttpsConnectorBuilder::new()
9267///         .with_native_roots()
9268///         .unwrap()
9269///         .https_or_http()
9270///         .enable_http1()
9271///         .build()
9272/// );
9273/// let mut hub = Dfareporting::new(client, auth);
9274/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
9275/// // like `list(...)`
9276/// // to build up your call.
9277/// let rb = hub.cities();
9278/// # }
9279/// ```
9280pub struct CityMethods<'a, C>
9281where
9282    C: 'a,
9283{
9284    hub: &'a Dfareporting<C>,
9285}
9286
9287impl<'a, C> common::MethodsBuilder for CityMethods<'a, C> {}
9288
9289impl<'a, C> CityMethods<'a, C> {
9290    /// Create a builder to help you perform the following task:
9291    ///
9292    /// Retrieves a list of cities, possibly filtered.
9293    ///
9294    /// # Arguments
9295    ///
9296    /// * `profileId` - User profile ID associated with this request.
9297    pub fn list(&self, profile_id: i64) -> CityListCall<'a, C> {
9298        CityListCall {
9299            hub: self.hub,
9300            _profile_id: profile_id,
9301            _region_dart_ids: Default::default(),
9302            _name_prefix: Default::default(),
9303            _dart_ids: Default::default(),
9304            _country_dart_ids: Default::default(),
9305            _delegate: Default::default(),
9306            _additional_params: Default::default(),
9307            _scopes: Default::default(),
9308        }
9309    }
9310}
9311
9312/// A builder providing access to all methods supported on *connectionType* resources.
9313/// It is not used directly, but through the [`Dfareporting`] hub.
9314///
9315/// # Example
9316///
9317/// Instantiate a resource builder
9318///
9319/// ```test_harness,no_run
9320/// extern crate hyper;
9321/// extern crate hyper_rustls;
9322/// extern crate google_dfareporting3d3 as dfareporting3d3;
9323///
9324/// # async fn dox() {
9325/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9326///
9327/// let secret: yup_oauth2::ApplicationSecret = Default::default();
9328/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9329///     secret,
9330///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9331/// ).build().await.unwrap();
9332///
9333/// let client = hyper_util::client::legacy::Client::builder(
9334///     hyper_util::rt::TokioExecutor::new()
9335/// )
9336/// .build(
9337///     hyper_rustls::HttpsConnectorBuilder::new()
9338///         .with_native_roots()
9339///         .unwrap()
9340///         .https_or_http()
9341///         .enable_http1()
9342///         .build()
9343/// );
9344/// let mut hub = Dfareporting::new(client, auth);
9345/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
9346/// // like `get(...)` and `list(...)`
9347/// // to build up your call.
9348/// let rb = hub.connection_types();
9349/// # }
9350/// ```
9351pub struct ConnectionTypeMethods<'a, C>
9352where
9353    C: 'a,
9354{
9355    hub: &'a Dfareporting<C>,
9356}
9357
9358impl<'a, C> common::MethodsBuilder for ConnectionTypeMethods<'a, C> {}
9359
9360impl<'a, C> ConnectionTypeMethods<'a, C> {
9361    /// Create a builder to help you perform the following task:
9362    ///
9363    /// Gets one connection type by ID.
9364    ///
9365    /// # Arguments
9366    ///
9367    /// * `profileId` - User profile ID associated with this request.
9368    /// * `id` - Connection type ID.
9369    pub fn get(&self, profile_id: i64, id: i64) -> ConnectionTypeGetCall<'a, C> {
9370        ConnectionTypeGetCall {
9371            hub: self.hub,
9372            _profile_id: profile_id,
9373            _id: id,
9374            _delegate: Default::default(),
9375            _additional_params: Default::default(),
9376            _scopes: Default::default(),
9377        }
9378    }
9379
9380    /// Create a builder to help you perform the following task:
9381    ///
9382    /// Retrieves a list of connection types.
9383    ///
9384    /// # Arguments
9385    ///
9386    /// * `profileId` - User profile ID associated with this request.
9387    pub fn list(&self, profile_id: i64) -> ConnectionTypeListCall<'a, C> {
9388        ConnectionTypeListCall {
9389            hub: self.hub,
9390            _profile_id: profile_id,
9391            _delegate: Default::default(),
9392            _additional_params: Default::default(),
9393            _scopes: Default::default(),
9394        }
9395    }
9396}
9397
9398/// A builder providing access to all methods supported on *contentCategory* resources.
9399/// It is not used directly, but through the [`Dfareporting`] hub.
9400///
9401/// # Example
9402///
9403/// Instantiate a resource builder
9404///
9405/// ```test_harness,no_run
9406/// extern crate hyper;
9407/// extern crate hyper_rustls;
9408/// extern crate google_dfareporting3d3 as dfareporting3d3;
9409///
9410/// # async fn dox() {
9411/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9412///
9413/// let secret: yup_oauth2::ApplicationSecret = Default::default();
9414/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9415///     secret,
9416///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9417/// ).build().await.unwrap();
9418///
9419/// let client = hyper_util::client::legacy::Client::builder(
9420///     hyper_util::rt::TokioExecutor::new()
9421/// )
9422/// .build(
9423///     hyper_rustls::HttpsConnectorBuilder::new()
9424///         .with_native_roots()
9425///         .unwrap()
9426///         .https_or_http()
9427///         .enable_http1()
9428///         .build()
9429/// );
9430/// let mut hub = Dfareporting::new(client, auth);
9431/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
9432/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
9433/// // to build up your call.
9434/// let rb = hub.content_categories();
9435/// # }
9436/// ```
9437pub struct ContentCategoryMethods<'a, C>
9438where
9439    C: 'a,
9440{
9441    hub: &'a Dfareporting<C>,
9442}
9443
9444impl<'a, C> common::MethodsBuilder for ContentCategoryMethods<'a, C> {}
9445
9446impl<'a, C> ContentCategoryMethods<'a, C> {
9447    /// Create a builder to help you perform the following task:
9448    ///
9449    /// Deletes an existing content category.
9450    ///
9451    /// # Arguments
9452    ///
9453    /// * `profileId` - User profile ID associated with this request.
9454    /// * `id` - Content category ID.
9455    pub fn delete(&self, profile_id: i64, id: i64) -> ContentCategoryDeleteCall<'a, C> {
9456        ContentCategoryDeleteCall {
9457            hub: self.hub,
9458            _profile_id: profile_id,
9459            _id: id,
9460            _delegate: Default::default(),
9461            _additional_params: Default::default(),
9462            _scopes: Default::default(),
9463        }
9464    }
9465
9466    /// Create a builder to help you perform the following task:
9467    ///
9468    /// Gets one content category by ID.
9469    ///
9470    /// # Arguments
9471    ///
9472    /// * `profileId` - User profile ID associated with this request.
9473    /// * `id` - Content category ID.
9474    pub fn get(&self, profile_id: i64, id: i64) -> ContentCategoryGetCall<'a, C> {
9475        ContentCategoryGetCall {
9476            hub: self.hub,
9477            _profile_id: profile_id,
9478            _id: id,
9479            _delegate: Default::default(),
9480            _additional_params: Default::default(),
9481            _scopes: Default::default(),
9482        }
9483    }
9484
9485    /// Create a builder to help you perform the following task:
9486    ///
9487    /// Inserts a new content category.
9488    ///
9489    /// # Arguments
9490    ///
9491    /// * `request` - No description provided.
9492    /// * `profileId` - User profile ID associated with this request.
9493    pub fn insert(
9494        &self,
9495        request: ContentCategory,
9496        profile_id: i64,
9497    ) -> ContentCategoryInsertCall<'a, C> {
9498        ContentCategoryInsertCall {
9499            hub: self.hub,
9500            _request: request,
9501            _profile_id: profile_id,
9502            _delegate: Default::default(),
9503            _additional_params: Default::default(),
9504            _scopes: Default::default(),
9505        }
9506    }
9507
9508    /// Create a builder to help you perform the following task:
9509    ///
9510    /// Retrieves a list of content categories, possibly filtered. This method supports paging.
9511    ///
9512    /// # Arguments
9513    ///
9514    /// * `profileId` - User profile ID associated with this request.
9515    pub fn list(&self, profile_id: i64) -> ContentCategoryListCall<'a, C> {
9516        ContentCategoryListCall {
9517            hub: self.hub,
9518            _profile_id: profile_id,
9519            _sort_order: Default::default(),
9520            _sort_field: Default::default(),
9521            _search_string: Default::default(),
9522            _page_token: Default::default(),
9523            _max_results: Default::default(),
9524            _ids: Default::default(),
9525            _delegate: Default::default(),
9526            _additional_params: Default::default(),
9527            _scopes: Default::default(),
9528        }
9529    }
9530
9531    /// Create a builder to help you perform the following task:
9532    ///
9533    /// Updates an existing content category. This method supports patch semantics.
9534    ///
9535    /// # Arguments
9536    ///
9537    /// * `request` - No description provided.
9538    /// * `profileId` - User profile ID associated with this request.
9539    /// * `id` - ContentCategory ID.
9540    pub fn patch(
9541        &self,
9542        request: ContentCategory,
9543        profile_id: i64,
9544        id: i64,
9545    ) -> ContentCategoryPatchCall<'a, C> {
9546        ContentCategoryPatchCall {
9547            hub: self.hub,
9548            _request: request,
9549            _profile_id: profile_id,
9550            _id: id,
9551            _delegate: Default::default(),
9552            _additional_params: Default::default(),
9553            _scopes: Default::default(),
9554        }
9555    }
9556
9557    /// Create a builder to help you perform the following task:
9558    ///
9559    /// Updates an existing content category.
9560    ///
9561    /// # Arguments
9562    ///
9563    /// * `request` - No description provided.
9564    /// * `profileId` - User profile ID associated with this request.
9565    pub fn update(
9566        &self,
9567        request: ContentCategory,
9568        profile_id: i64,
9569    ) -> ContentCategoryUpdateCall<'a, C> {
9570        ContentCategoryUpdateCall {
9571            hub: self.hub,
9572            _request: request,
9573            _profile_id: profile_id,
9574            _delegate: Default::default(),
9575            _additional_params: Default::default(),
9576            _scopes: Default::default(),
9577        }
9578    }
9579}
9580
9581/// A builder providing access to all methods supported on *conversion* resources.
9582/// It is not used directly, but through the [`Dfareporting`] hub.
9583///
9584/// # Example
9585///
9586/// Instantiate a resource builder
9587///
9588/// ```test_harness,no_run
9589/// extern crate hyper;
9590/// extern crate hyper_rustls;
9591/// extern crate google_dfareporting3d3 as dfareporting3d3;
9592///
9593/// # async fn dox() {
9594/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9595///
9596/// let secret: yup_oauth2::ApplicationSecret = Default::default();
9597/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9598///     secret,
9599///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9600/// ).build().await.unwrap();
9601///
9602/// let client = hyper_util::client::legacy::Client::builder(
9603///     hyper_util::rt::TokioExecutor::new()
9604/// )
9605/// .build(
9606///     hyper_rustls::HttpsConnectorBuilder::new()
9607///         .with_native_roots()
9608///         .unwrap()
9609///         .https_or_http()
9610///         .enable_http1()
9611///         .build()
9612/// );
9613/// let mut hub = Dfareporting::new(client, auth);
9614/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
9615/// // like `batchinsert(...)` and `batchupdate(...)`
9616/// // to build up your call.
9617/// let rb = hub.conversions();
9618/// # }
9619/// ```
9620pub struct ConversionMethods<'a, C>
9621where
9622    C: 'a,
9623{
9624    hub: &'a Dfareporting<C>,
9625}
9626
9627impl<'a, C> common::MethodsBuilder for ConversionMethods<'a, C> {}
9628
9629impl<'a, C> ConversionMethods<'a, C> {
9630    /// Create a builder to help you perform the following task:
9631    ///
9632    /// Inserts conversions.
9633    ///
9634    /// # Arguments
9635    ///
9636    /// * `request` - No description provided.
9637    /// * `profileId` - User profile ID associated with this request.
9638    pub fn batchinsert(
9639        &self,
9640        request: ConversionsBatchInsertRequest,
9641        profile_id: i64,
9642    ) -> ConversionBatchinsertCall<'a, C> {
9643        ConversionBatchinsertCall {
9644            hub: self.hub,
9645            _request: request,
9646            _profile_id: profile_id,
9647            _delegate: Default::default(),
9648            _additional_params: Default::default(),
9649            _scopes: Default::default(),
9650        }
9651    }
9652
9653    /// Create a builder to help you perform the following task:
9654    ///
9655    /// Updates existing conversions.
9656    ///
9657    /// # Arguments
9658    ///
9659    /// * `request` - No description provided.
9660    /// * `profileId` - User profile ID associated with this request.
9661    pub fn batchupdate(
9662        &self,
9663        request: ConversionsBatchUpdateRequest,
9664        profile_id: i64,
9665    ) -> ConversionBatchupdateCall<'a, C> {
9666        ConversionBatchupdateCall {
9667            hub: self.hub,
9668            _request: request,
9669            _profile_id: profile_id,
9670            _delegate: Default::default(),
9671            _additional_params: Default::default(),
9672            _scopes: Default::default(),
9673        }
9674    }
9675}
9676
9677/// A builder providing access to all methods supported on *country* resources.
9678/// It is not used directly, but through the [`Dfareporting`] hub.
9679///
9680/// # Example
9681///
9682/// Instantiate a resource builder
9683///
9684/// ```test_harness,no_run
9685/// extern crate hyper;
9686/// extern crate hyper_rustls;
9687/// extern crate google_dfareporting3d3 as dfareporting3d3;
9688///
9689/// # async fn dox() {
9690/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9691///
9692/// let secret: yup_oauth2::ApplicationSecret = Default::default();
9693/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9694///     secret,
9695///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9696/// ).build().await.unwrap();
9697///
9698/// let client = hyper_util::client::legacy::Client::builder(
9699///     hyper_util::rt::TokioExecutor::new()
9700/// )
9701/// .build(
9702///     hyper_rustls::HttpsConnectorBuilder::new()
9703///         .with_native_roots()
9704///         .unwrap()
9705///         .https_or_http()
9706///         .enable_http1()
9707///         .build()
9708/// );
9709/// let mut hub = Dfareporting::new(client, auth);
9710/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
9711/// // like `get(...)` and `list(...)`
9712/// // to build up your call.
9713/// let rb = hub.countries();
9714/// # }
9715/// ```
9716pub struct CountryMethods<'a, C>
9717where
9718    C: 'a,
9719{
9720    hub: &'a Dfareporting<C>,
9721}
9722
9723impl<'a, C> common::MethodsBuilder for CountryMethods<'a, C> {}
9724
9725impl<'a, C> CountryMethods<'a, C> {
9726    /// Create a builder to help you perform the following task:
9727    ///
9728    /// Gets one country by ID.
9729    ///
9730    /// # Arguments
9731    ///
9732    /// * `profileId` - User profile ID associated with this request.
9733    /// * `dartId` - Country DART ID.
9734    pub fn get(&self, profile_id: i64, dart_id: i64) -> CountryGetCall<'a, C> {
9735        CountryGetCall {
9736            hub: self.hub,
9737            _profile_id: profile_id,
9738            _dart_id: dart_id,
9739            _delegate: Default::default(),
9740            _additional_params: Default::default(),
9741            _scopes: Default::default(),
9742        }
9743    }
9744
9745    /// Create a builder to help you perform the following task:
9746    ///
9747    /// Retrieves a list of countries.
9748    ///
9749    /// # Arguments
9750    ///
9751    /// * `profileId` - User profile ID associated with this request.
9752    pub fn list(&self, profile_id: i64) -> CountryListCall<'a, C> {
9753        CountryListCall {
9754            hub: self.hub,
9755            _profile_id: profile_id,
9756            _delegate: Default::default(),
9757            _additional_params: Default::default(),
9758            _scopes: Default::default(),
9759        }
9760    }
9761}
9762
9763/// A builder providing access to all methods supported on *creativeAsset* resources.
9764/// It is not used directly, but through the [`Dfareporting`] hub.
9765///
9766/// # Example
9767///
9768/// Instantiate a resource builder
9769///
9770/// ```test_harness,no_run
9771/// extern crate hyper;
9772/// extern crate hyper_rustls;
9773/// extern crate google_dfareporting3d3 as dfareporting3d3;
9774///
9775/// # async fn dox() {
9776/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9777///
9778/// let secret: yup_oauth2::ApplicationSecret = Default::default();
9779/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9780///     secret,
9781///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9782/// ).build().await.unwrap();
9783///
9784/// let client = hyper_util::client::legacy::Client::builder(
9785///     hyper_util::rt::TokioExecutor::new()
9786/// )
9787/// .build(
9788///     hyper_rustls::HttpsConnectorBuilder::new()
9789///         .with_native_roots()
9790///         .unwrap()
9791///         .https_or_http()
9792///         .enable_http1()
9793///         .build()
9794/// );
9795/// let mut hub = Dfareporting::new(client, auth);
9796/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
9797/// // like `insert(...)`
9798/// // to build up your call.
9799/// let rb = hub.creative_assets();
9800/// # }
9801/// ```
9802pub struct CreativeAssetMethods<'a, C>
9803where
9804    C: 'a,
9805{
9806    hub: &'a Dfareporting<C>,
9807}
9808
9809impl<'a, C> common::MethodsBuilder for CreativeAssetMethods<'a, C> {}
9810
9811impl<'a, C> CreativeAssetMethods<'a, C> {
9812    /// Create a builder to help you perform the following task:
9813    ///
9814    /// Inserts a new creative asset.
9815    ///
9816    /// # Arguments
9817    ///
9818    /// * `request` - No description provided.
9819    /// * `profileId` - User profile ID associated with this request.
9820    /// * `advertiserId` - Advertiser ID of this creative. This is a required field.
9821    pub fn insert(
9822        &self,
9823        request: CreativeAssetMetadata,
9824        profile_id: i64,
9825        advertiser_id: i64,
9826    ) -> CreativeAssetInsertCall<'a, C> {
9827        CreativeAssetInsertCall {
9828            hub: self.hub,
9829            _request: request,
9830            _profile_id: profile_id,
9831            _advertiser_id: advertiser_id,
9832            _delegate: Default::default(),
9833            _additional_params: Default::default(),
9834            _scopes: Default::default(),
9835        }
9836    }
9837}
9838
9839/// A builder providing access to all methods supported on *creativeFieldValue* resources.
9840/// It is not used directly, but through the [`Dfareporting`] hub.
9841///
9842/// # Example
9843///
9844/// Instantiate a resource builder
9845///
9846/// ```test_harness,no_run
9847/// extern crate hyper;
9848/// extern crate hyper_rustls;
9849/// extern crate google_dfareporting3d3 as dfareporting3d3;
9850///
9851/// # async fn dox() {
9852/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9853///
9854/// let secret: yup_oauth2::ApplicationSecret = Default::default();
9855/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9856///     secret,
9857///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9858/// ).build().await.unwrap();
9859///
9860/// let client = hyper_util::client::legacy::Client::builder(
9861///     hyper_util::rt::TokioExecutor::new()
9862/// )
9863/// .build(
9864///     hyper_rustls::HttpsConnectorBuilder::new()
9865///         .with_native_roots()
9866///         .unwrap()
9867///         .https_or_http()
9868///         .enable_http1()
9869///         .build()
9870/// );
9871/// let mut hub = Dfareporting::new(client, auth);
9872/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
9873/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
9874/// // to build up your call.
9875/// let rb = hub.creative_field_values();
9876/// # }
9877/// ```
9878pub struct CreativeFieldValueMethods<'a, C>
9879where
9880    C: 'a,
9881{
9882    hub: &'a Dfareporting<C>,
9883}
9884
9885impl<'a, C> common::MethodsBuilder for CreativeFieldValueMethods<'a, C> {}
9886
9887impl<'a, C> CreativeFieldValueMethods<'a, C> {
9888    /// Create a builder to help you perform the following task:
9889    ///
9890    /// Deletes an existing creative field value.
9891    ///
9892    /// # Arguments
9893    ///
9894    /// * `profileId` - User profile ID associated with this request.
9895    /// * `creativeFieldId` - Creative field ID for this creative field value.
9896    /// * `id` - Creative Field Value ID
9897    pub fn delete(
9898        &self,
9899        profile_id: i64,
9900        creative_field_id: i64,
9901        id: i64,
9902    ) -> CreativeFieldValueDeleteCall<'a, C> {
9903        CreativeFieldValueDeleteCall {
9904            hub: self.hub,
9905            _profile_id: profile_id,
9906            _creative_field_id: creative_field_id,
9907            _id: id,
9908            _delegate: Default::default(),
9909            _additional_params: Default::default(),
9910            _scopes: Default::default(),
9911        }
9912    }
9913
9914    /// Create a builder to help you perform the following task:
9915    ///
9916    /// Gets one creative field value by ID.
9917    ///
9918    /// # Arguments
9919    ///
9920    /// * `profileId` - User profile ID associated with this request.
9921    /// * `creativeFieldId` - Creative field ID for this creative field value.
9922    /// * `id` - Creative Field Value ID
9923    pub fn get(
9924        &self,
9925        profile_id: i64,
9926        creative_field_id: i64,
9927        id: i64,
9928    ) -> CreativeFieldValueGetCall<'a, C> {
9929        CreativeFieldValueGetCall {
9930            hub: self.hub,
9931            _profile_id: profile_id,
9932            _creative_field_id: creative_field_id,
9933            _id: id,
9934            _delegate: Default::default(),
9935            _additional_params: Default::default(),
9936            _scopes: Default::default(),
9937        }
9938    }
9939
9940    /// Create a builder to help you perform the following task:
9941    ///
9942    /// Inserts a new creative field value.
9943    ///
9944    /// # Arguments
9945    ///
9946    /// * `request` - No description provided.
9947    /// * `profileId` - User profile ID associated with this request.
9948    /// * `creativeFieldId` - Creative field ID for this creative field value.
9949    pub fn insert(
9950        &self,
9951        request: CreativeFieldValue,
9952        profile_id: i64,
9953        creative_field_id: i64,
9954    ) -> CreativeFieldValueInsertCall<'a, C> {
9955        CreativeFieldValueInsertCall {
9956            hub: self.hub,
9957            _request: request,
9958            _profile_id: profile_id,
9959            _creative_field_id: creative_field_id,
9960            _delegate: Default::default(),
9961            _additional_params: Default::default(),
9962            _scopes: Default::default(),
9963        }
9964    }
9965
9966    /// Create a builder to help you perform the following task:
9967    ///
9968    /// Retrieves a list of creative field values, possibly filtered. This method supports paging.
9969    ///
9970    /// # Arguments
9971    ///
9972    /// * `profileId` - User profile ID associated with this request.
9973    /// * `creativeFieldId` - Creative field ID for this creative field value.
9974    pub fn list(
9975        &self,
9976        profile_id: i64,
9977        creative_field_id: i64,
9978    ) -> CreativeFieldValueListCall<'a, C> {
9979        CreativeFieldValueListCall {
9980            hub: self.hub,
9981            _profile_id: profile_id,
9982            _creative_field_id: creative_field_id,
9983            _sort_order: Default::default(),
9984            _sort_field: Default::default(),
9985            _search_string: Default::default(),
9986            _page_token: Default::default(),
9987            _max_results: Default::default(),
9988            _ids: Default::default(),
9989            _delegate: Default::default(),
9990            _additional_params: Default::default(),
9991            _scopes: Default::default(),
9992        }
9993    }
9994
9995    /// Create a builder to help you perform the following task:
9996    ///
9997    /// Updates an existing creative field value. This method supports patch semantics.
9998    ///
9999    /// # Arguments
10000    ///
10001    /// * `request` - No description provided.
10002    /// * `profileId` - User profile ID associated with this request.
10003    /// * `creativeFieldId` - CreativeField ID.
10004    /// * `id` - CreativeFieldValue ID.
10005    pub fn patch(
10006        &self,
10007        request: CreativeFieldValue,
10008        profile_id: i64,
10009        creative_field_id: i64,
10010        id: i64,
10011    ) -> CreativeFieldValuePatchCall<'a, C> {
10012        CreativeFieldValuePatchCall {
10013            hub: self.hub,
10014            _request: request,
10015            _profile_id: profile_id,
10016            _creative_field_id: creative_field_id,
10017            _id: id,
10018            _delegate: Default::default(),
10019            _additional_params: Default::default(),
10020            _scopes: Default::default(),
10021        }
10022    }
10023
10024    /// Create a builder to help you perform the following task:
10025    ///
10026    /// Updates an existing creative field value.
10027    ///
10028    /// # Arguments
10029    ///
10030    /// * `request` - No description provided.
10031    /// * `profileId` - User profile ID associated with this request.
10032    /// * `creativeFieldId` - Creative field ID for this creative field value.
10033    pub fn update(
10034        &self,
10035        request: CreativeFieldValue,
10036        profile_id: i64,
10037        creative_field_id: i64,
10038    ) -> CreativeFieldValueUpdateCall<'a, C> {
10039        CreativeFieldValueUpdateCall {
10040            hub: self.hub,
10041            _request: request,
10042            _profile_id: profile_id,
10043            _creative_field_id: creative_field_id,
10044            _delegate: Default::default(),
10045            _additional_params: Default::default(),
10046            _scopes: Default::default(),
10047        }
10048    }
10049}
10050
10051/// A builder providing access to all methods supported on *creativeField* resources.
10052/// It is not used directly, but through the [`Dfareporting`] hub.
10053///
10054/// # Example
10055///
10056/// Instantiate a resource builder
10057///
10058/// ```test_harness,no_run
10059/// extern crate hyper;
10060/// extern crate hyper_rustls;
10061/// extern crate google_dfareporting3d3 as dfareporting3d3;
10062///
10063/// # async fn dox() {
10064/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10065///
10066/// let secret: yup_oauth2::ApplicationSecret = Default::default();
10067/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10068///     secret,
10069///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10070/// ).build().await.unwrap();
10071///
10072/// let client = hyper_util::client::legacy::Client::builder(
10073///     hyper_util::rt::TokioExecutor::new()
10074/// )
10075/// .build(
10076///     hyper_rustls::HttpsConnectorBuilder::new()
10077///         .with_native_roots()
10078///         .unwrap()
10079///         .https_or_http()
10080///         .enable_http1()
10081///         .build()
10082/// );
10083/// let mut hub = Dfareporting::new(client, auth);
10084/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
10085/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
10086/// // to build up your call.
10087/// let rb = hub.creative_fields();
10088/// # }
10089/// ```
10090pub struct CreativeFieldMethods<'a, C>
10091where
10092    C: 'a,
10093{
10094    hub: &'a Dfareporting<C>,
10095}
10096
10097impl<'a, C> common::MethodsBuilder for CreativeFieldMethods<'a, C> {}
10098
10099impl<'a, C> CreativeFieldMethods<'a, C> {
10100    /// Create a builder to help you perform the following task:
10101    ///
10102    /// Deletes an existing creative field.
10103    ///
10104    /// # Arguments
10105    ///
10106    /// * `profileId` - User profile ID associated with this request.
10107    /// * `id` - Creative Field ID
10108    pub fn delete(&self, profile_id: i64, id: i64) -> CreativeFieldDeleteCall<'a, C> {
10109        CreativeFieldDeleteCall {
10110            hub: self.hub,
10111            _profile_id: profile_id,
10112            _id: id,
10113            _delegate: Default::default(),
10114            _additional_params: Default::default(),
10115            _scopes: Default::default(),
10116        }
10117    }
10118
10119    /// Create a builder to help you perform the following task:
10120    ///
10121    /// Gets one creative field by ID.
10122    ///
10123    /// # Arguments
10124    ///
10125    /// * `profileId` - User profile ID associated with this request.
10126    /// * `id` - Creative Field ID
10127    pub fn get(&self, profile_id: i64, id: i64) -> CreativeFieldGetCall<'a, C> {
10128        CreativeFieldGetCall {
10129            hub: self.hub,
10130            _profile_id: profile_id,
10131            _id: id,
10132            _delegate: Default::default(),
10133            _additional_params: Default::default(),
10134            _scopes: Default::default(),
10135        }
10136    }
10137
10138    /// Create a builder to help you perform the following task:
10139    ///
10140    /// Inserts a new creative field.
10141    ///
10142    /// # Arguments
10143    ///
10144    /// * `request` - No description provided.
10145    /// * `profileId` - User profile ID associated with this request.
10146    pub fn insert(
10147        &self,
10148        request: CreativeField,
10149        profile_id: i64,
10150    ) -> CreativeFieldInsertCall<'a, C> {
10151        CreativeFieldInsertCall {
10152            hub: self.hub,
10153            _request: request,
10154            _profile_id: profile_id,
10155            _delegate: Default::default(),
10156            _additional_params: Default::default(),
10157            _scopes: Default::default(),
10158        }
10159    }
10160
10161    /// Create a builder to help you perform the following task:
10162    ///
10163    /// Retrieves a list of creative fields, possibly filtered. This method supports paging.
10164    ///
10165    /// # Arguments
10166    ///
10167    /// * `profileId` - User profile ID associated with this request.
10168    pub fn list(&self, profile_id: i64) -> CreativeFieldListCall<'a, C> {
10169        CreativeFieldListCall {
10170            hub: self.hub,
10171            _profile_id: profile_id,
10172            _sort_order: Default::default(),
10173            _sort_field: Default::default(),
10174            _search_string: Default::default(),
10175            _page_token: Default::default(),
10176            _max_results: Default::default(),
10177            _ids: Default::default(),
10178            _advertiser_ids: Default::default(),
10179            _delegate: Default::default(),
10180            _additional_params: Default::default(),
10181            _scopes: Default::default(),
10182        }
10183    }
10184
10185    /// Create a builder to help you perform the following task:
10186    ///
10187    /// Updates an existing creative field. This method supports patch semantics.
10188    ///
10189    /// # Arguments
10190    ///
10191    /// * `request` - No description provided.
10192    /// * `profileId` - User profile ID associated with this request.
10193    /// * `id` - CreativeField ID.
10194    pub fn patch(
10195        &self,
10196        request: CreativeField,
10197        profile_id: i64,
10198        id: i64,
10199    ) -> CreativeFieldPatchCall<'a, C> {
10200        CreativeFieldPatchCall {
10201            hub: self.hub,
10202            _request: request,
10203            _profile_id: profile_id,
10204            _id: id,
10205            _delegate: Default::default(),
10206            _additional_params: Default::default(),
10207            _scopes: Default::default(),
10208        }
10209    }
10210
10211    /// Create a builder to help you perform the following task:
10212    ///
10213    /// Updates an existing creative field.
10214    ///
10215    /// # Arguments
10216    ///
10217    /// * `request` - No description provided.
10218    /// * `profileId` - User profile ID associated with this request.
10219    pub fn update(
10220        &self,
10221        request: CreativeField,
10222        profile_id: i64,
10223    ) -> CreativeFieldUpdateCall<'a, C> {
10224        CreativeFieldUpdateCall {
10225            hub: self.hub,
10226            _request: request,
10227            _profile_id: profile_id,
10228            _delegate: Default::default(),
10229            _additional_params: Default::default(),
10230            _scopes: Default::default(),
10231        }
10232    }
10233}
10234
10235/// A builder providing access to all methods supported on *creativeGroup* resources.
10236/// It is not used directly, but through the [`Dfareporting`] hub.
10237///
10238/// # Example
10239///
10240/// Instantiate a resource builder
10241///
10242/// ```test_harness,no_run
10243/// extern crate hyper;
10244/// extern crate hyper_rustls;
10245/// extern crate google_dfareporting3d3 as dfareporting3d3;
10246///
10247/// # async fn dox() {
10248/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10249///
10250/// let secret: yup_oauth2::ApplicationSecret = Default::default();
10251/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10252///     secret,
10253///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10254/// ).build().await.unwrap();
10255///
10256/// let client = hyper_util::client::legacy::Client::builder(
10257///     hyper_util::rt::TokioExecutor::new()
10258/// )
10259/// .build(
10260///     hyper_rustls::HttpsConnectorBuilder::new()
10261///         .with_native_roots()
10262///         .unwrap()
10263///         .https_or_http()
10264///         .enable_http1()
10265///         .build()
10266/// );
10267/// let mut hub = Dfareporting::new(client, auth);
10268/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
10269/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
10270/// // to build up your call.
10271/// let rb = hub.creative_groups();
10272/// # }
10273/// ```
10274pub struct CreativeGroupMethods<'a, C>
10275where
10276    C: 'a,
10277{
10278    hub: &'a Dfareporting<C>,
10279}
10280
10281impl<'a, C> common::MethodsBuilder for CreativeGroupMethods<'a, C> {}
10282
10283impl<'a, C> CreativeGroupMethods<'a, C> {
10284    /// Create a builder to help you perform the following task:
10285    ///
10286    /// Gets one creative group by ID.
10287    ///
10288    /// # Arguments
10289    ///
10290    /// * `profileId` - User profile ID associated with this request.
10291    /// * `id` - Creative group ID.
10292    pub fn get(&self, profile_id: i64, id: i64) -> CreativeGroupGetCall<'a, C> {
10293        CreativeGroupGetCall {
10294            hub: self.hub,
10295            _profile_id: profile_id,
10296            _id: id,
10297            _delegate: Default::default(),
10298            _additional_params: Default::default(),
10299            _scopes: Default::default(),
10300        }
10301    }
10302
10303    /// Create a builder to help you perform the following task:
10304    ///
10305    /// Inserts a new creative group.
10306    ///
10307    /// # Arguments
10308    ///
10309    /// * `request` - No description provided.
10310    /// * `profileId` - User profile ID associated with this request.
10311    pub fn insert(
10312        &self,
10313        request: CreativeGroup,
10314        profile_id: i64,
10315    ) -> CreativeGroupInsertCall<'a, C> {
10316        CreativeGroupInsertCall {
10317            hub: self.hub,
10318            _request: request,
10319            _profile_id: profile_id,
10320            _delegate: Default::default(),
10321            _additional_params: Default::default(),
10322            _scopes: Default::default(),
10323        }
10324    }
10325
10326    /// Create a builder to help you perform the following task:
10327    ///
10328    /// Retrieves a list of creative groups, possibly filtered. This method supports paging.
10329    ///
10330    /// # Arguments
10331    ///
10332    /// * `profileId` - User profile ID associated with this request.
10333    pub fn list(&self, profile_id: i64) -> CreativeGroupListCall<'a, C> {
10334        CreativeGroupListCall {
10335            hub: self.hub,
10336            _profile_id: profile_id,
10337            _sort_order: Default::default(),
10338            _sort_field: Default::default(),
10339            _search_string: Default::default(),
10340            _page_token: Default::default(),
10341            _max_results: Default::default(),
10342            _ids: Default::default(),
10343            _group_number: Default::default(),
10344            _advertiser_ids: Default::default(),
10345            _delegate: Default::default(),
10346            _additional_params: Default::default(),
10347            _scopes: Default::default(),
10348        }
10349    }
10350
10351    /// Create a builder to help you perform the following task:
10352    ///
10353    /// Updates an existing creative group. This method supports patch semantics.
10354    ///
10355    /// # Arguments
10356    ///
10357    /// * `request` - No description provided.
10358    /// * `profileId` - User profile ID associated with this request.
10359    /// * `id` - CreativeGroup ID.
10360    pub fn patch(
10361        &self,
10362        request: CreativeGroup,
10363        profile_id: i64,
10364        id: i64,
10365    ) -> CreativeGroupPatchCall<'a, C> {
10366        CreativeGroupPatchCall {
10367            hub: self.hub,
10368            _request: request,
10369            _profile_id: profile_id,
10370            _id: id,
10371            _delegate: Default::default(),
10372            _additional_params: Default::default(),
10373            _scopes: Default::default(),
10374        }
10375    }
10376
10377    /// Create a builder to help you perform the following task:
10378    ///
10379    /// Updates an existing creative group.
10380    ///
10381    /// # Arguments
10382    ///
10383    /// * `request` - No description provided.
10384    /// * `profileId` - User profile ID associated with this request.
10385    pub fn update(
10386        &self,
10387        request: CreativeGroup,
10388        profile_id: i64,
10389    ) -> CreativeGroupUpdateCall<'a, C> {
10390        CreativeGroupUpdateCall {
10391            hub: self.hub,
10392            _request: request,
10393            _profile_id: profile_id,
10394            _delegate: Default::default(),
10395            _additional_params: Default::default(),
10396            _scopes: Default::default(),
10397        }
10398    }
10399}
10400
10401/// A builder providing access to all methods supported on *creative* resources.
10402/// It is not used directly, but through the [`Dfareporting`] hub.
10403///
10404/// # Example
10405///
10406/// Instantiate a resource builder
10407///
10408/// ```test_harness,no_run
10409/// extern crate hyper;
10410/// extern crate hyper_rustls;
10411/// extern crate google_dfareporting3d3 as dfareporting3d3;
10412///
10413/// # async fn dox() {
10414/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10415///
10416/// let secret: yup_oauth2::ApplicationSecret = Default::default();
10417/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10418///     secret,
10419///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10420/// ).build().await.unwrap();
10421///
10422/// let client = hyper_util::client::legacy::Client::builder(
10423///     hyper_util::rt::TokioExecutor::new()
10424/// )
10425/// .build(
10426///     hyper_rustls::HttpsConnectorBuilder::new()
10427///         .with_native_roots()
10428///         .unwrap()
10429///         .https_or_http()
10430///         .enable_http1()
10431///         .build()
10432/// );
10433/// let mut hub = Dfareporting::new(client, auth);
10434/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
10435/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
10436/// // to build up your call.
10437/// let rb = hub.creatives();
10438/// # }
10439/// ```
10440pub struct CreativeMethods<'a, C>
10441where
10442    C: 'a,
10443{
10444    hub: &'a Dfareporting<C>,
10445}
10446
10447impl<'a, C> common::MethodsBuilder for CreativeMethods<'a, C> {}
10448
10449impl<'a, C> CreativeMethods<'a, C> {
10450    /// Create a builder to help you perform the following task:
10451    ///
10452    /// Gets one creative by ID.
10453    ///
10454    /// # Arguments
10455    ///
10456    /// * `profileId` - User profile ID associated with this request.
10457    /// * `id` - Creative ID.
10458    pub fn get(&self, profile_id: i64, id: i64) -> CreativeGetCall<'a, C> {
10459        CreativeGetCall {
10460            hub: self.hub,
10461            _profile_id: profile_id,
10462            _id: id,
10463            _delegate: Default::default(),
10464            _additional_params: Default::default(),
10465            _scopes: Default::default(),
10466        }
10467    }
10468
10469    /// Create a builder to help you perform the following task:
10470    ///
10471    /// Inserts a new creative.
10472    ///
10473    /// # Arguments
10474    ///
10475    /// * `request` - No description provided.
10476    /// * `profileId` - User profile ID associated with this request.
10477    pub fn insert(&self, request: Creative, profile_id: i64) -> CreativeInsertCall<'a, C> {
10478        CreativeInsertCall {
10479            hub: self.hub,
10480            _request: request,
10481            _profile_id: profile_id,
10482            _delegate: Default::default(),
10483            _additional_params: Default::default(),
10484            _scopes: Default::default(),
10485        }
10486    }
10487
10488    /// Create a builder to help you perform the following task:
10489    ///
10490    /// Retrieves a list of creatives, possibly filtered. This method supports paging.
10491    ///
10492    /// # Arguments
10493    ///
10494    /// * `profileId` - User profile ID associated with this request.
10495    pub fn list(&self, profile_id: i64) -> CreativeListCall<'a, C> {
10496        CreativeListCall {
10497            hub: self.hub,
10498            _profile_id: profile_id,
10499            _types: Default::default(),
10500            _studio_creative_id: Default::default(),
10501            _sort_order: Default::default(),
10502            _sort_field: Default::default(),
10503            _size_ids: Default::default(),
10504            _search_string: Default::default(),
10505            _rendering_ids: Default::default(),
10506            _page_token: Default::default(),
10507            _max_results: Default::default(),
10508            _ids: Default::default(),
10509            _creative_field_ids: Default::default(),
10510            _companion_creative_ids: Default::default(),
10511            _campaign_id: Default::default(),
10512            _archived: Default::default(),
10513            _advertiser_id: Default::default(),
10514            _active: Default::default(),
10515            _delegate: Default::default(),
10516            _additional_params: Default::default(),
10517            _scopes: Default::default(),
10518        }
10519    }
10520
10521    /// Create a builder to help you perform the following task:
10522    ///
10523    /// Updates an existing creative. This method supports patch semantics.
10524    ///
10525    /// # Arguments
10526    ///
10527    /// * `request` - No description provided.
10528    /// * `profileId` - User profile ID associated with this request.
10529    /// * `id` - Creative ID.
10530    pub fn patch(&self, request: Creative, profile_id: i64, id: i64) -> CreativePatchCall<'a, C> {
10531        CreativePatchCall {
10532            hub: self.hub,
10533            _request: request,
10534            _profile_id: profile_id,
10535            _id: id,
10536            _delegate: Default::default(),
10537            _additional_params: Default::default(),
10538            _scopes: Default::default(),
10539        }
10540    }
10541
10542    /// Create a builder to help you perform the following task:
10543    ///
10544    /// Updates an existing creative.
10545    ///
10546    /// # Arguments
10547    ///
10548    /// * `request` - No description provided.
10549    /// * `profileId` - User profile ID associated with this request.
10550    pub fn update(&self, request: Creative, profile_id: i64) -> CreativeUpdateCall<'a, C> {
10551        CreativeUpdateCall {
10552            hub: self.hub,
10553            _request: request,
10554            _profile_id: profile_id,
10555            _delegate: Default::default(),
10556            _additional_params: Default::default(),
10557            _scopes: Default::default(),
10558        }
10559    }
10560}
10561
10562/// A builder providing access to all methods supported on *dimensionValue* resources.
10563/// It is not used directly, but through the [`Dfareporting`] hub.
10564///
10565/// # Example
10566///
10567/// Instantiate a resource builder
10568///
10569/// ```test_harness,no_run
10570/// extern crate hyper;
10571/// extern crate hyper_rustls;
10572/// extern crate google_dfareporting3d3 as dfareporting3d3;
10573///
10574/// # async fn dox() {
10575/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10576///
10577/// let secret: yup_oauth2::ApplicationSecret = Default::default();
10578/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10579///     secret,
10580///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10581/// ).build().await.unwrap();
10582///
10583/// let client = hyper_util::client::legacy::Client::builder(
10584///     hyper_util::rt::TokioExecutor::new()
10585/// )
10586/// .build(
10587///     hyper_rustls::HttpsConnectorBuilder::new()
10588///         .with_native_roots()
10589///         .unwrap()
10590///         .https_or_http()
10591///         .enable_http1()
10592///         .build()
10593/// );
10594/// let mut hub = Dfareporting::new(client, auth);
10595/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
10596/// // like `query(...)`
10597/// // to build up your call.
10598/// let rb = hub.dimension_values();
10599/// # }
10600/// ```
10601pub struct DimensionValueMethods<'a, C>
10602where
10603    C: 'a,
10604{
10605    hub: &'a Dfareporting<C>,
10606}
10607
10608impl<'a, C> common::MethodsBuilder for DimensionValueMethods<'a, C> {}
10609
10610impl<'a, C> DimensionValueMethods<'a, C> {
10611    /// Create a builder to help you perform the following task:
10612    ///
10613    /// Retrieves list of report dimension values for a list of filters.
10614    ///
10615    /// # Arguments
10616    ///
10617    /// * `request` - No description provided.
10618    /// * `profileId` - The Campaign Manager 360 user profile ID.
10619    pub fn query(
10620        &self,
10621        request: DimensionValueRequest,
10622        profile_id: i64,
10623    ) -> DimensionValueQueryCall<'a, C> {
10624        DimensionValueQueryCall {
10625            hub: self.hub,
10626            _request: request,
10627            _profile_id: profile_id,
10628            _page_token: Default::default(),
10629            _max_results: Default::default(),
10630            _delegate: Default::default(),
10631            _additional_params: Default::default(),
10632            _scopes: Default::default(),
10633        }
10634    }
10635}
10636
10637/// A builder providing access to all methods supported on *directorySite* resources.
10638/// It is not used directly, but through the [`Dfareporting`] hub.
10639///
10640/// # Example
10641///
10642/// Instantiate a resource builder
10643///
10644/// ```test_harness,no_run
10645/// extern crate hyper;
10646/// extern crate hyper_rustls;
10647/// extern crate google_dfareporting3d3 as dfareporting3d3;
10648///
10649/// # async fn dox() {
10650/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10651///
10652/// let secret: yup_oauth2::ApplicationSecret = Default::default();
10653/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10654///     secret,
10655///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10656/// ).build().await.unwrap();
10657///
10658/// let client = hyper_util::client::legacy::Client::builder(
10659///     hyper_util::rt::TokioExecutor::new()
10660/// )
10661/// .build(
10662///     hyper_rustls::HttpsConnectorBuilder::new()
10663///         .with_native_roots()
10664///         .unwrap()
10665///         .https_or_http()
10666///         .enable_http1()
10667///         .build()
10668/// );
10669/// let mut hub = Dfareporting::new(client, auth);
10670/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
10671/// // like `get(...)`, `insert(...)` and `list(...)`
10672/// // to build up your call.
10673/// let rb = hub.directory_sites();
10674/// # }
10675/// ```
10676pub struct DirectorySiteMethods<'a, C>
10677where
10678    C: 'a,
10679{
10680    hub: &'a Dfareporting<C>,
10681}
10682
10683impl<'a, C> common::MethodsBuilder for DirectorySiteMethods<'a, C> {}
10684
10685impl<'a, C> DirectorySiteMethods<'a, C> {
10686    /// Create a builder to help you perform the following task:
10687    ///
10688    /// Gets one directory site by ID.
10689    ///
10690    /// # Arguments
10691    ///
10692    /// * `profileId` - User profile ID associated with this request.
10693    /// * `id` - Directory site ID.
10694    pub fn get(&self, profile_id: i64, id: i64) -> DirectorySiteGetCall<'a, C> {
10695        DirectorySiteGetCall {
10696            hub: self.hub,
10697            _profile_id: profile_id,
10698            _id: id,
10699            _delegate: Default::default(),
10700            _additional_params: Default::default(),
10701            _scopes: Default::default(),
10702        }
10703    }
10704
10705    /// Create a builder to help you perform the following task:
10706    ///
10707    /// Inserts a new directory site.
10708    ///
10709    /// # Arguments
10710    ///
10711    /// * `request` - No description provided.
10712    /// * `profileId` - User profile ID associated with this request.
10713    pub fn insert(
10714        &self,
10715        request: DirectorySite,
10716        profile_id: i64,
10717    ) -> DirectorySiteInsertCall<'a, C> {
10718        DirectorySiteInsertCall {
10719            hub: self.hub,
10720            _request: request,
10721            _profile_id: profile_id,
10722            _delegate: Default::default(),
10723            _additional_params: Default::default(),
10724            _scopes: Default::default(),
10725        }
10726    }
10727
10728    /// Create a builder to help you perform the following task:
10729    ///
10730    /// Retrieves a list of directory sites, possibly filtered. This method supports paging.
10731    ///
10732    /// # Arguments
10733    ///
10734    /// * `profileId` - User profile ID associated with this request.
10735    pub fn list(&self, profile_id: i64) -> DirectorySiteListCall<'a, C> {
10736        DirectorySiteListCall {
10737            hub: self.hub,
10738            _profile_id: profile_id,
10739            _sort_order: Default::default(),
10740            _sort_field: Default::default(),
10741            _search_string: Default::default(),
10742            _page_token: Default::default(),
10743            _max_results: Default::default(),
10744            _ids: Default::default(),
10745            _dfp_network_code: Default::default(),
10746            _active: Default::default(),
10747            _accepts_publisher_paid_placements: Default::default(),
10748            _accepts_interstitial_placements: Default::default(),
10749            _accepts_in_stream_video_placements: Default::default(),
10750            _delegate: Default::default(),
10751            _additional_params: Default::default(),
10752            _scopes: Default::default(),
10753        }
10754    }
10755}
10756
10757/// A builder providing access to all methods supported on *dynamicTargetingKey* resources.
10758/// It is not used directly, but through the [`Dfareporting`] hub.
10759///
10760/// # Example
10761///
10762/// Instantiate a resource builder
10763///
10764/// ```test_harness,no_run
10765/// extern crate hyper;
10766/// extern crate hyper_rustls;
10767/// extern crate google_dfareporting3d3 as dfareporting3d3;
10768///
10769/// # async fn dox() {
10770/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10771///
10772/// let secret: yup_oauth2::ApplicationSecret = Default::default();
10773/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10774///     secret,
10775///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10776/// ).build().await.unwrap();
10777///
10778/// let client = hyper_util::client::legacy::Client::builder(
10779///     hyper_util::rt::TokioExecutor::new()
10780/// )
10781/// .build(
10782///     hyper_rustls::HttpsConnectorBuilder::new()
10783///         .with_native_roots()
10784///         .unwrap()
10785///         .https_or_http()
10786///         .enable_http1()
10787///         .build()
10788/// );
10789/// let mut hub = Dfareporting::new(client, auth);
10790/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
10791/// // like `delete(...)`, `insert(...)` and `list(...)`
10792/// // to build up your call.
10793/// let rb = hub.dynamic_targeting_keys();
10794/// # }
10795/// ```
10796pub struct DynamicTargetingKeyMethods<'a, C>
10797where
10798    C: 'a,
10799{
10800    hub: &'a Dfareporting<C>,
10801}
10802
10803impl<'a, C> common::MethodsBuilder for DynamicTargetingKeyMethods<'a, C> {}
10804
10805impl<'a, C> DynamicTargetingKeyMethods<'a, C> {
10806    /// Create a builder to help you perform the following task:
10807    ///
10808    /// Deletes an existing dynamic targeting key.
10809    ///
10810    /// # Arguments
10811    ///
10812    /// * `profileId` - User profile ID associated with this request.
10813    /// * `objectId` - ID of the object of this dynamic targeting key. This is a required field.
10814    /// * `name` - Name of this dynamic targeting key. This is a required field. Must be less than 256 characters long and cannot contain commas. All characters are converted to lowercase.
10815    /// * `objectType` - Type of the object of this dynamic targeting key. This is a required field.
10816    pub fn delete(
10817        &self,
10818        profile_id: i64,
10819        object_id: i64,
10820        name: &str,
10821        object_type: &str,
10822    ) -> DynamicTargetingKeyDeleteCall<'a, C> {
10823        DynamicTargetingKeyDeleteCall {
10824            hub: self.hub,
10825            _profile_id: profile_id,
10826            _object_id: object_id,
10827            _name: name.to_string(),
10828            _object_type: object_type.to_string(),
10829            _delegate: Default::default(),
10830            _additional_params: Default::default(),
10831            _scopes: Default::default(),
10832        }
10833    }
10834
10835    /// Create a builder to help you perform the following task:
10836    ///
10837    /// Inserts a new dynamic targeting key. Keys must be created at the advertiser level before being assigned to the advertiser's ads, creatives, or placements. There is a maximum of 1000 keys per advertiser, out of which a maximum of 20 keys can be assigned per ad, creative, or placement.
10838    ///
10839    /// # Arguments
10840    ///
10841    /// * `request` - No description provided.
10842    /// * `profileId` - User profile ID associated with this request.
10843    pub fn insert(
10844        &self,
10845        request: DynamicTargetingKey,
10846        profile_id: i64,
10847    ) -> DynamicTargetingKeyInsertCall<'a, C> {
10848        DynamicTargetingKeyInsertCall {
10849            hub: self.hub,
10850            _request: request,
10851            _profile_id: profile_id,
10852            _delegate: Default::default(),
10853            _additional_params: Default::default(),
10854            _scopes: Default::default(),
10855        }
10856    }
10857
10858    /// Create a builder to help you perform the following task:
10859    ///
10860    /// Retrieves a list of dynamic targeting keys.
10861    ///
10862    /// # Arguments
10863    ///
10864    /// * `profileId` - User profile ID associated with this request.
10865    pub fn list(&self, profile_id: i64) -> DynamicTargetingKeyListCall<'a, C> {
10866        DynamicTargetingKeyListCall {
10867            hub: self.hub,
10868            _profile_id: profile_id,
10869            _object_type: Default::default(),
10870            _object_id: Default::default(),
10871            _names: Default::default(),
10872            _advertiser_id: Default::default(),
10873            _delegate: Default::default(),
10874            _additional_params: Default::default(),
10875            _scopes: Default::default(),
10876        }
10877    }
10878}
10879
10880/// A builder providing access to all methods supported on *eventTag* resources.
10881/// It is not used directly, but through the [`Dfareporting`] hub.
10882///
10883/// # Example
10884///
10885/// Instantiate a resource builder
10886///
10887/// ```test_harness,no_run
10888/// extern crate hyper;
10889/// extern crate hyper_rustls;
10890/// extern crate google_dfareporting3d3 as dfareporting3d3;
10891///
10892/// # async fn dox() {
10893/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10894///
10895/// let secret: yup_oauth2::ApplicationSecret = Default::default();
10896/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10897///     secret,
10898///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10899/// ).build().await.unwrap();
10900///
10901/// let client = hyper_util::client::legacy::Client::builder(
10902///     hyper_util::rt::TokioExecutor::new()
10903/// )
10904/// .build(
10905///     hyper_rustls::HttpsConnectorBuilder::new()
10906///         .with_native_roots()
10907///         .unwrap()
10908///         .https_or_http()
10909///         .enable_http1()
10910///         .build()
10911/// );
10912/// let mut hub = Dfareporting::new(client, auth);
10913/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
10914/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
10915/// // to build up your call.
10916/// let rb = hub.event_tags();
10917/// # }
10918/// ```
10919pub struct EventTagMethods<'a, C>
10920where
10921    C: 'a,
10922{
10923    hub: &'a Dfareporting<C>,
10924}
10925
10926impl<'a, C> common::MethodsBuilder for EventTagMethods<'a, C> {}
10927
10928impl<'a, C> EventTagMethods<'a, C> {
10929    /// Create a builder to help you perform the following task:
10930    ///
10931    /// Deletes an existing event tag.
10932    ///
10933    /// # Arguments
10934    ///
10935    /// * `profileId` - User profile ID associated with this request.
10936    /// * `id` - Event tag ID.
10937    pub fn delete(&self, profile_id: i64, id: i64) -> EventTagDeleteCall<'a, C> {
10938        EventTagDeleteCall {
10939            hub: self.hub,
10940            _profile_id: profile_id,
10941            _id: id,
10942            _delegate: Default::default(),
10943            _additional_params: Default::default(),
10944            _scopes: Default::default(),
10945        }
10946    }
10947
10948    /// Create a builder to help you perform the following task:
10949    ///
10950    /// Gets one event tag by ID.
10951    ///
10952    /// # Arguments
10953    ///
10954    /// * `profileId` - User profile ID associated with this request.
10955    /// * `id` - Event tag ID.
10956    pub fn get(&self, profile_id: i64, id: i64) -> EventTagGetCall<'a, C> {
10957        EventTagGetCall {
10958            hub: self.hub,
10959            _profile_id: profile_id,
10960            _id: id,
10961            _delegate: Default::default(),
10962            _additional_params: Default::default(),
10963            _scopes: Default::default(),
10964        }
10965    }
10966
10967    /// Create a builder to help you perform the following task:
10968    ///
10969    /// Inserts a new event tag.
10970    ///
10971    /// # Arguments
10972    ///
10973    /// * `request` - No description provided.
10974    /// * `profileId` - User profile ID associated with this request.
10975    pub fn insert(&self, request: EventTag, profile_id: i64) -> EventTagInsertCall<'a, C> {
10976        EventTagInsertCall {
10977            hub: self.hub,
10978            _request: request,
10979            _profile_id: profile_id,
10980            _delegate: Default::default(),
10981            _additional_params: Default::default(),
10982            _scopes: Default::default(),
10983        }
10984    }
10985
10986    /// Create a builder to help you perform the following task:
10987    ///
10988    /// Retrieves a list of event tags, possibly filtered.
10989    ///
10990    /// # Arguments
10991    ///
10992    /// * `profileId` - User profile ID associated with this request.
10993    pub fn list(&self, profile_id: i64) -> EventTagListCall<'a, C> {
10994        EventTagListCall {
10995            hub: self.hub,
10996            _profile_id: profile_id,
10997            _sort_order: Default::default(),
10998            _sort_field: Default::default(),
10999            _search_string: Default::default(),
11000            _ids: Default::default(),
11001            _event_tag_types: Default::default(),
11002            _enabled: Default::default(),
11003            _definitions_only: Default::default(),
11004            _campaign_id: Default::default(),
11005            _advertiser_id: Default::default(),
11006            _ad_id: Default::default(),
11007            _delegate: Default::default(),
11008            _additional_params: Default::default(),
11009            _scopes: Default::default(),
11010        }
11011    }
11012
11013    /// Create a builder to help you perform the following task:
11014    ///
11015    /// Updates an existing event tag. This method supports patch semantics.
11016    ///
11017    /// # Arguments
11018    ///
11019    /// * `request` - No description provided.
11020    /// * `profileId` - User profile ID associated with this request.
11021    /// * `id` - EventTag ID.
11022    pub fn patch(&self, request: EventTag, profile_id: i64, id: i64) -> EventTagPatchCall<'a, C> {
11023        EventTagPatchCall {
11024            hub: self.hub,
11025            _request: request,
11026            _profile_id: profile_id,
11027            _id: id,
11028            _delegate: Default::default(),
11029            _additional_params: Default::default(),
11030            _scopes: Default::default(),
11031        }
11032    }
11033
11034    /// Create a builder to help you perform the following task:
11035    ///
11036    /// Updates an existing event tag.
11037    ///
11038    /// # Arguments
11039    ///
11040    /// * `request` - No description provided.
11041    /// * `profileId` - User profile ID associated with this request.
11042    pub fn update(&self, request: EventTag, profile_id: i64) -> EventTagUpdateCall<'a, C> {
11043        EventTagUpdateCall {
11044            hub: self.hub,
11045            _request: request,
11046            _profile_id: profile_id,
11047            _delegate: Default::default(),
11048            _additional_params: Default::default(),
11049            _scopes: Default::default(),
11050        }
11051    }
11052}
11053
11054/// A builder providing access to all methods supported on *file* resources.
11055/// It is not used directly, but through the [`Dfareporting`] hub.
11056///
11057/// # Example
11058///
11059/// Instantiate a resource builder
11060///
11061/// ```test_harness,no_run
11062/// extern crate hyper;
11063/// extern crate hyper_rustls;
11064/// extern crate google_dfareporting3d3 as dfareporting3d3;
11065///
11066/// # async fn dox() {
11067/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11068///
11069/// let secret: yup_oauth2::ApplicationSecret = Default::default();
11070/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11071///     secret,
11072///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11073/// ).build().await.unwrap();
11074///
11075/// let client = hyper_util::client::legacy::Client::builder(
11076///     hyper_util::rt::TokioExecutor::new()
11077/// )
11078/// .build(
11079///     hyper_rustls::HttpsConnectorBuilder::new()
11080///         .with_native_roots()
11081///         .unwrap()
11082///         .https_or_http()
11083///         .enable_http1()
11084///         .build()
11085/// );
11086/// let mut hub = Dfareporting::new(client, auth);
11087/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
11088/// // like `get(...)` and `list(...)`
11089/// // to build up your call.
11090/// let rb = hub.files();
11091/// # }
11092/// ```
11093pub struct FileMethods<'a, C>
11094where
11095    C: 'a,
11096{
11097    hub: &'a Dfareporting<C>,
11098}
11099
11100impl<'a, C> common::MethodsBuilder for FileMethods<'a, C> {}
11101
11102impl<'a, C> FileMethods<'a, C> {
11103    /// Create a builder to help you perform the following task:
11104    ///
11105    /// Retrieves a report file by its report ID and file ID. This method supports media download.
11106    ///
11107    /// # Arguments
11108    ///
11109    /// * `reportId` - The ID of the report.
11110    /// * `fileId` - The ID of the report file.
11111    pub fn get(&self, report_id: i64, file_id: i64) -> FileGetCall<'a, C> {
11112        FileGetCall {
11113            hub: self.hub,
11114            _report_id: report_id,
11115            _file_id: file_id,
11116            _delegate: Default::default(),
11117            _additional_params: Default::default(),
11118            _scopes: Default::default(),
11119        }
11120    }
11121
11122    /// Create a builder to help you perform the following task:
11123    ///
11124    /// Lists files for a user profile.
11125    ///
11126    /// # Arguments
11127    ///
11128    /// * `profileId` - The Campaign Manager 360 user profile ID.
11129    pub fn list(&self, profile_id: i64) -> FileListCall<'a, C> {
11130        FileListCall {
11131            hub: self.hub,
11132            _profile_id: profile_id,
11133            _sort_order: Default::default(),
11134            _sort_field: Default::default(),
11135            _scope: Default::default(),
11136            _page_token: Default::default(),
11137            _max_results: Default::default(),
11138            _delegate: Default::default(),
11139            _additional_params: Default::default(),
11140            _scopes: Default::default(),
11141        }
11142    }
11143}
11144
11145/// A builder providing access to all methods supported on *floodlightActivity* resources.
11146/// It is not used directly, but through the [`Dfareporting`] hub.
11147///
11148/// # Example
11149///
11150/// Instantiate a resource builder
11151///
11152/// ```test_harness,no_run
11153/// extern crate hyper;
11154/// extern crate hyper_rustls;
11155/// extern crate google_dfareporting3d3 as dfareporting3d3;
11156///
11157/// # async fn dox() {
11158/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11159///
11160/// let secret: yup_oauth2::ApplicationSecret = Default::default();
11161/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11162///     secret,
11163///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11164/// ).build().await.unwrap();
11165///
11166/// let client = hyper_util::client::legacy::Client::builder(
11167///     hyper_util::rt::TokioExecutor::new()
11168/// )
11169/// .build(
11170///     hyper_rustls::HttpsConnectorBuilder::new()
11171///         .with_native_roots()
11172///         .unwrap()
11173///         .https_or_http()
11174///         .enable_http1()
11175///         .build()
11176/// );
11177/// let mut hub = Dfareporting::new(client, auth);
11178/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
11179/// // like `delete(...)`, `generatetag(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
11180/// // to build up your call.
11181/// let rb = hub.floodlight_activities();
11182/// # }
11183/// ```
11184pub struct FloodlightActivityMethods<'a, C>
11185where
11186    C: 'a,
11187{
11188    hub: &'a Dfareporting<C>,
11189}
11190
11191impl<'a, C> common::MethodsBuilder for FloodlightActivityMethods<'a, C> {}
11192
11193impl<'a, C> FloodlightActivityMethods<'a, C> {
11194    /// Create a builder to help you perform the following task:
11195    ///
11196    /// Deletes an existing floodlight activity.
11197    ///
11198    /// # Arguments
11199    ///
11200    /// * `profileId` - User profile ID associated with this request.
11201    /// * `id` - Floodlight activity ID.
11202    pub fn delete(&self, profile_id: i64, id: i64) -> FloodlightActivityDeleteCall<'a, C> {
11203        FloodlightActivityDeleteCall {
11204            hub: self.hub,
11205            _profile_id: profile_id,
11206            _id: id,
11207            _delegate: Default::default(),
11208            _additional_params: Default::default(),
11209            _scopes: Default::default(),
11210        }
11211    }
11212
11213    /// Create a builder to help you perform the following task:
11214    ///
11215    /// Generates a tag for a floodlight activity.
11216    ///
11217    /// # Arguments
11218    ///
11219    /// * `profileId` - User profile ID associated with this request.
11220    pub fn generatetag(&self, profile_id: i64) -> FloodlightActivityGeneratetagCall<'a, C> {
11221        FloodlightActivityGeneratetagCall {
11222            hub: self.hub,
11223            _profile_id: profile_id,
11224            _floodlight_activity_id: Default::default(),
11225            _delegate: Default::default(),
11226            _additional_params: Default::default(),
11227            _scopes: Default::default(),
11228        }
11229    }
11230
11231    /// Create a builder to help you perform the following task:
11232    ///
11233    /// Gets one floodlight activity by ID.
11234    ///
11235    /// # Arguments
11236    ///
11237    /// * `profileId` - User profile ID associated with this request.
11238    /// * `id` - Floodlight activity ID.
11239    pub fn get(&self, profile_id: i64, id: i64) -> FloodlightActivityGetCall<'a, C> {
11240        FloodlightActivityGetCall {
11241            hub: self.hub,
11242            _profile_id: profile_id,
11243            _id: id,
11244            _delegate: Default::default(),
11245            _additional_params: Default::default(),
11246            _scopes: Default::default(),
11247        }
11248    }
11249
11250    /// Create a builder to help you perform the following task:
11251    ///
11252    /// Inserts a new floodlight activity.
11253    ///
11254    /// # Arguments
11255    ///
11256    /// * `request` - No description provided.
11257    /// * `profileId` - User profile ID associated with this request.
11258    pub fn insert(
11259        &self,
11260        request: FloodlightActivity,
11261        profile_id: i64,
11262    ) -> FloodlightActivityInsertCall<'a, C> {
11263        FloodlightActivityInsertCall {
11264            hub: self.hub,
11265            _request: request,
11266            _profile_id: profile_id,
11267            _delegate: Default::default(),
11268            _additional_params: Default::default(),
11269            _scopes: Default::default(),
11270        }
11271    }
11272
11273    /// Create a builder to help you perform the following task:
11274    ///
11275    /// Retrieves a list of floodlight activities, possibly filtered. This method supports paging.
11276    ///
11277    /// # Arguments
11278    ///
11279    /// * `profileId` - User profile ID associated with this request.
11280    pub fn list(&self, profile_id: i64) -> FloodlightActivityListCall<'a, C> {
11281        FloodlightActivityListCall {
11282            hub: self.hub,
11283            _profile_id: profile_id,
11284            _tag_string: Default::default(),
11285            _sort_order: Default::default(),
11286            _sort_field: Default::default(),
11287            _search_string: Default::default(),
11288            _page_token: Default::default(),
11289            _max_results: Default::default(),
11290            _ids: Default::default(),
11291            _floodlight_configuration_id: Default::default(),
11292            _floodlight_activity_group_type: Default::default(),
11293            _floodlight_activity_group_tag_string: Default::default(),
11294            _floodlight_activity_group_name: Default::default(),
11295            _floodlight_activity_group_ids: Default::default(),
11296            _advertiser_id: Default::default(),
11297            _delegate: Default::default(),
11298            _additional_params: Default::default(),
11299            _scopes: Default::default(),
11300        }
11301    }
11302
11303    /// Create a builder to help you perform the following task:
11304    ///
11305    /// Updates an existing floodlight activity. This method supports patch semantics.
11306    ///
11307    /// # Arguments
11308    ///
11309    /// * `request` - No description provided.
11310    /// * `profileId` - User profile ID associated with this request.
11311    /// * `id` - FloodlightActivity ID.
11312    pub fn patch(
11313        &self,
11314        request: FloodlightActivity,
11315        profile_id: i64,
11316        id: i64,
11317    ) -> FloodlightActivityPatchCall<'a, C> {
11318        FloodlightActivityPatchCall {
11319            hub: self.hub,
11320            _request: request,
11321            _profile_id: profile_id,
11322            _id: id,
11323            _delegate: Default::default(),
11324            _additional_params: Default::default(),
11325            _scopes: Default::default(),
11326        }
11327    }
11328
11329    /// Create a builder to help you perform the following task:
11330    ///
11331    /// Updates an existing floodlight activity.
11332    ///
11333    /// # Arguments
11334    ///
11335    /// * `request` - No description provided.
11336    /// * `profileId` - User profile ID associated with this request.
11337    pub fn update(
11338        &self,
11339        request: FloodlightActivity,
11340        profile_id: i64,
11341    ) -> FloodlightActivityUpdateCall<'a, C> {
11342        FloodlightActivityUpdateCall {
11343            hub: self.hub,
11344            _request: request,
11345            _profile_id: profile_id,
11346            _delegate: Default::default(),
11347            _additional_params: Default::default(),
11348            _scopes: Default::default(),
11349        }
11350    }
11351}
11352
11353/// A builder providing access to all methods supported on *floodlightActivityGroup* resources.
11354/// It is not used directly, but through the [`Dfareporting`] hub.
11355///
11356/// # Example
11357///
11358/// Instantiate a resource builder
11359///
11360/// ```test_harness,no_run
11361/// extern crate hyper;
11362/// extern crate hyper_rustls;
11363/// extern crate google_dfareporting3d3 as dfareporting3d3;
11364///
11365/// # async fn dox() {
11366/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11367///
11368/// let secret: yup_oauth2::ApplicationSecret = Default::default();
11369/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11370///     secret,
11371///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11372/// ).build().await.unwrap();
11373///
11374/// let client = hyper_util::client::legacy::Client::builder(
11375///     hyper_util::rt::TokioExecutor::new()
11376/// )
11377/// .build(
11378///     hyper_rustls::HttpsConnectorBuilder::new()
11379///         .with_native_roots()
11380///         .unwrap()
11381///         .https_or_http()
11382///         .enable_http1()
11383///         .build()
11384/// );
11385/// let mut hub = Dfareporting::new(client, auth);
11386/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
11387/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
11388/// // to build up your call.
11389/// let rb = hub.floodlight_activity_groups();
11390/// # }
11391/// ```
11392pub struct FloodlightActivityGroupMethods<'a, C>
11393where
11394    C: 'a,
11395{
11396    hub: &'a Dfareporting<C>,
11397}
11398
11399impl<'a, C> common::MethodsBuilder for FloodlightActivityGroupMethods<'a, C> {}
11400
11401impl<'a, C> FloodlightActivityGroupMethods<'a, C> {
11402    /// Create a builder to help you perform the following task:
11403    ///
11404    /// Gets one floodlight activity group by ID.
11405    ///
11406    /// # Arguments
11407    ///
11408    /// * `profileId` - User profile ID associated with this request.
11409    /// * `id` - Floodlight activity Group ID.
11410    pub fn get(&self, profile_id: i64, id: i64) -> FloodlightActivityGroupGetCall<'a, C> {
11411        FloodlightActivityGroupGetCall {
11412            hub: self.hub,
11413            _profile_id: profile_id,
11414            _id: id,
11415            _delegate: Default::default(),
11416            _additional_params: Default::default(),
11417            _scopes: Default::default(),
11418        }
11419    }
11420
11421    /// Create a builder to help you perform the following task:
11422    ///
11423    /// Inserts a new floodlight activity group.
11424    ///
11425    /// # Arguments
11426    ///
11427    /// * `request` - No description provided.
11428    /// * `profileId` - User profile ID associated with this request.
11429    pub fn insert(
11430        &self,
11431        request: FloodlightActivityGroup,
11432        profile_id: i64,
11433    ) -> FloodlightActivityGroupInsertCall<'a, C> {
11434        FloodlightActivityGroupInsertCall {
11435            hub: self.hub,
11436            _request: request,
11437            _profile_id: profile_id,
11438            _delegate: Default::default(),
11439            _additional_params: Default::default(),
11440            _scopes: Default::default(),
11441        }
11442    }
11443
11444    /// Create a builder to help you perform the following task:
11445    ///
11446    /// Retrieves a list of floodlight activity groups, possibly filtered. This method supports paging.
11447    ///
11448    /// # Arguments
11449    ///
11450    /// * `profileId` - User profile ID associated with this request.
11451    pub fn list(&self, profile_id: i64) -> FloodlightActivityGroupListCall<'a, C> {
11452        FloodlightActivityGroupListCall {
11453            hub: self.hub,
11454            _profile_id: profile_id,
11455            _type_: Default::default(),
11456            _sort_order: Default::default(),
11457            _sort_field: Default::default(),
11458            _search_string: Default::default(),
11459            _page_token: Default::default(),
11460            _max_results: Default::default(),
11461            _ids: Default::default(),
11462            _floodlight_configuration_id: Default::default(),
11463            _advertiser_id: Default::default(),
11464            _delegate: Default::default(),
11465            _additional_params: Default::default(),
11466            _scopes: Default::default(),
11467        }
11468    }
11469
11470    /// Create a builder to help you perform the following task:
11471    ///
11472    /// Updates an existing floodlight activity group. This method supports patch semantics.
11473    ///
11474    /// # Arguments
11475    ///
11476    /// * `request` - No description provided.
11477    /// * `profileId` - User profile ID associated with this request.
11478    /// * `id` - FloodlightActivityGroup ID.
11479    pub fn patch(
11480        &self,
11481        request: FloodlightActivityGroup,
11482        profile_id: i64,
11483        id: i64,
11484    ) -> FloodlightActivityGroupPatchCall<'a, C> {
11485        FloodlightActivityGroupPatchCall {
11486            hub: self.hub,
11487            _request: request,
11488            _profile_id: profile_id,
11489            _id: id,
11490            _delegate: Default::default(),
11491            _additional_params: Default::default(),
11492            _scopes: Default::default(),
11493        }
11494    }
11495
11496    /// Create a builder to help you perform the following task:
11497    ///
11498    /// Updates an existing floodlight activity group.
11499    ///
11500    /// # Arguments
11501    ///
11502    /// * `request` - No description provided.
11503    /// * `profileId` - User profile ID associated with this request.
11504    pub fn update(
11505        &self,
11506        request: FloodlightActivityGroup,
11507        profile_id: i64,
11508    ) -> FloodlightActivityGroupUpdateCall<'a, C> {
11509        FloodlightActivityGroupUpdateCall {
11510            hub: self.hub,
11511            _request: request,
11512            _profile_id: profile_id,
11513            _delegate: Default::default(),
11514            _additional_params: Default::default(),
11515            _scopes: Default::default(),
11516        }
11517    }
11518}
11519
11520/// A builder providing access to all methods supported on *floodlightConfiguration* resources.
11521/// It is not used directly, but through the [`Dfareporting`] hub.
11522///
11523/// # Example
11524///
11525/// Instantiate a resource builder
11526///
11527/// ```test_harness,no_run
11528/// extern crate hyper;
11529/// extern crate hyper_rustls;
11530/// extern crate google_dfareporting3d3 as dfareporting3d3;
11531///
11532/// # async fn dox() {
11533/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11534///
11535/// let secret: yup_oauth2::ApplicationSecret = Default::default();
11536/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11537///     secret,
11538///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11539/// ).build().await.unwrap();
11540///
11541/// let client = hyper_util::client::legacy::Client::builder(
11542///     hyper_util::rt::TokioExecutor::new()
11543/// )
11544/// .build(
11545///     hyper_rustls::HttpsConnectorBuilder::new()
11546///         .with_native_roots()
11547///         .unwrap()
11548///         .https_or_http()
11549///         .enable_http1()
11550///         .build()
11551/// );
11552/// let mut hub = Dfareporting::new(client, auth);
11553/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
11554/// // like `get(...)`, `list(...)`, `patch(...)` and `update(...)`
11555/// // to build up your call.
11556/// let rb = hub.floodlight_configurations();
11557/// # }
11558/// ```
11559pub struct FloodlightConfigurationMethods<'a, C>
11560where
11561    C: 'a,
11562{
11563    hub: &'a Dfareporting<C>,
11564}
11565
11566impl<'a, C> common::MethodsBuilder for FloodlightConfigurationMethods<'a, C> {}
11567
11568impl<'a, C> FloodlightConfigurationMethods<'a, C> {
11569    /// Create a builder to help you perform the following task:
11570    ///
11571    /// Gets one floodlight configuration by ID.
11572    ///
11573    /// # Arguments
11574    ///
11575    /// * `profileId` - User profile ID associated with this request.
11576    /// * `id` - Floodlight configuration ID.
11577    pub fn get(&self, profile_id: i64, id: i64) -> FloodlightConfigurationGetCall<'a, C> {
11578        FloodlightConfigurationGetCall {
11579            hub: self.hub,
11580            _profile_id: profile_id,
11581            _id: id,
11582            _delegate: Default::default(),
11583            _additional_params: Default::default(),
11584            _scopes: Default::default(),
11585        }
11586    }
11587
11588    /// Create a builder to help you perform the following task:
11589    ///
11590    /// Retrieves a list of floodlight configurations, possibly filtered.
11591    ///
11592    /// # Arguments
11593    ///
11594    /// * `profileId` - User profile ID associated with this request.
11595    pub fn list(&self, profile_id: i64) -> FloodlightConfigurationListCall<'a, C> {
11596        FloodlightConfigurationListCall {
11597            hub: self.hub,
11598            _profile_id: profile_id,
11599            _ids: Default::default(),
11600            _delegate: Default::default(),
11601            _additional_params: Default::default(),
11602            _scopes: Default::default(),
11603        }
11604    }
11605
11606    /// Create a builder to help you perform the following task:
11607    ///
11608    /// Updates an existing floodlight configuration. This method supports patch semantics.
11609    ///
11610    /// # Arguments
11611    ///
11612    /// * `request` - No description provided.
11613    /// * `profileId` - User profile ID associated with this request.
11614    /// * `id` - FloodlightConfiguration ID.
11615    pub fn patch(
11616        &self,
11617        request: FloodlightConfiguration,
11618        profile_id: i64,
11619        id: i64,
11620    ) -> FloodlightConfigurationPatchCall<'a, C> {
11621        FloodlightConfigurationPatchCall {
11622            hub: self.hub,
11623            _request: request,
11624            _profile_id: profile_id,
11625            _id: id,
11626            _delegate: Default::default(),
11627            _additional_params: Default::default(),
11628            _scopes: Default::default(),
11629        }
11630    }
11631
11632    /// Create a builder to help you perform the following task:
11633    ///
11634    /// Updates an existing floodlight configuration.
11635    ///
11636    /// # Arguments
11637    ///
11638    /// * `request` - No description provided.
11639    /// * `profileId` - User profile ID associated with this request.
11640    pub fn update(
11641        &self,
11642        request: FloodlightConfiguration,
11643        profile_id: i64,
11644    ) -> FloodlightConfigurationUpdateCall<'a, C> {
11645        FloodlightConfigurationUpdateCall {
11646            hub: self.hub,
11647            _request: request,
11648            _profile_id: profile_id,
11649            _delegate: Default::default(),
11650            _additional_params: Default::default(),
11651            _scopes: Default::default(),
11652        }
11653    }
11654}
11655
11656/// A builder providing access to all methods supported on *inventoryItem* resources.
11657/// It is not used directly, but through the [`Dfareporting`] hub.
11658///
11659/// # Example
11660///
11661/// Instantiate a resource builder
11662///
11663/// ```test_harness,no_run
11664/// extern crate hyper;
11665/// extern crate hyper_rustls;
11666/// extern crate google_dfareporting3d3 as dfareporting3d3;
11667///
11668/// # async fn dox() {
11669/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11670///
11671/// let secret: yup_oauth2::ApplicationSecret = Default::default();
11672/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11673///     secret,
11674///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11675/// ).build().await.unwrap();
11676///
11677/// let client = hyper_util::client::legacy::Client::builder(
11678///     hyper_util::rt::TokioExecutor::new()
11679/// )
11680/// .build(
11681///     hyper_rustls::HttpsConnectorBuilder::new()
11682///         .with_native_roots()
11683///         .unwrap()
11684///         .https_or_http()
11685///         .enable_http1()
11686///         .build()
11687/// );
11688/// let mut hub = Dfareporting::new(client, auth);
11689/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
11690/// // like `get(...)` and `list(...)`
11691/// // to build up your call.
11692/// let rb = hub.inventory_items();
11693/// # }
11694/// ```
11695pub struct InventoryItemMethods<'a, C>
11696where
11697    C: 'a,
11698{
11699    hub: &'a Dfareporting<C>,
11700}
11701
11702impl<'a, C> common::MethodsBuilder for InventoryItemMethods<'a, C> {}
11703
11704impl<'a, C> InventoryItemMethods<'a, C> {
11705    /// Create a builder to help you perform the following task:
11706    ///
11707    /// Gets one inventory item by ID.
11708    ///
11709    /// # Arguments
11710    ///
11711    /// * `profileId` - User profile ID associated with this request.
11712    /// * `projectId` - Project ID for order documents.
11713    /// * `id` - Inventory item ID.
11714    pub fn get(&self, profile_id: i64, project_id: i64, id: i64) -> InventoryItemGetCall<'a, C> {
11715        InventoryItemGetCall {
11716            hub: self.hub,
11717            _profile_id: profile_id,
11718            _project_id: project_id,
11719            _id: id,
11720            _delegate: Default::default(),
11721            _additional_params: Default::default(),
11722            _scopes: Default::default(),
11723        }
11724    }
11725
11726    /// Create a builder to help you perform the following task:
11727    ///
11728    /// Retrieves a list of inventory items, possibly filtered. This method supports paging.
11729    ///
11730    /// # Arguments
11731    ///
11732    /// * `profileId` - User profile ID associated with this request.
11733    /// * `projectId` - Project ID for order documents.
11734    pub fn list(&self, profile_id: i64, project_id: i64) -> InventoryItemListCall<'a, C> {
11735        InventoryItemListCall {
11736            hub: self.hub,
11737            _profile_id: profile_id,
11738            _project_id: project_id,
11739            _type_: Default::default(),
11740            _sort_order: Default::default(),
11741            _sort_field: Default::default(),
11742            _site_id: Default::default(),
11743            _page_token: Default::default(),
11744            _order_id: Default::default(),
11745            _max_results: Default::default(),
11746            _in_plan: Default::default(),
11747            _ids: Default::default(),
11748            _delegate: Default::default(),
11749            _additional_params: Default::default(),
11750            _scopes: Default::default(),
11751        }
11752    }
11753}
11754
11755/// A builder providing access to all methods supported on *language* resources.
11756/// It is not used directly, but through the [`Dfareporting`] hub.
11757///
11758/// # Example
11759///
11760/// Instantiate a resource builder
11761///
11762/// ```test_harness,no_run
11763/// extern crate hyper;
11764/// extern crate hyper_rustls;
11765/// extern crate google_dfareporting3d3 as dfareporting3d3;
11766///
11767/// # async fn dox() {
11768/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11769///
11770/// let secret: yup_oauth2::ApplicationSecret = Default::default();
11771/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11772///     secret,
11773///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11774/// ).build().await.unwrap();
11775///
11776/// let client = hyper_util::client::legacy::Client::builder(
11777///     hyper_util::rt::TokioExecutor::new()
11778/// )
11779/// .build(
11780///     hyper_rustls::HttpsConnectorBuilder::new()
11781///         .with_native_roots()
11782///         .unwrap()
11783///         .https_or_http()
11784///         .enable_http1()
11785///         .build()
11786/// );
11787/// let mut hub = Dfareporting::new(client, auth);
11788/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
11789/// // like `list(...)`
11790/// // to build up your call.
11791/// let rb = hub.languages();
11792/// # }
11793/// ```
11794pub struct LanguageMethods<'a, C>
11795where
11796    C: 'a,
11797{
11798    hub: &'a Dfareporting<C>,
11799}
11800
11801impl<'a, C> common::MethodsBuilder for LanguageMethods<'a, C> {}
11802
11803impl<'a, C> LanguageMethods<'a, C> {
11804    /// Create a builder to help you perform the following task:
11805    ///
11806    /// Retrieves a list of languages.
11807    ///
11808    /// # Arguments
11809    ///
11810    /// * `profileId` - User profile ID associated with this request.
11811    pub fn list(&self, profile_id: i64) -> LanguageListCall<'a, C> {
11812        LanguageListCall {
11813            hub: self.hub,
11814            _profile_id: profile_id,
11815            _delegate: Default::default(),
11816            _additional_params: Default::default(),
11817            _scopes: Default::default(),
11818        }
11819    }
11820}
11821
11822/// A builder providing access to all methods supported on *metro* resources.
11823/// It is not used directly, but through the [`Dfareporting`] hub.
11824///
11825/// # Example
11826///
11827/// Instantiate a resource builder
11828///
11829/// ```test_harness,no_run
11830/// extern crate hyper;
11831/// extern crate hyper_rustls;
11832/// extern crate google_dfareporting3d3 as dfareporting3d3;
11833///
11834/// # async fn dox() {
11835/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11836///
11837/// let secret: yup_oauth2::ApplicationSecret = Default::default();
11838/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11839///     secret,
11840///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11841/// ).build().await.unwrap();
11842///
11843/// let client = hyper_util::client::legacy::Client::builder(
11844///     hyper_util::rt::TokioExecutor::new()
11845/// )
11846/// .build(
11847///     hyper_rustls::HttpsConnectorBuilder::new()
11848///         .with_native_roots()
11849///         .unwrap()
11850///         .https_or_http()
11851///         .enable_http1()
11852///         .build()
11853/// );
11854/// let mut hub = Dfareporting::new(client, auth);
11855/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
11856/// // like `list(...)`
11857/// // to build up your call.
11858/// let rb = hub.metros();
11859/// # }
11860/// ```
11861pub struct MetroMethods<'a, C>
11862where
11863    C: 'a,
11864{
11865    hub: &'a Dfareporting<C>,
11866}
11867
11868impl<'a, C> common::MethodsBuilder for MetroMethods<'a, C> {}
11869
11870impl<'a, C> MetroMethods<'a, C> {
11871    /// Create a builder to help you perform the following task:
11872    ///
11873    /// Retrieves a list of metros.
11874    ///
11875    /// # Arguments
11876    ///
11877    /// * `profileId` - User profile ID associated with this request.
11878    pub fn list(&self, profile_id: i64) -> MetroListCall<'a, C> {
11879        MetroListCall {
11880            hub: self.hub,
11881            _profile_id: profile_id,
11882            _delegate: Default::default(),
11883            _additional_params: Default::default(),
11884            _scopes: Default::default(),
11885        }
11886    }
11887}
11888
11889/// A builder providing access to all methods supported on *mobileApp* resources.
11890/// It is not used directly, but through the [`Dfareporting`] hub.
11891///
11892/// # Example
11893///
11894/// Instantiate a resource builder
11895///
11896/// ```test_harness,no_run
11897/// extern crate hyper;
11898/// extern crate hyper_rustls;
11899/// extern crate google_dfareporting3d3 as dfareporting3d3;
11900///
11901/// # async fn dox() {
11902/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11903///
11904/// let secret: yup_oauth2::ApplicationSecret = Default::default();
11905/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11906///     secret,
11907///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11908/// ).build().await.unwrap();
11909///
11910/// let client = hyper_util::client::legacy::Client::builder(
11911///     hyper_util::rt::TokioExecutor::new()
11912/// )
11913/// .build(
11914///     hyper_rustls::HttpsConnectorBuilder::new()
11915///         .with_native_roots()
11916///         .unwrap()
11917///         .https_or_http()
11918///         .enable_http1()
11919///         .build()
11920/// );
11921/// let mut hub = Dfareporting::new(client, auth);
11922/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
11923/// // like `get(...)` and `list(...)`
11924/// // to build up your call.
11925/// let rb = hub.mobile_apps();
11926/// # }
11927/// ```
11928pub struct MobileAppMethods<'a, C>
11929where
11930    C: 'a,
11931{
11932    hub: &'a Dfareporting<C>,
11933}
11934
11935impl<'a, C> common::MethodsBuilder for MobileAppMethods<'a, C> {}
11936
11937impl<'a, C> MobileAppMethods<'a, C> {
11938    /// Create a builder to help you perform the following task:
11939    ///
11940    /// Gets one mobile app by ID.
11941    ///
11942    /// # Arguments
11943    ///
11944    /// * `profileId` - User profile ID associated with this request.
11945    /// * `id` - Mobile app ID.
11946    pub fn get(&self, profile_id: i64, id: &str) -> MobileAppGetCall<'a, C> {
11947        MobileAppGetCall {
11948            hub: self.hub,
11949            _profile_id: profile_id,
11950            _id: id.to_string(),
11951            _delegate: Default::default(),
11952            _additional_params: Default::default(),
11953            _scopes: Default::default(),
11954        }
11955    }
11956
11957    /// Create a builder to help you perform the following task:
11958    ///
11959    /// Retrieves list of available mobile apps.
11960    ///
11961    /// # Arguments
11962    ///
11963    /// * `profileId` - User profile ID associated with this request.
11964    pub fn list(&self, profile_id: i64) -> MobileAppListCall<'a, C> {
11965        MobileAppListCall {
11966            hub: self.hub,
11967            _profile_id: profile_id,
11968            _search_string: Default::default(),
11969            _page_token: Default::default(),
11970            _max_results: Default::default(),
11971            _ids: Default::default(),
11972            _directories: Default::default(),
11973            _delegate: Default::default(),
11974            _additional_params: Default::default(),
11975            _scopes: Default::default(),
11976        }
11977    }
11978}
11979
11980/// A builder providing access to all methods supported on *mobileCarrier* resources.
11981/// It is not used directly, but through the [`Dfareporting`] hub.
11982///
11983/// # Example
11984///
11985/// Instantiate a resource builder
11986///
11987/// ```test_harness,no_run
11988/// extern crate hyper;
11989/// extern crate hyper_rustls;
11990/// extern crate google_dfareporting3d3 as dfareporting3d3;
11991///
11992/// # async fn dox() {
11993/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11994///
11995/// let secret: yup_oauth2::ApplicationSecret = Default::default();
11996/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11997///     secret,
11998///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11999/// ).build().await.unwrap();
12000///
12001/// let client = hyper_util::client::legacy::Client::builder(
12002///     hyper_util::rt::TokioExecutor::new()
12003/// )
12004/// .build(
12005///     hyper_rustls::HttpsConnectorBuilder::new()
12006///         .with_native_roots()
12007///         .unwrap()
12008///         .https_or_http()
12009///         .enable_http1()
12010///         .build()
12011/// );
12012/// let mut hub = Dfareporting::new(client, auth);
12013/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
12014/// // like `get(...)` and `list(...)`
12015/// // to build up your call.
12016/// let rb = hub.mobile_carriers();
12017/// # }
12018/// ```
12019pub struct MobileCarrierMethods<'a, C>
12020where
12021    C: 'a,
12022{
12023    hub: &'a Dfareporting<C>,
12024}
12025
12026impl<'a, C> common::MethodsBuilder for MobileCarrierMethods<'a, C> {}
12027
12028impl<'a, C> MobileCarrierMethods<'a, C> {
12029    /// Create a builder to help you perform the following task:
12030    ///
12031    /// Gets one mobile carrier by ID.
12032    ///
12033    /// # Arguments
12034    ///
12035    /// * `profileId` - User profile ID associated with this request.
12036    /// * `id` - Mobile carrier ID.
12037    pub fn get(&self, profile_id: i64, id: i64) -> MobileCarrierGetCall<'a, C> {
12038        MobileCarrierGetCall {
12039            hub: self.hub,
12040            _profile_id: profile_id,
12041            _id: id,
12042            _delegate: Default::default(),
12043            _additional_params: Default::default(),
12044            _scopes: Default::default(),
12045        }
12046    }
12047
12048    /// Create a builder to help you perform the following task:
12049    ///
12050    /// Retrieves a list of mobile carriers.
12051    ///
12052    /// # Arguments
12053    ///
12054    /// * `profileId` - User profile ID associated with this request.
12055    pub fn list(&self, profile_id: i64) -> MobileCarrierListCall<'a, C> {
12056        MobileCarrierListCall {
12057            hub: self.hub,
12058            _profile_id: profile_id,
12059            _delegate: Default::default(),
12060            _additional_params: Default::default(),
12061            _scopes: Default::default(),
12062        }
12063    }
12064}
12065
12066/// A builder providing access to all methods supported on *operatingSystemVersion* resources.
12067/// It is not used directly, but through the [`Dfareporting`] hub.
12068///
12069/// # Example
12070///
12071/// Instantiate a resource builder
12072///
12073/// ```test_harness,no_run
12074/// extern crate hyper;
12075/// extern crate hyper_rustls;
12076/// extern crate google_dfareporting3d3 as dfareporting3d3;
12077///
12078/// # async fn dox() {
12079/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12080///
12081/// let secret: yup_oauth2::ApplicationSecret = Default::default();
12082/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12083///     secret,
12084///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12085/// ).build().await.unwrap();
12086///
12087/// let client = hyper_util::client::legacy::Client::builder(
12088///     hyper_util::rt::TokioExecutor::new()
12089/// )
12090/// .build(
12091///     hyper_rustls::HttpsConnectorBuilder::new()
12092///         .with_native_roots()
12093///         .unwrap()
12094///         .https_or_http()
12095///         .enable_http1()
12096///         .build()
12097/// );
12098/// let mut hub = Dfareporting::new(client, auth);
12099/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
12100/// // like `get(...)` and `list(...)`
12101/// // to build up your call.
12102/// let rb = hub.operating_system_versions();
12103/// # }
12104/// ```
12105pub struct OperatingSystemVersionMethods<'a, C>
12106where
12107    C: 'a,
12108{
12109    hub: &'a Dfareporting<C>,
12110}
12111
12112impl<'a, C> common::MethodsBuilder for OperatingSystemVersionMethods<'a, C> {}
12113
12114impl<'a, C> OperatingSystemVersionMethods<'a, C> {
12115    /// Create a builder to help you perform the following task:
12116    ///
12117    /// Gets one operating system version by ID.
12118    ///
12119    /// # Arguments
12120    ///
12121    /// * `profileId` - User profile ID associated with this request.
12122    /// * `id` - Operating system version ID.
12123    pub fn get(&self, profile_id: i64, id: i64) -> OperatingSystemVersionGetCall<'a, C> {
12124        OperatingSystemVersionGetCall {
12125            hub: self.hub,
12126            _profile_id: profile_id,
12127            _id: id,
12128            _delegate: Default::default(),
12129            _additional_params: Default::default(),
12130            _scopes: Default::default(),
12131        }
12132    }
12133
12134    /// Create a builder to help you perform the following task:
12135    ///
12136    /// Retrieves a list of operating system versions.
12137    ///
12138    /// # Arguments
12139    ///
12140    /// * `profileId` - User profile ID associated with this request.
12141    pub fn list(&self, profile_id: i64) -> OperatingSystemVersionListCall<'a, C> {
12142        OperatingSystemVersionListCall {
12143            hub: self.hub,
12144            _profile_id: profile_id,
12145            _delegate: Default::default(),
12146            _additional_params: Default::default(),
12147            _scopes: Default::default(),
12148        }
12149    }
12150}
12151
12152/// A builder providing access to all methods supported on *operatingSystem* resources.
12153/// It is not used directly, but through the [`Dfareporting`] hub.
12154///
12155/// # Example
12156///
12157/// Instantiate a resource builder
12158///
12159/// ```test_harness,no_run
12160/// extern crate hyper;
12161/// extern crate hyper_rustls;
12162/// extern crate google_dfareporting3d3 as dfareporting3d3;
12163///
12164/// # async fn dox() {
12165/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12166///
12167/// let secret: yup_oauth2::ApplicationSecret = Default::default();
12168/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12169///     secret,
12170///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12171/// ).build().await.unwrap();
12172///
12173/// let client = hyper_util::client::legacy::Client::builder(
12174///     hyper_util::rt::TokioExecutor::new()
12175/// )
12176/// .build(
12177///     hyper_rustls::HttpsConnectorBuilder::new()
12178///         .with_native_roots()
12179///         .unwrap()
12180///         .https_or_http()
12181///         .enable_http1()
12182///         .build()
12183/// );
12184/// let mut hub = Dfareporting::new(client, auth);
12185/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
12186/// // like `get(...)` and `list(...)`
12187/// // to build up your call.
12188/// let rb = hub.operating_systems();
12189/// # }
12190/// ```
12191pub struct OperatingSystemMethods<'a, C>
12192where
12193    C: 'a,
12194{
12195    hub: &'a Dfareporting<C>,
12196}
12197
12198impl<'a, C> common::MethodsBuilder for OperatingSystemMethods<'a, C> {}
12199
12200impl<'a, C> OperatingSystemMethods<'a, C> {
12201    /// Create a builder to help you perform the following task:
12202    ///
12203    /// Gets one operating system by DART ID.
12204    ///
12205    /// # Arguments
12206    ///
12207    /// * `profileId` - User profile ID associated with this request.
12208    /// * `dartId` - Operating system DART ID.
12209    pub fn get(&self, profile_id: i64, dart_id: i64) -> OperatingSystemGetCall<'a, C> {
12210        OperatingSystemGetCall {
12211            hub: self.hub,
12212            _profile_id: profile_id,
12213            _dart_id: dart_id,
12214            _delegate: Default::default(),
12215            _additional_params: Default::default(),
12216            _scopes: Default::default(),
12217        }
12218    }
12219
12220    /// Create a builder to help you perform the following task:
12221    ///
12222    /// Retrieves a list of operating systems.
12223    ///
12224    /// # Arguments
12225    ///
12226    /// * `profileId` - User profile ID associated with this request.
12227    pub fn list(&self, profile_id: i64) -> OperatingSystemListCall<'a, C> {
12228        OperatingSystemListCall {
12229            hub: self.hub,
12230            _profile_id: profile_id,
12231            _delegate: Default::default(),
12232            _additional_params: Default::default(),
12233            _scopes: Default::default(),
12234        }
12235    }
12236}
12237
12238/// A builder providing access to all methods supported on *orderDocument* resources.
12239/// It is not used directly, but through the [`Dfareporting`] hub.
12240///
12241/// # Example
12242///
12243/// Instantiate a resource builder
12244///
12245/// ```test_harness,no_run
12246/// extern crate hyper;
12247/// extern crate hyper_rustls;
12248/// extern crate google_dfareporting3d3 as dfareporting3d3;
12249///
12250/// # async fn dox() {
12251/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12252///
12253/// let secret: yup_oauth2::ApplicationSecret = Default::default();
12254/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12255///     secret,
12256///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12257/// ).build().await.unwrap();
12258///
12259/// let client = hyper_util::client::legacy::Client::builder(
12260///     hyper_util::rt::TokioExecutor::new()
12261/// )
12262/// .build(
12263///     hyper_rustls::HttpsConnectorBuilder::new()
12264///         .with_native_roots()
12265///         .unwrap()
12266///         .https_or_http()
12267///         .enable_http1()
12268///         .build()
12269/// );
12270/// let mut hub = Dfareporting::new(client, auth);
12271/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
12272/// // like `get(...)` and `list(...)`
12273/// // to build up your call.
12274/// let rb = hub.order_documents();
12275/// # }
12276/// ```
12277pub struct OrderDocumentMethods<'a, C>
12278where
12279    C: 'a,
12280{
12281    hub: &'a Dfareporting<C>,
12282}
12283
12284impl<'a, C> common::MethodsBuilder for OrderDocumentMethods<'a, C> {}
12285
12286impl<'a, C> OrderDocumentMethods<'a, C> {
12287    /// Create a builder to help you perform the following task:
12288    ///
12289    /// Gets one order document by ID.
12290    ///
12291    /// # Arguments
12292    ///
12293    /// * `profileId` - User profile ID associated with this request.
12294    /// * `projectId` - Project ID for order documents.
12295    /// * `id` - Order document ID.
12296    pub fn get(&self, profile_id: i64, project_id: i64, id: i64) -> OrderDocumentGetCall<'a, C> {
12297        OrderDocumentGetCall {
12298            hub: self.hub,
12299            _profile_id: profile_id,
12300            _project_id: project_id,
12301            _id: id,
12302            _delegate: Default::default(),
12303            _additional_params: Default::default(),
12304            _scopes: Default::default(),
12305        }
12306    }
12307
12308    /// Create a builder to help you perform the following task:
12309    ///
12310    /// Retrieves a list of order documents, possibly filtered. This method supports paging.
12311    ///
12312    /// # Arguments
12313    ///
12314    /// * `profileId` - User profile ID associated with this request.
12315    /// * `projectId` - Project ID for order documents.
12316    pub fn list(&self, profile_id: i64, project_id: i64) -> OrderDocumentListCall<'a, C> {
12317        OrderDocumentListCall {
12318            hub: self.hub,
12319            _profile_id: profile_id,
12320            _project_id: project_id,
12321            _sort_order: Default::default(),
12322            _sort_field: Default::default(),
12323            _site_id: Default::default(),
12324            _search_string: Default::default(),
12325            _page_token: Default::default(),
12326            _order_id: Default::default(),
12327            _max_results: Default::default(),
12328            _ids: Default::default(),
12329            _approved: Default::default(),
12330            _delegate: Default::default(),
12331            _additional_params: Default::default(),
12332            _scopes: Default::default(),
12333        }
12334    }
12335}
12336
12337/// A builder providing access to all methods supported on *order* resources.
12338/// It is not used directly, but through the [`Dfareporting`] hub.
12339///
12340/// # Example
12341///
12342/// Instantiate a resource builder
12343///
12344/// ```test_harness,no_run
12345/// extern crate hyper;
12346/// extern crate hyper_rustls;
12347/// extern crate google_dfareporting3d3 as dfareporting3d3;
12348///
12349/// # async fn dox() {
12350/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12351///
12352/// let secret: yup_oauth2::ApplicationSecret = Default::default();
12353/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12354///     secret,
12355///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12356/// ).build().await.unwrap();
12357///
12358/// let client = hyper_util::client::legacy::Client::builder(
12359///     hyper_util::rt::TokioExecutor::new()
12360/// )
12361/// .build(
12362///     hyper_rustls::HttpsConnectorBuilder::new()
12363///         .with_native_roots()
12364///         .unwrap()
12365///         .https_or_http()
12366///         .enable_http1()
12367///         .build()
12368/// );
12369/// let mut hub = Dfareporting::new(client, auth);
12370/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
12371/// // like `get(...)` and `list(...)`
12372/// // to build up your call.
12373/// let rb = hub.orders();
12374/// # }
12375/// ```
12376pub struct OrderMethods<'a, C>
12377where
12378    C: 'a,
12379{
12380    hub: &'a Dfareporting<C>,
12381}
12382
12383impl<'a, C> common::MethodsBuilder for OrderMethods<'a, C> {}
12384
12385impl<'a, C> OrderMethods<'a, C> {
12386    /// Create a builder to help you perform the following task:
12387    ///
12388    /// Gets one order by ID.
12389    ///
12390    /// # Arguments
12391    ///
12392    /// * `profileId` - User profile ID associated with this request.
12393    /// * `projectId` - Project ID for orders.
12394    /// * `id` - Order ID.
12395    pub fn get(&self, profile_id: i64, project_id: i64, id: i64) -> OrderGetCall<'a, C> {
12396        OrderGetCall {
12397            hub: self.hub,
12398            _profile_id: profile_id,
12399            _project_id: project_id,
12400            _id: id,
12401            _delegate: Default::default(),
12402            _additional_params: Default::default(),
12403            _scopes: Default::default(),
12404        }
12405    }
12406
12407    /// Create a builder to help you perform the following task:
12408    ///
12409    /// Retrieves a list of orders, possibly filtered. This method supports paging.
12410    ///
12411    /// # Arguments
12412    ///
12413    /// * `profileId` - User profile ID associated with this request.
12414    /// * `projectId` - Project ID for orders.
12415    pub fn list(&self, profile_id: i64, project_id: i64) -> OrderListCall<'a, C> {
12416        OrderListCall {
12417            hub: self.hub,
12418            _profile_id: profile_id,
12419            _project_id: project_id,
12420            _sort_order: Default::default(),
12421            _sort_field: Default::default(),
12422            _site_id: Default::default(),
12423            _search_string: Default::default(),
12424            _page_token: Default::default(),
12425            _max_results: Default::default(),
12426            _ids: Default::default(),
12427            _delegate: Default::default(),
12428            _additional_params: Default::default(),
12429            _scopes: Default::default(),
12430        }
12431    }
12432}
12433
12434/// A builder providing access to all methods supported on *placementGroup* resources.
12435/// It is not used directly, but through the [`Dfareporting`] hub.
12436///
12437/// # Example
12438///
12439/// Instantiate a resource builder
12440///
12441/// ```test_harness,no_run
12442/// extern crate hyper;
12443/// extern crate hyper_rustls;
12444/// extern crate google_dfareporting3d3 as dfareporting3d3;
12445///
12446/// # async fn dox() {
12447/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12448///
12449/// let secret: yup_oauth2::ApplicationSecret = Default::default();
12450/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12451///     secret,
12452///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12453/// ).build().await.unwrap();
12454///
12455/// let client = hyper_util::client::legacy::Client::builder(
12456///     hyper_util::rt::TokioExecutor::new()
12457/// )
12458/// .build(
12459///     hyper_rustls::HttpsConnectorBuilder::new()
12460///         .with_native_roots()
12461///         .unwrap()
12462///         .https_or_http()
12463///         .enable_http1()
12464///         .build()
12465/// );
12466/// let mut hub = Dfareporting::new(client, auth);
12467/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
12468/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
12469/// // to build up your call.
12470/// let rb = hub.placement_groups();
12471/// # }
12472/// ```
12473pub struct PlacementGroupMethods<'a, C>
12474where
12475    C: 'a,
12476{
12477    hub: &'a Dfareporting<C>,
12478}
12479
12480impl<'a, C> common::MethodsBuilder for PlacementGroupMethods<'a, C> {}
12481
12482impl<'a, C> PlacementGroupMethods<'a, C> {
12483    /// Create a builder to help you perform the following task:
12484    ///
12485    /// Gets one placement group by ID.
12486    ///
12487    /// # Arguments
12488    ///
12489    /// * `profileId` - User profile ID associated with this request.
12490    /// * `id` - Placement group ID.
12491    pub fn get(&self, profile_id: i64, id: i64) -> PlacementGroupGetCall<'a, C> {
12492        PlacementGroupGetCall {
12493            hub: self.hub,
12494            _profile_id: profile_id,
12495            _id: id,
12496            _delegate: Default::default(),
12497            _additional_params: Default::default(),
12498            _scopes: Default::default(),
12499        }
12500    }
12501
12502    /// Create a builder to help you perform the following task:
12503    ///
12504    /// Inserts a new placement group.
12505    ///
12506    /// # Arguments
12507    ///
12508    /// * `request` - No description provided.
12509    /// * `profileId` - User profile ID associated with this request.
12510    pub fn insert(
12511        &self,
12512        request: PlacementGroup,
12513        profile_id: i64,
12514    ) -> PlacementGroupInsertCall<'a, C> {
12515        PlacementGroupInsertCall {
12516            hub: self.hub,
12517            _request: request,
12518            _profile_id: profile_id,
12519            _delegate: Default::default(),
12520            _additional_params: Default::default(),
12521            _scopes: Default::default(),
12522        }
12523    }
12524
12525    /// Create a builder to help you perform the following task:
12526    ///
12527    /// Retrieves a list of placement groups, possibly filtered. This method supports paging.
12528    ///
12529    /// # Arguments
12530    ///
12531    /// * `profileId` - User profile ID associated with this request.
12532    pub fn list(&self, profile_id: i64) -> PlacementGroupListCall<'a, C> {
12533        PlacementGroupListCall {
12534            hub: self.hub,
12535            _profile_id: profile_id,
12536            _sort_order: Default::default(),
12537            _sort_field: Default::default(),
12538            _site_ids: Default::default(),
12539            _search_string: Default::default(),
12540            _pricing_types: Default::default(),
12541            _placement_strategy_ids: Default::default(),
12542            _placement_group_type: Default::default(),
12543            _page_token: Default::default(),
12544            _min_start_date: Default::default(),
12545            _min_end_date: Default::default(),
12546            _max_start_date: Default::default(),
12547            _max_results: Default::default(),
12548            _max_end_date: Default::default(),
12549            _ids: Default::default(),
12550            _directory_site_ids: Default::default(),
12551            _content_category_ids: Default::default(),
12552            _campaign_ids: Default::default(),
12553            _archived: Default::default(),
12554            _advertiser_ids: Default::default(),
12555            _delegate: Default::default(),
12556            _additional_params: Default::default(),
12557            _scopes: Default::default(),
12558        }
12559    }
12560
12561    /// Create a builder to help you perform the following task:
12562    ///
12563    /// Updates an existing placement group. This method supports patch semantics.
12564    ///
12565    /// # Arguments
12566    ///
12567    /// * `request` - No description provided.
12568    /// * `profileId` - User profile ID associated with this request.
12569    /// * `id` - PlacementGroup ID.
12570    pub fn patch(
12571        &self,
12572        request: PlacementGroup,
12573        profile_id: i64,
12574        id: i64,
12575    ) -> PlacementGroupPatchCall<'a, C> {
12576        PlacementGroupPatchCall {
12577            hub: self.hub,
12578            _request: request,
12579            _profile_id: profile_id,
12580            _id: id,
12581            _delegate: Default::default(),
12582            _additional_params: Default::default(),
12583            _scopes: Default::default(),
12584        }
12585    }
12586
12587    /// Create a builder to help you perform the following task:
12588    ///
12589    /// Updates an existing placement group.
12590    ///
12591    /// # Arguments
12592    ///
12593    /// * `request` - No description provided.
12594    /// * `profileId` - User profile ID associated with this request.
12595    pub fn update(
12596        &self,
12597        request: PlacementGroup,
12598        profile_id: i64,
12599    ) -> PlacementGroupUpdateCall<'a, C> {
12600        PlacementGroupUpdateCall {
12601            hub: self.hub,
12602            _request: request,
12603            _profile_id: profile_id,
12604            _delegate: Default::default(),
12605            _additional_params: Default::default(),
12606            _scopes: Default::default(),
12607        }
12608    }
12609}
12610
12611/// A builder providing access to all methods supported on *placementStrategy* resources.
12612/// It is not used directly, but through the [`Dfareporting`] hub.
12613///
12614/// # Example
12615///
12616/// Instantiate a resource builder
12617///
12618/// ```test_harness,no_run
12619/// extern crate hyper;
12620/// extern crate hyper_rustls;
12621/// extern crate google_dfareporting3d3 as dfareporting3d3;
12622///
12623/// # async fn dox() {
12624/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12625///
12626/// let secret: yup_oauth2::ApplicationSecret = Default::default();
12627/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12628///     secret,
12629///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12630/// ).build().await.unwrap();
12631///
12632/// let client = hyper_util::client::legacy::Client::builder(
12633///     hyper_util::rt::TokioExecutor::new()
12634/// )
12635/// .build(
12636///     hyper_rustls::HttpsConnectorBuilder::new()
12637///         .with_native_roots()
12638///         .unwrap()
12639///         .https_or_http()
12640///         .enable_http1()
12641///         .build()
12642/// );
12643/// let mut hub = Dfareporting::new(client, auth);
12644/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
12645/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
12646/// // to build up your call.
12647/// let rb = hub.placement_strategies();
12648/// # }
12649/// ```
12650pub struct PlacementStrategyMethods<'a, C>
12651where
12652    C: 'a,
12653{
12654    hub: &'a Dfareporting<C>,
12655}
12656
12657impl<'a, C> common::MethodsBuilder for PlacementStrategyMethods<'a, C> {}
12658
12659impl<'a, C> PlacementStrategyMethods<'a, C> {
12660    /// Create a builder to help you perform the following task:
12661    ///
12662    /// Deletes an existing placement strategy.
12663    ///
12664    /// # Arguments
12665    ///
12666    /// * `profileId` - User profile ID associated with this request.
12667    /// * `id` - Placement strategy ID.
12668    pub fn delete(&self, profile_id: i64, id: i64) -> PlacementStrategyDeleteCall<'a, C> {
12669        PlacementStrategyDeleteCall {
12670            hub: self.hub,
12671            _profile_id: profile_id,
12672            _id: id,
12673            _delegate: Default::default(),
12674            _additional_params: Default::default(),
12675            _scopes: Default::default(),
12676        }
12677    }
12678
12679    /// Create a builder to help you perform the following task:
12680    ///
12681    /// Gets one placement strategy by ID.
12682    ///
12683    /// # Arguments
12684    ///
12685    /// * `profileId` - User profile ID associated with this request.
12686    /// * `id` - Placement strategy ID.
12687    pub fn get(&self, profile_id: i64, id: i64) -> PlacementStrategyGetCall<'a, C> {
12688        PlacementStrategyGetCall {
12689            hub: self.hub,
12690            _profile_id: profile_id,
12691            _id: id,
12692            _delegate: Default::default(),
12693            _additional_params: Default::default(),
12694            _scopes: Default::default(),
12695        }
12696    }
12697
12698    /// Create a builder to help you perform the following task:
12699    ///
12700    /// Inserts a new placement strategy.
12701    ///
12702    /// # Arguments
12703    ///
12704    /// * `request` - No description provided.
12705    /// * `profileId` - User profile ID associated with this request.
12706    pub fn insert(
12707        &self,
12708        request: PlacementStrategy,
12709        profile_id: i64,
12710    ) -> PlacementStrategyInsertCall<'a, C> {
12711        PlacementStrategyInsertCall {
12712            hub: self.hub,
12713            _request: request,
12714            _profile_id: profile_id,
12715            _delegate: Default::default(),
12716            _additional_params: Default::default(),
12717            _scopes: Default::default(),
12718        }
12719    }
12720
12721    /// Create a builder to help you perform the following task:
12722    ///
12723    /// Retrieves a list of placement strategies, possibly filtered. This method supports paging.
12724    ///
12725    /// # Arguments
12726    ///
12727    /// * `profileId` - User profile ID associated with this request.
12728    pub fn list(&self, profile_id: i64) -> PlacementStrategyListCall<'a, C> {
12729        PlacementStrategyListCall {
12730            hub: self.hub,
12731            _profile_id: profile_id,
12732            _sort_order: Default::default(),
12733            _sort_field: Default::default(),
12734            _search_string: Default::default(),
12735            _page_token: Default::default(),
12736            _max_results: Default::default(),
12737            _ids: Default::default(),
12738            _delegate: Default::default(),
12739            _additional_params: Default::default(),
12740            _scopes: Default::default(),
12741        }
12742    }
12743
12744    /// Create a builder to help you perform the following task:
12745    ///
12746    /// Updates an existing placement strategy. This method supports patch semantics.
12747    ///
12748    /// # Arguments
12749    ///
12750    /// * `request` - No description provided.
12751    /// * `profileId` - User profile ID associated with this request.
12752    /// * `id` - PlacementStrategy ID.
12753    pub fn patch(
12754        &self,
12755        request: PlacementStrategy,
12756        profile_id: i64,
12757        id: i64,
12758    ) -> PlacementStrategyPatchCall<'a, C> {
12759        PlacementStrategyPatchCall {
12760            hub: self.hub,
12761            _request: request,
12762            _profile_id: profile_id,
12763            _id: id,
12764            _delegate: Default::default(),
12765            _additional_params: Default::default(),
12766            _scopes: Default::default(),
12767        }
12768    }
12769
12770    /// Create a builder to help you perform the following task:
12771    ///
12772    /// Updates an existing placement strategy.
12773    ///
12774    /// # Arguments
12775    ///
12776    /// * `request` - No description provided.
12777    /// * `profileId` - User profile ID associated with this request.
12778    pub fn update(
12779        &self,
12780        request: PlacementStrategy,
12781        profile_id: i64,
12782    ) -> PlacementStrategyUpdateCall<'a, C> {
12783        PlacementStrategyUpdateCall {
12784            hub: self.hub,
12785            _request: request,
12786            _profile_id: profile_id,
12787            _delegate: Default::default(),
12788            _additional_params: Default::default(),
12789            _scopes: Default::default(),
12790        }
12791    }
12792}
12793
12794/// A builder providing access to all methods supported on *placement* resources.
12795/// It is not used directly, but through the [`Dfareporting`] hub.
12796///
12797/// # Example
12798///
12799/// Instantiate a resource builder
12800///
12801/// ```test_harness,no_run
12802/// extern crate hyper;
12803/// extern crate hyper_rustls;
12804/// extern crate google_dfareporting3d3 as dfareporting3d3;
12805///
12806/// # async fn dox() {
12807/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12808///
12809/// let secret: yup_oauth2::ApplicationSecret = Default::default();
12810/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12811///     secret,
12812///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12813/// ).build().await.unwrap();
12814///
12815/// let client = hyper_util::client::legacy::Client::builder(
12816///     hyper_util::rt::TokioExecutor::new()
12817/// )
12818/// .build(
12819///     hyper_rustls::HttpsConnectorBuilder::new()
12820///         .with_native_roots()
12821///         .unwrap()
12822///         .https_or_http()
12823///         .enable_http1()
12824///         .build()
12825/// );
12826/// let mut hub = Dfareporting::new(client, auth);
12827/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
12828/// // like `generatetags(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
12829/// // to build up your call.
12830/// let rb = hub.placements();
12831/// # }
12832/// ```
12833pub struct PlacementMethods<'a, C>
12834where
12835    C: 'a,
12836{
12837    hub: &'a Dfareporting<C>,
12838}
12839
12840impl<'a, C> common::MethodsBuilder for PlacementMethods<'a, C> {}
12841
12842impl<'a, C> PlacementMethods<'a, C> {
12843    /// Create a builder to help you perform the following task:
12844    ///
12845    /// Generates tags for a placement.
12846    ///
12847    /// # Arguments
12848    ///
12849    /// * `profileId` - User profile ID associated with this request.
12850    pub fn generatetags(&self, profile_id: i64) -> PlacementGeneratetagCall<'a, C> {
12851        PlacementGeneratetagCall {
12852            hub: self.hub,
12853            _profile_id: profile_id,
12854            _tag_formats: Default::default(),
12855            _placement_ids: Default::default(),
12856            _campaign_id: Default::default(),
12857            _delegate: Default::default(),
12858            _additional_params: Default::default(),
12859            _scopes: Default::default(),
12860        }
12861    }
12862
12863    /// Create a builder to help you perform the following task:
12864    ///
12865    /// Gets one placement by ID.
12866    ///
12867    /// # Arguments
12868    ///
12869    /// * `profileId` - User profile ID associated with this request.
12870    /// * `id` - Placement ID.
12871    pub fn get(&self, profile_id: i64, id: i64) -> PlacementGetCall<'a, C> {
12872        PlacementGetCall {
12873            hub: self.hub,
12874            _profile_id: profile_id,
12875            _id: id,
12876            _delegate: Default::default(),
12877            _additional_params: Default::default(),
12878            _scopes: Default::default(),
12879        }
12880    }
12881
12882    /// Create a builder to help you perform the following task:
12883    ///
12884    /// Inserts a new placement.
12885    ///
12886    /// # Arguments
12887    ///
12888    /// * `request` - No description provided.
12889    /// * `profileId` - User profile ID associated with this request.
12890    pub fn insert(&self, request: Placement, profile_id: i64) -> PlacementInsertCall<'a, C> {
12891        PlacementInsertCall {
12892            hub: self.hub,
12893            _request: request,
12894            _profile_id: profile_id,
12895            _delegate: Default::default(),
12896            _additional_params: Default::default(),
12897            _scopes: Default::default(),
12898        }
12899    }
12900
12901    /// Create a builder to help you perform the following task:
12902    ///
12903    /// Retrieves a list of placements, possibly filtered. This method supports paging.
12904    ///
12905    /// # Arguments
12906    ///
12907    /// * `profileId` - User profile ID associated with this request.
12908    pub fn list(&self, profile_id: i64) -> PlacementListCall<'a, C> {
12909        PlacementListCall {
12910            hub: self.hub,
12911            _profile_id: profile_id,
12912            _sort_order: Default::default(),
12913            _sort_field: Default::default(),
12914            _size_ids: Default::default(),
12915            _site_ids: Default::default(),
12916            _search_string: Default::default(),
12917            _pricing_types: Default::default(),
12918            _placement_strategy_ids: Default::default(),
12919            _payment_source: Default::default(),
12920            _page_token: Default::default(),
12921            _min_start_date: Default::default(),
12922            _min_end_date: Default::default(),
12923            _max_start_date: Default::default(),
12924            _max_results: Default::default(),
12925            _max_end_date: Default::default(),
12926            _ids: Default::default(),
12927            _group_ids: Default::default(),
12928            _directory_site_ids: Default::default(),
12929            _content_category_ids: Default::default(),
12930            _compatibilities: Default::default(),
12931            _campaign_ids: Default::default(),
12932            _archived: Default::default(),
12933            _advertiser_ids: Default::default(),
12934            _delegate: Default::default(),
12935            _additional_params: Default::default(),
12936            _scopes: Default::default(),
12937        }
12938    }
12939
12940    /// Create a builder to help you perform the following task:
12941    ///
12942    /// Updates an existing placement. This method supports patch semantics.
12943    ///
12944    /// # Arguments
12945    ///
12946    /// * `request` - No description provided.
12947    /// * `profileId` - User profile ID associated with this request.
12948    /// * `id` - Placement ID.
12949    pub fn patch(&self, request: Placement, profile_id: i64, id: i64) -> PlacementPatchCall<'a, C> {
12950        PlacementPatchCall {
12951            hub: self.hub,
12952            _request: request,
12953            _profile_id: profile_id,
12954            _id: id,
12955            _delegate: Default::default(),
12956            _additional_params: Default::default(),
12957            _scopes: Default::default(),
12958        }
12959    }
12960
12961    /// Create a builder to help you perform the following task:
12962    ///
12963    /// Updates an existing placement.
12964    ///
12965    /// # Arguments
12966    ///
12967    /// * `request` - No description provided.
12968    /// * `profileId` - User profile ID associated with this request.
12969    pub fn update(&self, request: Placement, profile_id: i64) -> PlacementUpdateCall<'a, C> {
12970        PlacementUpdateCall {
12971            hub: self.hub,
12972            _request: request,
12973            _profile_id: profile_id,
12974            _delegate: Default::default(),
12975            _additional_params: Default::default(),
12976            _scopes: Default::default(),
12977        }
12978    }
12979}
12980
12981/// A builder providing access to all methods supported on *platformType* resources.
12982/// It is not used directly, but through the [`Dfareporting`] hub.
12983///
12984/// # Example
12985///
12986/// Instantiate a resource builder
12987///
12988/// ```test_harness,no_run
12989/// extern crate hyper;
12990/// extern crate hyper_rustls;
12991/// extern crate google_dfareporting3d3 as dfareporting3d3;
12992///
12993/// # async fn dox() {
12994/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12995///
12996/// let secret: yup_oauth2::ApplicationSecret = Default::default();
12997/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12998///     secret,
12999///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13000/// ).build().await.unwrap();
13001///
13002/// let client = hyper_util::client::legacy::Client::builder(
13003///     hyper_util::rt::TokioExecutor::new()
13004/// )
13005/// .build(
13006///     hyper_rustls::HttpsConnectorBuilder::new()
13007///         .with_native_roots()
13008///         .unwrap()
13009///         .https_or_http()
13010///         .enable_http1()
13011///         .build()
13012/// );
13013/// let mut hub = Dfareporting::new(client, auth);
13014/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
13015/// // like `get(...)` and `list(...)`
13016/// // to build up your call.
13017/// let rb = hub.platform_types();
13018/// # }
13019/// ```
13020pub struct PlatformTypeMethods<'a, C>
13021where
13022    C: 'a,
13023{
13024    hub: &'a Dfareporting<C>,
13025}
13026
13027impl<'a, C> common::MethodsBuilder for PlatformTypeMethods<'a, C> {}
13028
13029impl<'a, C> PlatformTypeMethods<'a, C> {
13030    /// Create a builder to help you perform the following task:
13031    ///
13032    /// Gets one platform type by ID.
13033    ///
13034    /// # Arguments
13035    ///
13036    /// * `profileId` - User profile ID associated with this request.
13037    /// * `id` - Platform type ID.
13038    pub fn get(&self, profile_id: i64, id: i64) -> PlatformTypeGetCall<'a, C> {
13039        PlatformTypeGetCall {
13040            hub: self.hub,
13041            _profile_id: profile_id,
13042            _id: id,
13043            _delegate: Default::default(),
13044            _additional_params: Default::default(),
13045            _scopes: Default::default(),
13046        }
13047    }
13048
13049    /// Create a builder to help you perform the following task:
13050    ///
13051    /// Retrieves a list of platform types.
13052    ///
13053    /// # Arguments
13054    ///
13055    /// * `profileId` - User profile ID associated with this request.
13056    pub fn list(&self, profile_id: i64) -> PlatformTypeListCall<'a, C> {
13057        PlatformTypeListCall {
13058            hub: self.hub,
13059            _profile_id: profile_id,
13060            _delegate: Default::default(),
13061            _additional_params: Default::default(),
13062            _scopes: Default::default(),
13063        }
13064    }
13065}
13066
13067/// A builder providing access to all methods supported on *postalCode* resources.
13068/// It is not used directly, but through the [`Dfareporting`] hub.
13069///
13070/// # Example
13071///
13072/// Instantiate a resource builder
13073///
13074/// ```test_harness,no_run
13075/// extern crate hyper;
13076/// extern crate hyper_rustls;
13077/// extern crate google_dfareporting3d3 as dfareporting3d3;
13078///
13079/// # async fn dox() {
13080/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13081///
13082/// let secret: yup_oauth2::ApplicationSecret = Default::default();
13083/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13084///     secret,
13085///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13086/// ).build().await.unwrap();
13087///
13088/// let client = hyper_util::client::legacy::Client::builder(
13089///     hyper_util::rt::TokioExecutor::new()
13090/// )
13091/// .build(
13092///     hyper_rustls::HttpsConnectorBuilder::new()
13093///         .with_native_roots()
13094///         .unwrap()
13095///         .https_or_http()
13096///         .enable_http1()
13097///         .build()
13098/// );
13099/// let mut hub = Dfareporting::new(client, auth);
13100/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
13101/// // like `get(...)` and `list(...)`
13102/// // to build up your call.
13103/// let rb = hub.postal_codes();
13104/// # }
13105/// ```
13106pub struct PostalCodeMethods<'a, C>
13107where
13108    C: 'a,
13109{
13110    hub: &'a Dfareporting<C>,
13111}
13112
13113impl<'a, C> common::MethodsBuilder for PostalCodeMethods<'a, C> {}
13114
13115impl<'a, C> PostalCodeMethods<'a, C> {
13116    /// Create a builder to help you perform the following task:
13117    ///
13118    /// Gets one postal code by ID.
13119    ///
13120    /// # Arguments
13121    ///
13122    /// * `profileId` - User profile ID associated with this request.
13123    /// * `code` - Postal code ID.
13124    pub fn get(&self, profile_id: i64, code: &str) -> PostalCodeGetCall<'a, C> {
13125        PostalCodeGetCall {
13126            hub: self.hub,
13127            _profile_id: profile_id,
13128            _code: code.to_string(),
13129            _delegate: Default::default(),
13130            _additional_params: Default::default(),
13131            _scopes: Default::default(),
13132        }
13133    }
13134
13135    /// Create a builder to help you perform the following task:
13136    ///
13137    /// Retrieves a list of postal codes.
13138    ///
13139    /// # Arguments
13140    ///
13141    /// * `profileId` - User profile ID associated with this request.
13142    pub fn list(&self, profile_id: i64) -> PostalCodeListCall<'a, C> {
13143        PostalCodeListCall {
13144            hub: self.hub,
13145            _profile_id: profile_id,
13146            _delegate: Default::default(),
13147            _additional_params: Default::default(),
13148            _scopes: Default::default(),
13149        }
13150    }
13151}
13152
13153/// A builder providing access to all methods supported on *project* resources.
13154/// It is not used directly, but through the [`Dfareporting`] hub.
13155///
13156/// # Example
13157///
13158/// Instantiate a resource builder
13159///
13160/// ```test_harness,no_run
13161/// extern crate hyper;
13162/// extern crate hyper_rustls;
13163/// extern crate google_dfareporting3d3 as dfareporting3d3;
13164///
13165/// # async fn dox() {
13166/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13167///
13168/// let secret: yup_oauth2::ApplicationSecret = Default::default();
13169/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13170///     secret,
13171///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13172/// ).build().await.unwrap();
13173///
13174/// let client = hyper_util::client::legacy::Client::builder(
13175///     hyper_util::rt::TokioExecutor::new()
13176/// )
13177/// .build(
13178///     hyper_rustls::HttpsConnectorBuilder::new()
13179///         .with_native_roots()
13180///         .unwrap()
13181///         .https_or_http()
13182///         .enable_http1()
13183///         .build()
13184/// );
13185/// let mut hub = Dfareporting::new(client, auth);
13186/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
13187/// // like `get(...)` and `list(...)`
13188/// // to build up your call.
13189/// let rb = hub.projects();
13190/// # }
13191/// ```
13192pub struct ProjectMethods<'a, C>
13193where
13194    C: 'a,
13195{
13196    hub: &'a Dfareporting<C>,
13197}
13198
13199impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
13200
13201impl<'a, C> ProjectMethods<'a, C> {
13202    /// Create a builder to help you perform the following task:
13203    ///
13204    /// Gets one project by ID.
13205    ///
13206    /// # Arguments
13207    ///
13208    /// * `profileId` - User profile ID associated with this request.
13209    /// * `id` - Project ID.
13210    pub fn get(&self, profile_id: i64, id: i64) -> ProjectGetCall<'a, C> {
13211        ProjectGetCall {
13212            hub: self.hub,
13213            _profile_id: profile_id,
13214            _id: id,
13215            _delegate: Default::default(),
13216            _additional_params: Default::default(),
13217            _scopes: Default::default(),
13218        }
13219    }
13220
13221    /// Create a builder to help you perform the following task:
13222    ///
13223    /// Retrieves a list of projects, possibly filtered. This method supports paging .
13224    ///
13225    /// # Arguments
13226    ///
13227    /// * `profileId` - User profile ID associated with this request.
13228    pub fn list(&self, profile_id: i64) -> ProjectListCall<'a, C> {
13229        ProjectListCall {
13230            hub: self.hub,
13231            _profile_id: profile_id,
13232            _sort_order: Default::default(),
13233            _sort_field: Default::default(),
13234            _search_string: Default::default(),
13235            _page_token: Default::default(),
13236            _max_results: Default::default(),
13237            _ids: Default::default(),
13238            _advertiser_ids: Default::default(),
13239            _delegate: Default::default(),
13240            _additional_params: Default::default(),
13241            _scopes: Default::default(),
13242        }
13243    }
13244}
13245
13246/// A builder providing access to all methods supported on *region* resources.
13247/// It is not used directly, but through the [`Dfareporting`] hub.
13248///
13249/// # Example
13250///
13251/// Instantiate a resource builder
13252///
13253/// ```test_harness,no_run
13254/// extern crate hyper;
13255/// extern crate hyper_rustls;
13256/// extern crate google_dfareporting3d3 as dfareporting3d3;
13257///
13258/// # async fn dox() {
13259/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13260///
13261/// let secret: yup_oauth2::ApplicationSecret = Default::default();
13262/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13263///     secret,
13264///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13265/// ).build().await.unwrap();
13266///
13267/// let client = hyper_util::client::legacy::Client::builder(
13268///     hyper_util::rt::TokioExecutor::new()
13269/// )
13270/// .build(
13271///     hyper_rustls::HttpsConnectorBuilder::new()
13272///         .with_native_roots()
13273///         .unwrap()
13274///         .https_or_http()
13275///         .enable_http1()
13276///         .build()
13277/// );
13278/// let mut hub = Dfareporting::new(client, auth);
13279/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
13280/// // like `list(...)`
13281/// // to build up your call.
13282/// let rb = hub.regions();
13283/// # }
13284/// ```
13285pub struct RegionMethods<'a, C>
13286where
13287    C: 'a,
13288{
13289    hub: &'a Dfareporting<C>,
13290}
13291
13292impl<'a, C> common::MethodsBuilder for RegionMethods<'a, C> {}
13293
13294impl<'a, C> RegionMethods<'a, C> {
13295    /// Create a builder to help you perform the following task:
13296    ///
13297    /// Retrieves a list of regions.
13298    ///
13299    /// # Arguments
13300    ///
13301    /// * `profileId` - User profile ID associated with this request.
13302    pub fn list(&self, profile_id: i64) -> RegionListCall<'a, C> {
13303        RegionListCall {
13304            hub: self.hub,
13305            _profile_id: profile_id,
13306            _delegate: Default::default(),
13307            _additional_params: Default::default(),
13308            _scopes: Default::default(),
13309        }
13310    }
13311}
13312
13313/// A builder providing access to all methods supported on *remarketingListShare* resources.
13314/// It is not used directly, but through the [`Dfareporting`] hub.
13315///
13316/// # Example
13317///
13318/// Instantiate a resource builder
13319///
13320/// ```test_harness,no_run
13321/// extern crate hyper;
13322/// extern crate hyper_rustls;
13323/// extern crate google_dfareporting3d3 as dfareporting3d3;
13324///
13325/// # async fn dox() {
13326/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13327///
13328/// let secret: yup_oauth2::ApplicationSecret = Default::default();
13329/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13330///     secret,
13331///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13332/// ).build().await.unwrap();
13333///
13334/// let client = hyper_util::client::legacy::Client::builder(
13335///     hyper_util::rt::TokioExecutor::new()
13336/// )
13337/// .build(
13338///     hyper_rustls::HttpsConnectorBuilder::new()
13339///         .with_native_roots()
13340///         .unwrap()
13341///         .https_or_http()
13342///         .enable_http1()
13343///         .build()
13344/// );
13345/// let mut hub = Dfareporting::new(client, auth);
13346/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
13347/// // like `get(...)`, `patch(...)` and `update(...)`
13348/// // to build up your call.
13349/// let rb = hub.remarketing_list_shares();
13350/// # }
13351/// ```
13352pub struct RemarketingListShareMethods<'a, C>
13353where
13354    C: 'a,
13355{
13356    hub: &'a Dfareporting<C>,
13357}
13358
13359impl<'a, C> common::MethodsBuilder for RemarketingListShareMethods<'a, C> {}
13360
13361impl<'a, C> RemarketingListShareMethods<'a, C> {
13362    /// Create a builder to help you perform the following task:
13363    ///
13364    /// Gets one remarketing list share by remarketing list ID.
13365    ///
13366    /// # Arguments
13367    ///
13368    /// * `profileId` - User profile ID associated with this request.
13369    /// * `remarketingListId` - Remarketing list ID.
13370    pub fn get(
13371        &self,
13372        profile_id: i64,
13373        remarketing_list_id: i64,
13374    ) -> RemarketingListShareGetCall<'a, C> {
13375        RemarketingListShareGetCall {
13376            hub: self.hub,
13377            _profile_id: profile_id,
13378            _remarketing_list_id: remarketing_list_id,
13379            _delegate: Default::default(),
13380            _additional_params: Default::default(),
13381            _scopes: Default::default(),
13382        }
13383    }
13384
13385    /// Create a builder to help you perform the following task:
13386    ///
13387    /// Updates an existing remarketing list share. This method supports patch semantics.
13388    ///
13389    /// # Arguments
13390    ///
13391    /// * `request` - No description provided.
13392    /// * `profileId` - User profile ID associated with this request.
13393    /// * `id` - RemarketingList ID.
13394    pub fn patch(
13395        &self,
13396        request: RemarketingListShare,
13397        profile_id: i64,
13398        id: i64,
13399    ) -> RemarketingListSharePatchCall<'a, C> {
13400        RemarketingListSharePatchCall {
13401            hub: self.hub,
13402            _request: request,
13403            _profile_id: profile_id,
13404            _id: id,
13405            _delegate: Default::default(),
13406            _additional_params: Default::default(),
13407            _scopes: Default::default(),
13408        }
13409    }
13410
13411    /// Create a builder to help you perform the following task:
13412    ///
13413    /// Updates an existing remarketing list share.
13414    ///
13415    /// # Arguments
13416    ///
13417    /// * `request` - No description provided.
13418    /// * `profileId` - User profile ID associated with this request.
13419    pub fn update(
13420        &self,
13421        request: RemarketingListShare,
13422        profile_id: i64,
13423    ) -> RemarketingListShareUpdateCall<'a, C> {
13424        RemarketingListShareUpdateCall {
13425            hub: self.hub,
13426            _request: request,
13427            _profile_id: profile_id,
13428            _delegate: Default::default(),
13429            _additional_params: Default::default(),
13430            _scopes: Default::default(),
13431        }
13432    }
13433}
13434
13435/// A builder providing access to all methods supported on *remarketingList* resources.
13436/// It is not used directly, but through the [`Dfareporting`] hub.
13437///
13438/// # Example
13439///
13440/// Instantiate a resource builder
13441///
13442/// ```test_harness,no_run
13443/// extern crate hyper;
13444/// extern crate hyper_rustls;
13445/// extern crate google_dfareporting3d3 as dfareporting3d3;
13446///
13447/// # async fn dox() {
13448/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13449///
13450/// let secret: yup_oauth2::ApplicationSecret = Default::default();
13451/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13452///     secret,
13453///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13454/// ).build().await.unwrap();
13455///
13456/// let client = hyper_util::client::legacy::Client::builder(
13457///     hyper_util::rt::TokioExecutor::new()
13458/// )
13459/// .build(
13460///     hyper_rustls::HttpsConnectorBuilder::new()
13461///         .with_native_roots()
13462///         .unwrap()
13463///         .https_or_http()
13464///         .enable_http1()
13465///         .build()
13466/// );
13467/// let mut hub = Dfareporting::new(client, auth);
13468/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
13469/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
13470/// // to build up your call.
13471/// let rb = hub.remarketing_lists();
13472/// # }
13473/// ```
13474pub struct RemarketingListMethods<'a, C>
13475where
13476    C: 'a,
13477{
13478    hub: &'a Dfareporting<C>,
13479}
13480
13481impl<'a, C> common::MethodsBuilder for RemarketingListMethods<'a, C> {}
13482
13483impl<'a, C> RemarketingListMethods<'a, C> {
13484    /// Create a builder to help you perform the following task:
13485    ///
13486    /// Gets one remarketing list by ID.
13487    ///
13488    /// # Arguments
13489    ///
13490    /// * `profileId` - User profile ID associated with this request.
13491    /// * `id` - Remarketing list ID.
13492    pub fn get(&self, profile_id: i64, id: i64) -> RemarketingListGetCall<'a, C> {
13493        RemarketingListGetCall {
13494            hub: self.hub,
13495            _profile_id: profile_id,
13496            _id: id,
13497            _delegate: Default::default(),
13498            _additional_params: Default::default(),
13499            _scopes: Default::default(),
13500        }
13501    }
13502
13503    /// Create a builder to help you perform the following task:
13504    ///
13505    /// Inserts a new remarketing list.
13506    ///
13507    /// # Arguments
13508    ///
13509    /// * `request` - No description provided.
13510    /// * `profileId` - User profile ID associated with this request.
13511    pub fn insert(
13512        &self,
13513        request: RemarketingList,
13514        profile_id: i64,
13515    ) -> RemarketingListInsertCall<'a, C> {
13516        RemarketingListInsertCall {
13517            hub: self.hub,
13518            _request: request,
13519            _profile_id: profile_id,
13520            _delegate: Default::default(),
13521            _additional_params: Default::default(),
13522            _scopes: Default::default(),
13523        }
13524    }
13525
13526    /// Create a builder to help you perform the following task:
13527    ///
13528    /// Retrieves a list of remarketing lists, possibly filtered. This method supports paging.
13529    ///
13530    /// # Arguments
13531    ///
13532    /// * `profileId` - User profile ID associated with this request.
13533    /// * `advertiserId` - Select only remarketing lists owned by this advertiser.
13534    pub fn list(&self, profile_id: i64, advertiser_id: i64) -> RemarketingListListCall<'a, C> {
13535        RemarketingListListCall {
13536            hub: self.hub,
13537            _profile_id: profile_id,
13538            _advertiser_id: advertiser_id,
13539            _sort_order: Default::default(),
13540            _sort_field: Default::default(),
13541            _page_token: Default::default(),
13542            _name: Default::default(),
13543            _max_results: Default::default(),
13544            _floodlight_activity_id: Default::default(),
13545            _active: Default::default(),
13546            _delegate: Default::default(),
13547            _additional_params: Default::default(),
13548            _scopes: Default::default(),
13549        }
13550    }
13551
13552    /// Create a builder to help you perform the following task:
13553    ///
13554    /// Updates an existing remarketing list. This method supports patch semantics.
13555    ///
13556    /// # Arguments
13557    ///
13558    /// * `request` - No description provided.
13559    /// * `profileId` - User profile ID associated with this request.
13560    /// * `id` - RemarketingList ID.
13561    pub fn patch(
13562        &self,
13563        request: RemarketingList,
13564        profile_id: i64,
13565        id: i64,
13566    ) -> RemarketingListPatchCall<'a, C> {
13567        RemarketingListPatchCall {
13568            hub: self.hub,
13569            _request: request,
13570            _profile_id: profile_id,
13571            _id: id,
13572            _delegate: Default::default(),
13573            _additional_params: Default::default(),
13574            _scopes: Default::default(),
13575        }
13576    }
13577
13578    /// Create a builder to help you perform the following task:
13579    ///
13580    /// Updates an existing remarketing list.
13581    ///
13582    /// # Arguments
13583    ///
13584    /// * `request` - No description provided.
13585    /// * `profileId` - User profile ID associated with this request.
13586    pub fn update(
13587        &self,
13588        request: RemarketingList,
13589        profile_id: i64,
13590    ) -> RemarketingListUpdateCall<'a, C> {
13591        RemarketingListUpdateCall {
13592            hub: self.hub,
13593            _request: request,
13594            _profile_id: profile_id,
13595            _delegate: Default::default(),
13596            _additional_params: Default::default(),
13597            _scopes: Default::default(),
13598        }
13599    }
13600}
13601
13602/// A builder providing access to all methods supported on *report* resources.
13603/// It is not used directly, but through the [`Dfareporting`] hub.
13604///
13605/// # Example
13606///
13607/// Instantiate a resource builder
13608///
13609/// ```test_harness,no_run
13610/// extern crate hyper;
13611/// extern crate hyper_rustls;
13612/// extern crate google_dfareporting3d3 as dfareporting3d3;
13613///
13614/// # async fn dox() {
13615/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13616///
13617/// let secret: yup_oauth2::ApplicationSecret = Default::default();
13618/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13619///     secret,
13620///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13621/// ).build().await.unwrap();
13622///
13623/// let client = hyper_util::client::legacy::Client::builder(
13624///     hyper_util::rt::TokioExecutor::new()
13625/// )
13626/// .build(
13627///     hyper_rustls::HttpsConnectorBuilder::new()
13628///         .with_native_roots()
13629///         .unwrap()
13630///         .https_or_http()
13631///         .enable_http1()
13632///         .build()
13633/// );
13634/// let mut hub = Dfareporting::new(client, auth);
13635/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
13636/// // like `compatible_fields_query(...)`, `delete(...)`, `files_get(...)`, `files_list(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)`, `run(...)` and `update(...)`
13637/// // to build up your call.
13638/// let rb = hub.reports();
13639/// # }
13640/// ```
13641pub struct ReportMethods<'a, C>
13642where
13643    C: 'a,
13644{
13645    hub: &'a Dfareporting<C>,
13646}
13647
13648impl<'a, C> common::MethodsBuilder for ReportMethods<'a, C> {}
13649
13650impl<'a, C> ReportMethods<'a, C> {
13651    /// Create a builder to help you perform the following task:
13652    ///
13653    /// Returns the fields that are compatible to be selected in the respective sections of a report criteria, given the fields already selected in the input report and user permissions.
13654    ///
13655    /// # Arguments
13656    ///
13657    /// * `request` - No description provided.
13658    /// * `profileId` - The Campaign Manager 360 user profile ID.
13659    pub fn compatible_fields_query(
13660        &self,
13661        request: Report,
13662        profile_id: i64,
13663    ) -> ReportCompatibleFieldQueryCall<'a, C> {
13664        ReportCompatibleFieldQueryCall {
13665            hub: self.hub,
13666            _request: request,
13667            _profile_id: profile_id,
13668            _delegate: Default::default(),
13669            _additional_params: Default::default(),
13670            _scopes: Default::default(),
13671        }
13672    }
13673
13674    /// Create a builder to help you perform the following task:
13675    ///
13676    /// Retrieves a report file by its report ID and file ID. This method supports media download.
13677    ///
13678    /// # Arguments
13679    ///
13680    /// * `profileId` - The Campaign Manager 360 user profile ID.
13681    /// * `reportId` - The ID of the report.
13682    /// * `fileId` - The ID of the report file.
13683    pub fn files_get(
13684        &self,
13685        profile_id: i64,
13686        report_id: i64,
13687        file_id: i64,
13688    ) -> ReportFileGetCall<'a, C> {
13689        ReportFileGetCall {
13690            hub: self.hub,
13691            _profile_id: profile_id,
13692            _report_id: report_id,
13693            _file_id: file_id,
13694            _delegate: Default::default(),
13695            _additional_params: Default::default(),
13696            _scopes: Default::default(),
13697        }
13698    }
13699
13700    /// Create a builder to help you perform the following task:
13701    ///
13702    /// Lists files for a report.
13703    ///
13704    /// # Arguments
13705    ///
13706    /// * `profileId` - The Campaign Manager 360 user profile ID.
13707    /// * `reportId` - The ID of the parent report.
13708    pub fn files_list(&self, profile_id: i64, report_id: i64) -> ReportFileListCall<'a, C> {
13709        ReportFileListCall {
13710            hub: self.hub,
13711            _profile_id: profile_id,
13712            _report_id: report_id,
13713            _sort_order: Default::default(),
13714            _sort_field: Default::default(),
13715            _page_token: Default::default(),
13716            _max_results: Default::default(),
13717            _delegate: Default::default(),
13718            _additional_params: Default::default(),
13719            _scopes: Default::default(),
13720        }
13721    }
13722
13723    /// Create a builder to help you perform the following task:
13724    ///
13725    /// Deletes a report by its ID.
13726    ///
13727    /// # Arguments
13728    ///
13729    /// * `profileId` - The Campaign Manager 360 user profile ID.
13730    /// * `reportId` - The ID of the report.
13731    pub fn delete(&self, profile_id: i64, report_id: i64) -> ReportDeleteCall<'a, C> {
13732        ReportDeleteCall {
13733            hub: self.hub,
13734            _profile_id: profile_id,
13735            _report_id: report_id,
13736            _delegate: Default::default(),
13737            _additional_params: Default::default(),
13738            _scopes: Default::default(),
13739        }
13740    }
13741
13742    /// Create a builder to help you perform the following task:
13743    ///
13744    /// Retrieves a report by its ID.
13745    ///
13746    /// # Arguments
13747    ///
13748    /// * `profileId` - The Campaign Manager 360 user profile ID.
13749    /// * `reportId` - The ID of the report.
13750    pub fn get(&self, profile_id: i64, report_id: i64) -> ReportGetCall<'a, C> {
13751        ReportGetCall {
13752            hub: self.hub,
13753            _profile_id: profile_id,
13754            _report_id: report_id,
13755            _delegate: Default::default(),
13756            _additional_params: Default::default(),
13757            _scopes: Default::default(),
13758        }
13759    }
13760
13761    /// Create a builder to help you perform the following task:
13762    ///
13763    /// Creates a report.
13764    ///
13765    /// # Arguments
13766    ///
13767    /// * `request` - No description provided.
13768    /// * `profileId` - The Campaign Manager 360 user profile ID.
13769    pub fn insert(&self, request: Report, profile_id: i64) -> ReportInsertCall<'a, C> {
13770        ReportInsertCall {
13771            hub: self.hub,
13772            _request: request,
13773            _profile_id: profile_id,
13774            _delegate: Default::default(),
13775            _additional_params: Default::default(),
13776            _scopes: Default::default(),
13777        }
13778    }
13779
13780    /// Create a builder to help you perform the following task:
13781    ///
13782    /// Retrieves list of reports.
13783    ///
13784    /// # Arguments
13785    ///
13786    /// * `profileId` - The Campaign Manager 360 user profile ID.
13787    pub fn list(&self, profile_id: i64) -> ReportListCall<'a, C> {
13788        ReportListCall {
13789            hub: self.hub,
13790            _profile_id: profile_id,
13791            _sort_order: Default::default(),
13792            _sort_field: Default::default(),
13793            _scope: Default::default(),
13794            _page_token: Default::default(),
13795            _max_results: Default::default(),
13796            _delegate: Default::default(),
13797            _additional_params: Default::default(),
13798            _scopes: Default::default(),
13799        }
13800    }
13801
13802    /// Create a builder to help you perform the following task:
13803    ///
13804    /// Updates an existing report. This method supports patch semantics.
13805    ///
13806    /// # Arguments
13807    ///
13808    /// * `request` - No description provided.
13809    /// * `profileId` - The DFA user profile ID.
13810    /// * `reportId` - The ID of the report.
13811    pub fn patch(
13812        &self,
13813        request: Report,
13814        profile_id: i64,
13815        report_id: i64,
13816    ) -> ReportPatchCall<'a, C> {
13817        ReportPatchCall {
13818            hub: self.hub,
13819            _request: request,
13820            _profile_id: profile_id,
13821            _report_id: report_id,
13822            _delegate: Default::default(),
13823            _additional_params: Default::default(),
13824            _scopes: Default::default(),
13825        }
13826    }
13827
13828    /// Create a builder to help you perform the following task:
13829    ///
13830    /// Runs a report.
13831    ///
13832    /// # Arguments
13833    ///
13834    /// * `profileId` - The Campaign Manager 360 user profile ID.
13835    /// * `reportId` - The ID of the report.
13836    pub fn run(&self, profile_id: i64, report_id: i64) -> ReportRunCall<'a, C> {
13837        ReportRunCall {
13838            hub: self.hub,
13839            _profile_id: profile_id,
13840            _report_id: report_id,
13841            _synchronous: Default::default(),
13842            _delegate: Default::default(),
13843            _additional_params: Default::default(),
13844            _scopes: Default::default(),
13845        }
13846    }
13847
13848    /// Create a builder to help you perform the following task:
13849    ///
13850    /// Updates a report.
13851    ///
13852    /// # Arguments
13853    ///
13854    /// * `request` - No description provided.
13855    /// * `profileId` - The Campaign Manager 360 user profile ID.
13856    /// * `reportId` - The ID of the report.
13857    pub fn update(
13858        &self,
13859        request: Report,
13860        profile_id: i64,
13861        report_id: i64,
13862    ) -> ReportUpdateCall<'a, C> {
13863        ReportUpdateCall {
13864            hub: self.hub,
13865            _request: request,
13866            _profile_id: profile_id,
13867            _report_id: report_id,
13868            _delegate: Default::default(),
13869            _additional_params: Default::default(),
13870            _scopes: Default::default(),
13871        }
13872    }
13873}
13874
13875/// A builder providing access to all methods supported on *site* resources.
13876/// It is not used directly, but through the [`Dfareporting`] hub.
13877///
13878/// # Example
13879///
13880/// Instantiate a resource builder
13881///
13882/// ```test_harness,no_run
13883/// extern crate hyper;
13884/// extern crate hyper_rustls;
13885/// extern crate google_dfareporting3d3 as dfareporting3d3;
13886///
13887/// # async fn dox() {
13888/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13889///
13890/// let secret: yup_oauth2::ApplicationSecret = Default::default();
13891/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13892///     secret,
13893///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13894/// ).build().await.unwrap();
13895///
13896/// let client = hyper_util::client::legacy::Client::builder(
13897///     hyper_util::rt::TokioExecutor::new()
13898/// )
13899/// .build(
13900///     hyper_rustls::HttpsConnectorBuilder::new()
13901///         .with_native_roots()
13902///         .unwrap()
13903///         .https_or_http()
13904///         .enable_http1()
13905///         .build()
13906/// );
13907/// let mut hub = Dfareporting::new(client, auth);
13908/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
13909/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
13910/// // to build up your call.
13911/// let rb = hub.sites();
13912/// # }
13913/// ```
13914pub struct SiteMethods<'a, C>
13915where
13916    C: 'a,
13917{
13918    hub: &'a Dfareporting<C>,
13919}
13920
13921impl<'a, C> common::MethodsBuilder for SiteMethods<'a, C> {}
13922
13923impl<'a, C> SiteMethods<'a, C> {
13924    /// Create a builder to help you perform the following task:
13925    ///
13926    /// Gets one site by ID.
13927    ///
13928    /// # Arguments
13929    ///
13930    /// * `profileId` - User profile ID associated with this request.
13931    /// * `id` - Site ID.
13932    pub fn get(&self, profile_id: i64, id: i64) -> SiteGetCall<'a, C> {
13933        SiteGetCall {
13934            hub: self.hub,
13935            _profile_id: profile_id,
13936            _id: id,
13937            _delegate: Default::default(),
13938            _additional_params: Default::default(),
13939            _scopes: Default::default(),
13940        }
13941    }
13942
13943    /// Create a builder to help you perform the following task:
13944    ///
13945    /// Inserts a new site.
13946    ///
13947    /// # Arguments
13948    ///
13949    /// * `request` - No description provided.
13950    /// * `profileId` - User profile ID associated with this request.
13951    pub fn insert(&self, request: Site, profile_id: i64) -> SiteInsertCall<'a, C> {
13952        SiteInsertCall {
13953            hub: self.hub,
13954            _request: request,
13955            _profile_id: profile_id,
13956            _delegate: Default::default(),
13957            _additional_params: Default::default(),
13958            _scopes: Default::default(),
13959        }
13960    }
13961
13962    /// Create a builder to help you perform the following task:
13963    ///
13964    /// Retrieves a list of sites, possibly filtered. This method supports paging.
13965    ///
13966    /// # Arguments
13967    ///
13968    /// * `profileId` - User profile ID associated with this request.
13969    pub fn list(&self, profile_id: i64) -> SiteListCall<'a, C> {
13970        SiteListCall {
13971            hub: self.hub,
13972            _profile_id: profile_id,
13973            _unmapped_site: Default::default(),
13974            _subaccount_id: Default::default(),
13975            _sort_order: Default::default(),
13976            _sort_field: Default::default(),
13977            _search_string: Default::default(),
13978            _page_token: Default::default(),
13979            _max_results: Default::default(),
13980            _ids: Default::default(),
13981            _directory_site_ids: Default::default(),
13982            _campaign_ids: Default::default(),
13983            _approved: Default::default(),
13984            _ad_words_site: Default::default(),
13985            _accepts_publisher_paid_placements: Default::default(),
13986            _accepts_interstitial_placements: Default::default(),
13987            _accepts_in_stream_video_placements: Default::default(),
13988            _delegate: Default::default(),
13989            _additional_params: Default::default(),
13990            _scopes: Default::default(),
13991        }
13992    }
13993
13994    /// Create a builder to help you perform the following task:
13995    ///
13996    /// Updates an existing site. This method supports patch semantics.
13997    ///
13998    /// # Arguments
13999    ///
14000    /// * `request` - No description provided.
14001    /// * `profileId` - User profile ID associated with this request.
14002    /// * `id` - Site ID.
14003    pub fn patch(&self, request: Site, profile_id: i64, id: i64) -> SitePatchCall<'a, C> {
14004        SitePatchCall {
14005            hub: self.hub,
14006            _request: request,
14007            _profile_id: profile_id,
14008            _id: id,
14009            _delegate: Default::default(),
14010            _additional_params: Default::default(),
14011            _scopes: Default::default(),
14012        }
14013    }
14014
14015    /// Create a builder to help you perform the following task:
14016    ///
14017    /// Updates an existing site.
14018    ///
14019    /// # Arguments
14020    ///
14021    /// * `request` - No description provided.
14022    /// * `profileId` - User profile ID associated with this request.
14023    pub fn update(&self, request: Site, profile_id: i64) -> SiteUpdateCall<'a, C> {
14024        SiteUpdateCall {
14025            hub: self.hub,
14026            _request: request,
14027            _profile_id: profile_id,
14028            _delegate: Default::default(),
14029            _additional_params: Default::default(),
14030            _scopes: Default::default(),
14031        }
14032    }
14033}
14034
14035/// A builder providing access to all methods supported on *size* resources.
14036/// It is not used directly, but through the [`Dfareporting`] hub.
14037///
14038/// # Example
14039///
14040/// Instantiate a resource builder
14041///
14042/// ```test_harness,no_run
14043/// extern crate hyper;
14044/// extern crate hyper_rustls;
14045/// extern crate google_dfareporting3d3 as dfareporting3d3;
14046///
14047/// # async fn dox() {
14048/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14049///
14050/// let secret: yup_oauth2::ApplicationSecret = Default::default();
14051/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14052///     secret,
14053///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14054/// ).build().await.unwrap();
14055///
14056/// let client = hyper_util::client::legacy::Client::builder(
14057///     hyper_util::rt::TokioExecutor::new()
14058/// )
14059/// .build(
14060///     hyper_rustls::HttpsConnectorBuilder::new()
14061///         .with_native_roots()
14062///         .unwrap()
14063///         .https_or_http()
14064///         .enable_http1()
14065///         .build()
14066/// );
14067/// let mut hub = Dfareporting::new(client, auth);
14068/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
14069/// // like `get(...)`, `insert(...)` and `list(...)`
14070/// // to build up your call.
14071/// let rb = hub.sizes();
14072/// # }
14073/// ```
14074pub struct SizeMethods<'a, C>
14075where
14076    C: 'a,
14077{
14078    hub: &'a Dfareporting<C>,
14079}
14080
14081impl<'a, C> common::MethodsBuilder for SizeMethods<'a, C> {}
14082
14083impl<'a, C> SizeMethods<'a, C> {
14084    /// Create a builder to help you perform the following task:
14085    ///
14086    /// Gets one size by ID.
14087    ///
14088    /// # Arguments
14089    ///
14090    /// * `profileId` - User profile ID associated with this request.
14091    /// * `id` - Size ID.
14092    pub fn get(&self, profile_id: i64, id: i64) -> SizeGetCall<'a, C> {
14093        SizeGetCall {
14094            hub: self.hub,
14095            _profile_id: profile_id,
14096            _id: id,
14097            _delegate: Default::default(),
14098            _additional_params: Default::default(),
14099            _scopes: Default::default(),
14100        }
14101    }
14102
14103    /// Create a builder to help you perform the following task:
14104    ///
14105    /// Inserts a new size.
14106    ///
14107    /// # Arguments
14108    ///
14109    /// * `request` - No description provided.
14110    /// * `profileId` - User profile ID associated with this request.
14111    pub fn insert(&self, request: Size, profile_id: i64) -> SizeInsertCall<'a, C> {
14112        SizeInsertCall {
14113            hub: self.hub,
14114            _request: request,
14115            _profile_id: profile_id,
14116            _delegate: Default::default(),
14117            _additional_params: Default::default(),
14118            _scopes: Default::default(),
14119        }
14120    }
14121
14122    /// Create a builder to help you perform the following task:
14123    ///
14124    /// Retrieves a list of sizes, possibly filtered. Retrieved sizes are globally unique and may include values not currently in use by your account. Due to this, the list of sizes returned by this method may differ from the list seen in the Trafficking UI.
14125    ///
14126    /// # Arguments
14127    ///
14128    /// * `profileId` - User profile ID associated with this request.
14129    pub fn list(&self, profile_id: i64) -> SizeListCall<'a, C> {
14130        SizeListCall {
14131            hub: self.hub,
14132            _profile_id: profile_id,
14133            _width: Default::default(),
14134            _ids: Default::default(),
14135            _iab_standard: Default::default(),
14136            _height: Default::default(),
14137            _delegate: Default::default(),
14138            _additional_params: Default::default(),
14139            _scopes: Default::default(),
14140        }
14141    }
14142}
14143
14144/// A builder providing access to all methods supported on *subaccount* resources.
14145/// It is not used directly, but through the [`Dfareporting`] hub.
14146///
14147/// # Example
14148///
14149/// Instantiate a resource builder
14150///
14151/// ```test_harness,no_run
14152/// extern crate hyper;
14153/// extern crate hyper_rustls;
14154/// extern crate google_dfareporting3d3 as dfareporting3d3;
14155///
14156/// # async fn dox() {
14157/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14158///
14159/// let secret: yup_oauth2::ApplicationSecret = Default::default();
14160/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14161///     secret,
14162///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14163/// ).build().await.unwrap();
14164///
14165/// let client = hyper_util::client::legacy::Client::builder(
14166///     hyper_util::rt::TokioExecutor::new()
14167/// )
14168/// .build(
14169///     hyper_rustls::HttpsConnectorBuilder::new()
14170///         .with_native_roots()
14171///         .unwrap()
14172///         .https_or_http()
14173///         .enable_http1()
14174///         .build()
14175/// );
14176/// let mut hub = Dfareporting::new(client, auth);
14177/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
14178/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
14179/// // to build up your call.
14180/// let rb = hub.subaccounts();
14181/// # }
14182/// ```
14183pub struct SubaccountMethods<'a, C>
14184where
14185    C: 'a,
14186{
14187    hub: &'a Dfareporting<C>,
14188}
14189
14190impl<'a, C> common::MethodsBuilder for SubaccountMethods<'a, C> {}
14191
14192impl<'a, C> SubaccountMethods<'a, C> {
14193    /// Create a builder to help you perform the following task:
14194    ///
14195    /// Gets one subaccount by ID.
14196    ///
14197    /// # Arguments
14198    ///
14199    /// * `profileId` - User profile ID associated with this request.
14200    /// * `id` - Subaccount ID.
14201    pub fn get(&self, profile_id: i64, id: i64) -> SubaccountGetCall<'a, C> {
14202        SubaccountGetCall {
14203            hub: self.hub,
14204            _profile_id: profile_id,
14205            _id: id,
14206            _delegate: Default::default(),
14207            _additional_params: Default::default(),
14208            _scopes: Default::default(),
14209        }
14210    }
14211
14212    /// Create a builder to help you perform the following task:
14213    ///
14214    /// Inserts a new subaccount.
14215    ///
14216    /// # Arguments
14217    ///
14218    /// * `request` - No description provided.
14219    /// * `profileId` - User profile ID associated with this request.
14220    pub fn insert(&self, request: Subaccount, profile_id: i64) -> SubaccountInsertCall<'a, C> {
14221        SubaccountInsertCall {
14222            hub: self.hub,
14223            _request: request,
14224            _profile_id: profile_id,
14225            _delegate: Default::default(),
14226            _additional_params: Default::default(),
14227            _scopes: Default::default(),
14228        }
14229    }
14230
14231    /// Create a builder to help you perform the following task:
14232    ///
14233    /// Gets a list of subaccounts, possibly filtered. This method supports paging.
14234    ///
14235    /// # Arguments
14236    ///
14237    /// * `profileId` - User profile ID associated with this request.
14238    pub fn list(&self, profile_id: i64) -> SubaccountListCall<'a, C> {
14239        SubaccountListCall {
14240            hub: self.hub,
14241            _profile_id: profile_id,
14242            _sort_order: Default::default(),
14243            _sort_field: Default::default(),
14244            _search_string: Default::default(),
14245            _page_token: Default::default(),
14246            _max_results: Default::default(),
14247            _ids: Default::default(),
14248            _delegate: Default::default(),
14249            _additional_params: Default::default(),
14250            _scopes: Default::default(),
14251        }
14252    }
14253
14254    /// Create a builder to help you perform the following task:
14255    ///
14256    /// Updates an existing subaccount. This method supports patch semantics.
14257    ///
14258    /// # Arguments
14259    ///
14260    /// * `request` - No description provided.
14261    /// * `profileId` - User profile ID associated with this request.
14262    /// * `id` - Subaccount ID.
14263    pub fn patch(
14264        &self,
14265        request: Subaccount,
14266        profile_id: i64,
14267        id: i64,
14268    ) -> SubaccountPatchCall<'a, C> {
14269        SubaccountPatchCall {
14270            hub: self.hub,
14271            _request: request,
14272            _profile_id: profile_id,
14273            _id: id,
14274            _delegate: Default::default(),
14275            _additional_params: Default::default(),
14276            _scopes: Default::default(),
14277        }
14278    }
14279
14280    /// Create a builder to help you perform the following task:
14281    ///
14282    /// Updates an existing subaccount.
14283    ///
14284    /// # Arguments
14285    ///
14286    /// * `request` - No description provided.
14287    /// * `profileId` - User profile ID associated with this request.
14288    pub fn update(&self, request: Subaccount, profile_id: i64) -> SubaccountUpdateCall<'a, C> {
14289        SubaccountUpdateCall {
14290            hub: self.hub,
14291            _request: request,
14292            _profile_id: profile_id,
14293            _delegate: Default::default(),
14294            _additional_params: Default::default(),
14295            _scopes: Default::default(),
14296        }
14297    }
14298}
14299
14300/// A builder providing access to all methods supported on *targetableRemarketingList* resources.
14301/// It is not used directly, but through the [`Dfareporting`] hub.
14302///
14303/// # Example
14304///
14305/// Instantiate a resource builder
14306///
14307/// ```test_harness,no_run
14308/// extern crate hyper;
14309/// extern crate hyper_rustls;
14310/// extern crate google_dfareporting3d3 as dfareporting3d3;
14311///
14312/// # async fn dox() {
14313/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14314///
14315/// let secret: yup_oauth2::ApplicationSecret = Default::default();
14316/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14317///     secret,
14318///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14319/// ).build().await.unwrap();
14320///
14321/// let client = hyper_util::client::legacy::Client::builder(
14322///     hyper_util::rt::TokioExecutor::new()
14323/// )
14324/// .build(
14325///     hyper_rustls::HttpsConnectorBuilder::new()
14326///         .with_native_roots()
14327///         .unwrap()
14328///         .https_or_http()
14329///         .enable_http1()
14330///         .build()
14331/// );
14332/// let mut hub = Dfareporting::new(client, auth);
14333/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
14334/// // like `get(...)` and `list(...)`
14335/// // to build up your call.
14336/// let rb = hub.targetable_remarketing_lists();
14337/// # }
14338/// ```
14339pub struct TargetableRemarketingListMethods<'a, C>
14340where
14341    C: 'a,
14342{
14343    hub: &'a Dfareporting<C>,
14344}
14345
14346impl<'a, C> common::MethodsBuilder for TargetableRemarketingListMethods<'a, C> {}
14347
14348impl<'a, C> TargetableRemarketingListMethods<'a, C> {
14349    /// Create a builder to help you perform the following task:
14350    ///
14351    /// Gets one remarketing list by ID.
14352    ///
14353    /// # Arguments
14354    ///
14355    /// * `profileId` - User profile ID associated with this request.
14356    /// * `id` - Remarketing list ID.
14357    pub fn get(&self, profile_id: i64, id: i64) -> TargetableRemarketingListGetCall<'a, C> {
14358        TargetableRemarketingListGetCall {
14359            hub: self.hub,
14360            _profile_id: profile_id,
14361            _id: id,
14362            _delegate: Default::default(),
14363            _additional_params: Default::default(),
14364            _scopes: Default::default(),
14365        }
14366    }
14367
14368    /// Create a builder to help you perform the following task:
14369    ///
14370    /// Retrieves a list of targetable remarketing lists, possibly filtered. This method supports paging.
14371    ///
14372    /// # Arguments
14373    ///
14374    /// * `profileId` - User profile ID associated with this request.
14375    /// * `advertiserId` - Select only targetable remarketing lists targetable by these advertisers.
14376    pub fn list(
14377        &self,
14378        profile_id: i64,
14379        advertiser_id: i64,
14380    ) -> TargetableRemarketingListListCall<'a, C> {
14381        TargetableRemarketingListListCall {
14382            hub: self.hub,
14383            _profile_id: profile_id,
14384            _advertiser_id: advertiser_id,
14385            _sort_order: Default::default(),
14386            _sort_field: Default::default(),
14387            _page_token: Default::default(),
14388            _name: Default::default(),
14389            _max_results: Default::default(),
14390            _active: Default::default(),
14391            _delegate: Default::default(),
14392            _additional_params: Default::default(),
14393            _scopes: Default::default(),
14394        }
14395    }
14396}
14397
14398/// A builder providing access to all methods supported on *targetingTemplate* resources.
14399/// It is not used directly, but through the [`Dfareporting`] hub.
14400///
14401/// # Example
14402///
14403/// Instantiate a resource builder
14404///
14405/// ```test_harness,no_run
14406/// extern crate hyper;
14407/// extern crate hyper_rustls;
14408/// extern crate google_dfareporting3d3 as dfareporting3d3;
14409///
14410/// # async fn dox() {
14411/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14412///
14413/// let secret: yup_oauth2::ApplicationSecret = Default::default();
14414/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14415///     secret,
14416///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14417/// ).build().await.unwrap();
14418///
14419/// let client = hyper_util::client::legacy::Client::builder(
14420///     hyper_util::rt::TokioExecutor::new()
14421/// )
14422/// .build(
14423///     hyper_rustls::HttpsConnectorBuilder::new()
14424///         .with_native_roots()
14425///         .unwrap()
14426///         .https_or_http()
14427///         .enable_http1()
14428///         .build()
14429/// );
14430/// let mut hub = Dfareporting::new(client, auth);
14431/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
14432/// // like `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
14433/// // to build up your call.
14434/// let rb = hub.targeting_templates();
14435/// # }
14436/// ```
14437pub struct TargetingTemplateMethods<'a, C>
14438where
14439    C: 'a,
14440{
14441    hub: &'a Dfareporting<C>,
14442}
14443
14444impl<'a, C> common::MethodsBuilder for TargetingTemplateMethods<'a, C> {}
14445
14446impl<'a, C> TargetingTemplateMethods<'a, C> {
14447    /// Create a builder to help you perform the following task:
14448    ///
14449    /// Gets one targeting template by ID.
14450    ///
14451    /// # Arguments
14452    ///
14453    /// * `profileId` - User profile ID associated with this request.
14454    /// * `id` - Targeting template ID.
14455    pub fn get(&self, profile_id: i64, id: i64) -> TargetingTemplateGetCall<'a, C> {
14456        TargetingTemplateGetCall {
14457            hub: self.hub,
14458            _profile_id: profile_id,
14459            _id: id,
14460            _delegate: Default::default(),
14461            _additional_params: Default::default(),
14462            _scopes: Default::default(),
14463        }
14464    }
14465
14466    /// Create a builder to help you perform the following task:
14467    ///
14468    /// Inserts a new targeting template.
14469    ///
14470    /// # Arguments
14471    ///
14472    /// * `request` - No description provided.
14473    /// * `profileId` - User profile ID associated with this request.
14474    pub fn insert(
14475        &self,
14476        request: TargetingTemplate,
14477        profile_id: i64,
14478    ) -> TargetingTemplateInsertCall<'a, C> {
14479        TargetingTemplateInsertCall {
14480            hub: self.hub,
14481            _request: request,
14482            _profile_id: profile_id,
14483            _delegate: Default::default(),
14484            _additional_params: Default::default(),
14485            _scopes: Default::default(),
14486        }
14487    }
14488
14489    /// Create a builder to help you perform the following task:
14490    ///
14491    /// Retrieves a list of targeting templates, optionally filtered. This method supports paging.
14492    ///
14493    /// # Arguments
14494    ///
14495    /// * `profileId` - User profile ID associated with this request.
14496    pub fn list(&self, profile_id: i64) -> TargetingTemplateListCall<'a, C> {
14497        TargetingTemplateListCall {
14498            hub: self.hub,
14499            _profile_id: profile_id,
14500            _sort_order: Default::default(),
14501            _sort_field: Default::default(),
14502            _search_string: Default::default(),
14503            _page_token: Default::default(),
14504            _max_results: Default::default(),
14505            _ids: Default::default(),
14506            _advertiser_id: Default::default(),
14507            _delegate: Default::default(),
14508            _additional_params: Default::default(),
14509            _scopes: Default::default(),
14510        }
14511    }
14512
14513    /// Create a builder to help you perform the following task:
14514    ///
14515    /// Updates an existing targeting template. This method supports patch semantics.
14516    ///
14517    /// # Arguments
14518    ///
14519    /// * `request` - No description provided.
14520    /// * `profileId` - User profile ID associated with this request.
14521    /// * `id` - TargetingTemplate ID.
14522    pub fn patch(
14523        &self,
14524        request: TargetingTemplate,
14525        profile_id: i64,
14526        id: i64,
14527    ) -> TargetingTemplatePatchCall<'a, C> {
14528        TargetingTemplatePatchCall {
14529            hub: self.hub,
14530            _request: request,
14531            _profile_id: profile_id,
14532            _id: id,
14533            _delegate: Default::default(),
14534            _additional_params: Default::default(),
14535            _scopes: Default::default(),
14536        }
14537    }
14538
14539    /// Create a builder to help you perform the following task:
14540    ///
14541    /// Updates an existing targeting template.
14542    ///
14543    /// # Arguments
14544    ///
14545    /// * `request` - No description provided.
14546    /// * `profileId` - User profile ID associated with this request.
14547    pub fn update(
14548        &self,
14549        request: TargetingTemplate,
14550        profile_id: i64,
14551    ) -> TargetingTemplateUpdateCall<'a, C> {
14552        TargetingTemplateUpdateCall {
14553            hub: self.hub,
14554            _request: request,
14555            _profile_id: profile_id,
14556            _delegate: Default::default(),
14557            _additional_params: Default::default(),
14558            _scopes: Default::default(),
14559        }
14560    }
14561}
14562
14563/// A builder providing access to all methods supported on *userProfile* resources.
14564/// It is not used directly, but through the [`Dfareporting`] hub.
14565///
14566/// # Example
14567///
14568/// Instantiate a resource builder
14569///
14570/// ```test_harness,no_run
14571/// extern crate hyper;
14572/// extern crate hyper_rustls;
14573/// extern crate google_dfareporting3d3 as dfareporting3d3;
14574///
14575/// # async fn dox() {
14576/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14577///
14578/// let secret: yup_oauth2::ApplicationSecret = Default::default();
14579/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14580///     secret,
14581///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14582/// ).build().await.unwrap();
14583///
14584/// let client = hyper_util::client::legacy::Client::builder(
14585///     hyper_util::rt::TokioExecutor::new()
14586/// )
14587/// .build(
14588///     hyper_rustls::HttpsConnectorBuilder::new()
14589///         .with_native_roots()
14590///         .unwrap()
14591///         .https_or_http()
14592///         .enable_http1()
14593///         .build()
14594/// );
14595/// let mut hub = Dfareporting::new(client, auth);
14596/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
14597/// // like `get(...)` and `list(...)`
14598/// // to build up your call.
14599/// let rb = hub.user_profiles();
14600/// # }
14601/// ```
14602pub struct UserProfileMethods<'a, C>
14603where
14604    C: 'a,
14605{
14606    hub: &'a Dfareporting<C>,
14607}
14608
14609impl<'a, C> common::MethodsBuilder for UserProfileMethods<'a, C> {}
14610
14611impl<'a, C> UserProfileMethods<'a, C> {
14612    /// Create a builder to help you perform the following task:
14613    ///
14614    /// Gets one user profile by ID.
14615    ///
14616    /// # Arguments
14617    ///
14618    /// * `profileId` - The user profile ID.
14619    pub fn get(&self, profile_id: i64) -> UserProfileGetCall<'a, C> {
14620        UserProfileGetCall {
14621            hub: self.hub,
14622            _profile_id: profile_id,
14623            _delegate: Default::default(),
14624            _additional_params: Default::default(),
14625            _scopes: Default::default(),
14626        }
14627    }
14628
14629    /// Create a builder to help you perform the following task:
14630    ///
14631    /// Retrieves list of user profiles for a user.
14632    pub fn list(&self) -> UserProfileListCall<'a, C> {
14633        UserProfileListCall {
14634            hub: self.hub,
14635            _delegate: Default::default(),
14636            _additional_params: Default::default(),
14637            _scopes: Default::default(),
14638        }
14639    }
14640}
14641
14642/// A builder providing access to all methods supported on *userRolePermissionGroup* resources.
14643/// It is not used directly, but through the [`Dfareporting`] hub.
14644///
14645/// # Example
14646///
14647/// Instantiate a resource builder
14648///
14649/// ```test_harness,no_run
14650/// extern crate hyper;
14651/// extern crate hyper_rustls;
14652/// extern crate google_dfareporting3d3 as dfareporting3d3;
14653///
14654/// # async fn dox() {
14655/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14656///
14657/// let secret: yup_oauth2::ApplicationSecret = Default::default();
14658/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14659///     secret,
14660///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14661/// ).build().await.unwrap();
14662///
14663/// let client = hyper_util::client::legacy::Client::builder(
14664///     hyper_util::rt::TokioExecutor::new()
14665/// )
14666/// .build(
14667///     hyper_rustls::HttpsConnectorBuilder::new()
14668///         .with_native_roots()
14669///         .unwrap()
14670///         .https_or_http()
14671///         .enable_http1()
14672///         .build()
14673/// );
14674/// let mut hub = Dfareporting::new(client, auth);
14675/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
14676/// // like `get(...)` and `list(...)`
14677/// // to build up your call.
14678/// let rb = hub.user_role_permission_groups();
14679/// # }
14680/// ```
14681pub struct UserRolePermissionGroupMethods<'a, C>
14682where
14683    C: 'a,
14684{
14685    hub: &'a Dfareporting<C>,
14686}
14687
14688impl<'a, C> common::MethodsBuilder for UserRolePermissionGroupMethods<'a, C> {}
14689
14690impl<'a, C> UserRolePermissionGroupMethods<'a, C> {
14691    /// Create a builder to help you perform the following task:
14692    ///
14693    /// Gets one user role permission group by ID.
14694    ///
14695    /// # Arguments
14696    ///
14697    /// * `profileId` - User profile ID associated with this request.
14698    /// * `id` - User role permission group ID.
14699    pub fn get(&self, profile_id: i64, id: i64) -> UserRolePermissionGroupGetCall<'a, C> {
14700        UserRolePermissionGroupGetCall {
14701            hub: self.hub,
14702            _profile_id: profile_id,
14703            _id: id,
14704            _delegate: Default::default(),
14705            _additional_params: Default::default(),
14706            _scopes: Default::default(),
14707        }
14708    }
14709
14710    /// Create a builder to help you perform the following task:
14711    ///
14712    /// Gets a list of all supported user role permission groups.
14713    ///
14714    /// # Arguments
14715    ///
14716    /// * `profileId` - User profile ID associated with this request.
14717    pub fn list(&self, profile_id: i64) -> UserRolePermissionGroupListCall<'a, C> {
14718        UserRolePermissionGroupListCall {
14719            hub: self.hub,
14720            _profile_id: profile_id,
14721            _delegate: Default::default(),
14722            _additional_params: Default::default(),
14723            _scopes: Default::default(),
14724        }
14725    }
14726}
14727
14728/// A builder providing access to all methods supported on *userRolePermission* resources.
14729/// It is not used directly, but through the [`Dfareporting`] hub.
14730///
14731/// # Example
14732///
14733/// Instantiate a resource builder
14734///
14735/// ```test_harness,no_run
14736/// extern crate hyper;
14737/// extern crate hyper_rustls;
14738/// extern crate google_dfareporting3d3 as dfareporting3d3;
14739///
14740/// # async fn dox() {
14741/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14742///
14743/// let secret: yup_oauth2::ApplicationSecret = Default::default();
14744/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14745///     secret,
14746///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14747/// ).build().await.unwrap();
14748///
14749/// let client = hyper_util::client::legacy::Client::builder(
14750///     hyper_util::rt::TokioExecutor::new()
14751/// )
14752/// .build(
14753///     hyper_rustls::HttpsConnectorBuilder::new()
14754///         .with_native_roots()
14755///         .unwrap()
14756///         .https_or_http()
14757///         .enable_http1()
14758///         .build()
14759/// );
14760/// let mut hub = Dfareporting::new(client, auth);
14761/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
14762/// // like `get(...)` and `list(...)`
14763/// // to build up your call.
14764/// let rb = hub.user_role_permissions();
14765/// # }
14766/// ```
14767pub struct UserRolePermissionMethods<'a, C>
14768where
14769    C: 'a,
14770{
14771    hub: &'a Dfareporting<C>,
14772}
14773
14774impl<'a, C> common::MethodsBuilder for UserRolePermissionMethods<'a, C> {}
14775
14776impl<'a, C> UserRolePermissionMethods<'a, C> {
14777    /// Create a builder to help you perform the following task:
14778    ///
14779    /// Gets one user role permission by ID.
14780    ///
14781    /// # Arguments
14782    ///
14783    /// * `profileId` - User profile ID associated with this request.
14784    /// * `id` - User role permission ID.
14785    pub fn get(&self, profile_id: i64, id: i64) -> UserRolePermissionGetCall<'a, C> {
14786        UserRolePermissionGetCall {
14787            hub: self.hub,
14788            _profile_id: profile_id,
14789            _id: id,
14790            _delegate: Default::default(),
14791            _additional_params: Default::default(),
14792            _scopes: Default::default(),
14793        }
14794    }
14795
14796    /// Create a builder to help you perform the following task:
14797    ///
14798    /// Gets a list of user role permissions, possibly filtered.
14799    ///
14800    /// # Arguments
14801    ///
14802    /// * `profileId` - User profile ID associated with this request.
14803    pub fn list(&self, profile_id: i64) -> UserRolePermissionListCall<'a, C> {
14804        UserRolePermissionListCall {
14805            hub: self.hub,
14806            _profile_id: profile_id,
14807            _ids: Default::default(),
14808            _delegate: Default::default(),
14809            _additional_params: Default::default(),
14810            _scopes: Default::default(),
14811        }
14812    }
14813}
14814
14815/// A builder providing access to all methods supported on *userRole* resources.
14816/// It is not used directly, but through the [`Dfareporting`] hub.
14817///
14818/// # Example
14819///
14820/// Instantiate a resource builder
14821///
14822/// ```test_harness,no_run
14823/// extern crate hyper;
14824/// extern crate hyper_rustls;
14825/// extern crate google_dfareporting3d3 as dfareporting3d3;
14826///
14827/// # async fn dox() {
14828/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14829///
14830/// let secret: yup_oauth2::ApplicationSecret = Default::default();
14831/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14832///     secret,
14833///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14834/// ).build().await.unwrap();
14835///
14836/// let client = hyper_util::client::legacy::Client::builder(
14837///     hyper_util::rt::TokioExecutor::new()
14838/// )
14839/// .build(
14840///     hyper_rustls::HttpsConnectorBuilder::new()
14841///         .with_native_roots()
14842///         .unwrap()
14843///         .https_or_http()
14844///         .enable_http1()
14845///         .build()
14846/// );
14847/// let mut hub = Dfareporting::new(client, auth);
14848/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
14849/// // like `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
14850/// // to build up your call.
14851/// let rb = hub.user_roles();
14852/// # }
14853/// ```
14854pub struct UserRoleMethods<'a, C>
14855where
14856    C: 'a,
14857{
14858    hub: &'a Dfareporting<C>,
14859}
14860
14861impl<'a, C> common::MethodsBuilder for UserRoleMethods<'a, C> {}
14862
14863impl<'a, C> UserRoleMethods<'a, C> {
14864    /// Create a builder to help you perform the following task:
14865    ///
14866    /// Deletes an existing user role.
14867    ///
14868    /// # Arguments
14869    ///
14870    /// * `profileId` - User profile ID associated with this request.
14871    /// * `id` - User role ID.
14872    pub fn delete(&self, profile_id: i64, id: i64) -> UserRoleDeleteCall<'a, C> {
14873        UserRoleDeleteCall {
14874            hub: self.hub,
14875            _profile_id: profile_id,
14876            _id: id,
14877            _delegate: Default::default(),
14878            _additional_params: Default::default(),
14879            _scopes: Default::default(),
14880        }
14881    }
14882
14883    /// Create a builder to help you perform the following task:
14884    ///
14885    /// Gets one user role by ID.
14886    ///
14887    /// # Arguments
14888    ///
14889    /// * `profileId` - User profile ID associated with this request.
14890    /// * `id` - User role ID.
14891    pub fn get(&self, profile_id: i64, id: i64) -> UserRoleGetCall<'a, C> {
14892        UserRoleGetCall {
14893            hub: self.hub,
14894            _profile_id: profile_id,
14895            _id: id,
14896            _delegate: Default::default(),
14897            _additional_params: Default::default(),
14898            _scopes: Default::default(),
14899        }
14900    }
14901
14902    /// Create a builder to help you perform the following task:
14903    ///
14904    /// Inserts a new user role.
14905    ///
14906    /// # Arguments
14907    ///
14908    /// * `request` - No description provided.
14909    /// * `profileId` - User profile ID associated with this request.
14910    pub fn insert(&self, request: UserRole, profile_id: i64) -> UserRoleInsertCall<'a, C> {
14911        UserRoleInsertCall {
14912            hub: self.hub,
14913            _request: request,
14914            _profile_id: profile_id,
14915            _delegate: Default::default(),
14916            _additional_params: Default::default(),
14917            _scopes: Default::default(),
14918        }
14919    }
14920
14921    /// Create a builder to help you perform the following task:
14922    ///
14923    /// Retrieves a list of user roles, possibly filtered. This method supports paging.
14924    ///
14925    /// # Arguments
14926    ///
14927    /// * `profileId` - User profile ID associated with this request.
14928    pub fn list(&self, profile_id: i64) -> UserRoleListCall<'a, C> {
14929        UserRoleListCall {
14930            hub: self.hub,
14931            _profile_id: profile_id,
14932            _subaccount_id: Default::default(),
14933            _sort_order: Default::default(),
14934            _sort_field: Default::default(),
14935            _search_string: Default::default(),
14936            _page_token: Default::default(),
14937            _max_results: Default::default(),
14938            _ids: Default::default(),
14939            _account_user_role_only: Default::default(),
14940            _delegate: Default::default(),
14941            _additional_params: Default::default(),
14942            _scopes: Default::default(),
14943        }
14944    }
14945
14946    /// Create a builder to help you perform the following task:
14947    ///
14948    /// Updates an existing user role. This method supports patch semantics.
14949    ///
14950    /// # Arguments
14951    ///
14952    /// * `request` - No description provided.
14953    /// * `profileId` - User profile ID associated with this request.
14954    /// * `id` - UserRole ID.
14955    pub fn patch(&self, request: UserRole, profile_id: i64, id: i64) -> UserRolePatchCall<'a, C> {
14956        UserRolePatchCall {
14957            hub: self.hub,
14958            _request: request,
14959            _profile_id: profile_id,
14960            _id: id,
14961            _delegate: Default::default(),
14962            _additional_params: Default::default(),
14963            _scopes: Default::default(),
14964        }
14965    }
14966
14967    /// Create a builder to help you perform the following task:
14968    ///
14969    /// Updates an existing user role.
14970    ///
14971    /// # Arguments
14972    ///
14973    /// * `request` - No description provided.
14974    /// * `profileId` - User profile ID associated with this request.
14975    pub fn update(&self, request: UserRole, profile_id: i64) -> UserRoleUpdateCall<'a, C> {
14976        UserRoleUpdateCall {
14977            hub: self.hub,
14978            _request: request,
14979            _profile_id: profile_id,
14980            _delegate: Default::default(),
14981            _additional_params: Default::default(),
14982            _scopes: Default::default(),
14983        }
14984    }
14985}
14986
14987/// A builder providing access to all methods supported on *videoFormat* resources.
14988/// It is not used directly, but through the [`Dfareporting`] hub.
14989///
14990/// # Example
14991///
14992/// Instantiate a resource builder
14993///
14994/// ```test_harness,no_run
14995/// extern crate hyper;
14996/// extern crate hyper_rustls;
14997/// extern crate google_dfareporting3d3 as dfareporting3d3;
14998///
14999/// # async fn dox() {
15000/// use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15001///
15002/// let secret: yup_oauth2::ApplicationSecret = Default::default();
15003/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15004///     secret,
15005///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15006/// ).build().await.unwrap();
15007///
15008/// let client = hyper_util::client::legacy::Client::builder(
15009///     hyper_util::rt::TokioExecutor::new()
15010/// )
15011/// .build(
15012///     hyper_rustls::HttpsConnectorBuilder::new()
15013///         .with_native_roots()
15014///         .unwrap()
15015///         .https_or_http()
15016///         .enable_http1()
15017///         .build()
15018/// );
15019/// let mut hub = Dfareporting::new(client, auth);
15020/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
15021/// // like `get(...)` and `list(...)`
15022/// // to build up your call.
15023/// let rb = hub.video_formats();
15024/// # }
15025/// ```
15026pub struct VideoFormatMethods<'a, C>
15027where
15028    C: 'a,
15029{
15030    hub: &'a Dfareporting<C>,
15031}
15032
15033impl<'a, C> common::MethodsBuilder for VideoFormatMethods<'a, C> {}
15034
15035impl<'a, C> VideoFormatMethods<'a, C> {
15036    /// Create a builder to help you perform the following task:
15037    ///
15038    /// Gets one video format by ID.
15039    ///
15040    /// # Arguments
15041    ///
15042    /// * `profileId` - User profile ID associated with this request.
15043    /// * `id` - Video format ID.
15044    pub fn get(&self, profile_id: i64, id: i32) -> VideoFormatGetCall<'a, C> {
15045        VideoFormatGetCall {
15046            hub: self.hub,
15047            _profile_id: profile_id,
15048            _id: id,
15049            _delegate: Default::default(),
15050            _additional_params: Default::default(),
15051            _scopes: Default::default(),
15052        }
15053    }
15054
15055    /// Create a builder to help you perform the following task:
15056    ///
15057    /// Lists available video formats.
15058    ///
15059    /// # Arguments
15060    ///
15061    /// * `profileId` - User profile ID associated with this request.
15062    pub fn list(&self, profile_id: i64) -> VideoFormatListCall<'a, C> {
15063        VideoFormatListCall {
15064            hub: self.hub,
15065            _profile_id: profile_id,
15066            _delegate: Default::default(),
15067            _additional_params: Default::default(),
15068            _scopes: Default::default(),
15069        }
15070    }
15071}
15072
15073// ###################
15074// CallBuilders   ###
15075// #################
15076
15077/// Gets the account's active ad summary by account ID.
15078///
15079/// A builder for the *get* method supported by a *accountActiveAdSummary* resource.
15080/// It is not used directly, but through a [`AccountActiveAdSummaryMethods`] instance.
15081///
15082/// # Example
15083///
15084/// Instantiate a resource method builder
15085///
15086/// ```test_harness,no_run
15087/// # extern crate hyper;
15088/// # extern crate hyper_rustls;
15089/// # extern crate google_dfareporting3d3 as dfareporting3d3;
15090/// # async fn dox() {
15091/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15092///
15093/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15094/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15095/// #     secret,
15096/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15097/// # ).build().await.unwrap();
15098///
15099/// # let client = hyper_util::client::legacy::Client::builder(
15100/// #     hyper_util::rt::TokioExecutor::new()
15101/// # )
15102/// # .build(
15103/// #     hyper_rustls::HttpsConnectorBuilder::new()
15104/// #         .with_native_roots()
15105/// #         .unwrap()
15106/// #         .https_or_http()
15107/// #         .enable_http1()
15108/// #         .build()
15109/// # );
15110/// # let mut hub = Dfareporting::new(client, auth);
15111/// // You can configure optional parameters by calling the respective setters at will, and
15112/// // execute the final call using `doit()`.
15113/// // Values shown here are possibly random and not representative !
15114/// let result = hub.account_active_ad_summaries().get(-17, -55)
15115///              .doit().await;
15116/// # }
15117/// ```
15118pub struct AccountActiveAdSummaryGetCall<'a, C>
15119where
15120    C: 'a,
15121{
15122    hub: &'a Dfareporting<C>,
15123    _profile_id: i64,
15124    _summary_account_id: i64,
15125    _delegate: Option<&'a mut dyn common::Delegate>,
15126    _additional_params: HashMap<String, String>,
15127    _scopes: BTreeSet<String>,
15128}
15129
15130impl<'a, C> common::CallBuilder for AccountActiveAdSummaryGetCall<'a, C> {}
15131
15132impl<'a, C> AccountActiveAdSummaryGetCall<'a, C>
15133where
15134    C: common::Connector,
15135{
15136    /// Perform the operation you have build so far.
15137    pub async fn doit(mut self) -> common::Result<(common::Response, AccountActiveAdSummary)> {
15138        use std::borrow::Cow;
15139        use std::io::{Read, Seek};
15140
15141        use common::{url::Params, ToParts};
15142        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15143
15144        let mut dd = common::DefaultDelegate;
15145        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15146        dlg.begin(common::MethodInfo {
15147            id: "dfareporting.accountActiveAdSummaries.get",
15148            http_method: hyper::Method::GET,
15149        });
15150
15151        for &field in ["alt", "profileId", "summaryAccountId"].iter() {
15152            if self._additional_params.contains_key(field) {
15153                dlg.finished(false);
15154                return Err(common::Error::FieldClash(field));
15155            }
15156        }
15157
15158        let mut params = Params::with_capacity(4 + self._additional_params.len());
15159        params.push("profileId", self._profile_id.to_string());
15160        params.push("summaryAccountId", self._summary_account_id.to_string());
15161
15162        params.extend(self._additional_params.iter());
15163
15164        params.push("alt", "json");
15165        let mut url = self.hub._base_url.clone()
15166            + "userprofiles/{profileId}/accountActiveAdSummaries/{summaryAccountId}";
15167        if self._scopes.is_empty() {
15168            self._scopes
15169                .insert(Scope::Dfatrafficking.as_ref().to_string());
15170        }
15171
15172        #[allow(clippy::single_element_loop)]
15173        for &(find_this, param_name) in [
15174            ("{profileId}", "profileId"),
15175            ("{summaryAccountId}", "summaryAccountId"),
15176        ]
15177        .iter()
15178        {
15179            url = params.uri_replacement(url, param_name, find_this, false);
15180        }
15181        {
15182            let to_remove = ["summaryAccountId", "profileId"];
15183            params.remove_params(&to_remove);
15184        }
15185
15186        let url = params.parse_with_url(&url);
15187
15188        loop {
15189            let token = match self
15190                .hub
15191                .auth
15192                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15193                .await
15194            {
15195                Ok(token) => token,
15196                Err(e) => match dlg.token(e) {
15197                    Ok(token) => token,
15198                    Err(e) => {
15199                        dlg.finished(false);
15200                        return Err(common::Error::MissingToken(e));
15201                    }
15202                },
15203            };
15204            let mut req_result = {
15205                let client = &self.hub.client;
15206                dlg.pre_request();
15207                let mut req_builder = hyper::Request::builder()
15208                    .method(hyper::Method::GET)
15209                    .uri(url.as_str())
15210                    .header(USER_AGENT, self.hub._user_agent.clone());
15211
15212                if let Some(token) = token.as_ref() {
15213                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15214                }
15215
15216                let request = req_builder
15217                    .header(CONTENT_LENGTH, 0_u64)
15218                    .body(common::to_body::<String>(None));
15219
15220                client.request(request.unwrap()).await
15221            };
15222
15223            match req_result {
15224                Err(err) => {
15225                    if let common::Retry::After(d) = dlg.http_error(&err) {
15226                        sleep(d).await;
15227                        continue;
15228                    }
15229                    dlg.finished(false);
15230                    return Err(common::Error::HttpError(err));
15231                }
15232                Ok(res) => {
15233                    let (mut parts, body) = res.into_parts();
15234                    let mut body = common::Body::new(body);
15235                    if !parts.status.is_success() {
15236                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15237                        let error = serde_json::from_str(&common::to_string(&bytes));
15238                        let response = common::to_response(parts, bytes.into());
15239
15240                        if let common::Retry::After(d) =
15241                            dlg.http_failure(&response, error.as_ref().ok())
15242                        {
15243                            sleep(d).await;
15244                            continue;
15245                        }
15246
15247                        dlg.finished(false);
15248
15249                        return Err(match error {
15250                            Ok(value) => common::Error::BadRequest(value),
15251                            _ => common::Error::Failure(response),
15252                        });
15253                    }
15254                    let response = {
15255                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15256                        let encoded = common::to_string(&bytes);
15257                        match serde_json::from_str(&encoded) {
15258                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15259                            Err(error) => {
15260                                dlg.response_json_decode_error(&encoded, &error);
15261                                return Err(common::Error::JsonDecodeError(
15262                                    encoded.to_string(),
15263                                    error,
15264                                ));
15265                            }
15266                        }
15267                    };
15268
15269                    dlg.finished(true);
15270                    return Ok(response);
15271                }
15272            }
15273        }
15274    }
15275
15276    /// User profile ID associated with this request.
15277    ///
15278    /// Sets the *profile id* path property to the given value.
15279    ///
15280    /// Even though the property as already been set when instantiating this call,
15281    /// we provide this method for API completeness.
15282    pub fn profile_id(mut self, new_value: i64) -> AccountActiveAdSummaryGetCall<'a, C> {
15283        self._profile_id = new_value;
15284        self
15285    }
15286    /// Account ID.
15287    ///
15288    /// Sets the *summary account id* path property to the given value.
15289    ///
15290    /// Even though the property as already been set when instantiating this call,
15291    /// we provide this method for API completeness.
15292    pub fn summary_account_id(mut self, new_value: i64) -> AccountActiveAdSummaryGetCall<'a, C> {
15293        self._summary_account_id = new_value;
15294        self
15295    }
15296    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15297    /// while executing the actual API request.
15298    ///
15299    /// ````text
15300    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15301    /// ````
15302    ///
15303    /// Sets the *delegate* property to the given value.
15304    pub fn delegate(
15305        mut self,
15306        new_value: &'a mut dyn common::Delegate,
15307    ) -> AccountActiveAdSummaryGetCall<'a, C> {
15308        self._delegate = Some(new_value);
15309        self
15310    }
15311
15312    /// Set any additional parameter of the query string used in the request.
15313    /// It should be used to set parameters which are not yet available through their own
15314    /// setters.
15315    ///
15316    /// Please note that this method must not be used to set any of the known parameters
15317    /// which have their own setter method. If done anyway, the request will fail.
15318    ///
15319    /// # Additional Parameters
15320    ///
15321    /// * *$.xgafv* (query-string) - V1 error format.
15322    /// * *access_token* (query-string) - OAuth access token.
15323    /// * *alt* (query-string) - Data format for response.
15324    /// * *callback* (query-string) - JSONP
15325    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15326    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
15327    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15328    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15329    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
15330    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15331    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15332    pub fn param<T>(mut self, name: T, value: T) -> AccountActiveAdSummaryGetCall<'a, C>
15333    where
15334        T: AsRef<str>,
15335    {
15336        self._additional_params
15337            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15338        self
15339    }
15340
15341    /// Identifies the authorization scope for the method you are building.
15342    ///
15343    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15344    /// [`Scope::Dfatrafficking`].
15345    ///
15346    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15347    /// tokens for more than one scope.
15348    ///
15349    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15350    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15351    /// sufficient, a read-write scope will do as well.
15352    pub fn add_scope<St>(mut self, scope: St) -> AccountActiveAdSummaryGetCall<'a, C>
15353    where
15354        St: AsRef<str>,
15355    {
15356        self._scopes.insert(String::from(scope.as_ref()));
15357        self
15358    }
15359    /// Identifies the authorization scope(s) for the method you are building.
15360    ///
15361    /// See [`Self::add_scope()`] for details.
15362    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountActiveAdSummaryGetCall<'a, C>
15363    where
15364        I: IntoIterator<Item = St>,
15365        St: AsRef<str>,
15366    {
15367        self._scopes
15368            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15369        self
15370    }
15371
15372    /// Removes all scopes, and no default scope will be used either.
15373    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15374    /// for details).
15375    pub fn clear_scopes(mut self) -> AccountActiveAdSummaryGetCall<'a, C> {
15376        self._scopes.clear();
15377        self
15378    }
15379}
15380
15381/// Gets one account permission group by ID.
15382///
15383/// A builder for the *get* method supported by a *accountPermissionGroup* resource.
15384/// It is not used directly, but through a [`AccountPermissionGroupMethods`] instance.
15385///
15386/// # Example
15387///
15388/// Instantiate a resource method builder
15389///
15390/// ```test_harness,no_run
15391/// # extern crate hyper;
15392/// # extern crate hyper_rustls;
15393/// # extern crate google_dfareporting3d3 as dfareporting3d3;
15394/// # async fn dox() {
15395/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15396///
15397/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15398/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15399/// #     secret,
15400/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15401/// # ).build().await.unwrap();
15402///
15403/// # let client = hyper_util::client::legacy::Client::builder(
15404/// #     hyper_util::rt::TokioExecutor::new()
15405/// # )
15406/// # .build(
15407/// #     hyper_rustls::HttpsConnectorBuilder::new()
15408/// #         .with_native_roots()
15409/// #         .unwrap()
15410/// #         .https_or_http()
15411/// #         .enable_http1()
15412/// #         .build()
15413/// # );
15414/// # let mut hub = Dfareporting::new(client, auth);
15415/// // You can configure optional parameters by calling the respective setters at will, and
15416/// // execute the final call using `doit()`.
15417/// // Values shown here are possibly random and not representative !
15418/// let result = hub.account_permission_groups().get(-88, -47)
15419///              .doit().await;
15420/// # }
15421/// ```
15422pub struct AccountPermissionGroupGetCall<'a, C>
15423where
15424    C: 'a,
15425{
15426    hub: &'a Dfareporting<C>,
15427    _profile_id: i64,
15428    _id: i64,
15429    _delegate: Option<&'a mut dyn common::Delegate>,
15430    _additional_params: HashMap<String, String>,
15431    _scopes: BTreeSet<String>,
15432}
15433
15434impl<'a, C> common::CallBuilder for AccountPermissionGroupGetCall<'a, C> {}
15435
15436impl<'a, C> AccountPermissionGroupGetCall<'a, C>
15437where
15438    C: common::Connector,
15439{
15440    /// Perform the operation you have build so far.
15441    pub async fn doit(mut self) -> common::Result<(common::Response, AccountPermissionGroup)> {
15442        use std::borrow::Cow;
15443        use std::io::{Read, Seek};
15444
15445        use common::{url::Params, ToParts};
15446        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15447
15448        let mut dd = common::DefaultDelegate;
15449        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15450        dlg.begin(common::MethodInfo {
15451            id: "dfareporting.accountPermissionGroups.get",
15452            http_method: hyper::Method::GET,
15453        });
15454
15455        for &field in ["alt", "profileId", "id"].iter() {
15456            if self._additional_params.contains_key(field) {
15457                dlg.finished(false);
15458                return Err(common::Error::FieldClash(field));
15459            }
15460        }
15461
15462        let mut params = Params::with_capacity(4 + self._additional_params.len());
15463        params.push("profileId", self._profile_id.to_string());
15464        params.push("id", self._id.to_string());
15465
15466        params.extend(self._additional_params.iter());
15467
15468        params.push("alt", "json");
15469        let mut url =
15470            self.hub._base_url.clone() + "userprofiles/{profileId}/accountPermissionGroups/{id}";
15471        if self._scopes.is_empty() {
15472            self._scopes
15473                .insert(Scope::Dfatrafficking.as_ref().to_string());
15474        }
15475
15476        #[allow(clippy::single_element_loop)]
15477        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
15478            url = params.uri_replacement(url, param_name, find_this, false);
15479        }
15480        {
15481            let to_remove = ["id", "profileId"];
15482            params.remove_params(&to_remove);
15483        }
15484
15485        let url = params.parse_with_url(&url);
15486
15487        loop {
15488            let token = match self
15489                .hub
15490                .auth
15491                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15492                .await
15493            {
15494                Ok(token) => token,
15495                Err(e) => match dlg.token(e) {
15496                    Ok(token) => token,
15497                    Err(e) => {
15498                        dlg.finished(false);
15499                        return Err(common::Error::MissingToken(e));
15500                    }
15501                },
15502            };
15503            let mut req_result = {
15504                let client = &self.hub.client;
15505                dlg.pre_request();
15506                let mut req_builder = hyper::Request::builder()
15507                    .method(hyper::Method::GET)
15508                    .uri(url.as_str())
15509                    .header(USER_AGENT, self.hub._user_agent.clone());
15510
15511                if let Some(token) = token.as_ref() {
15512                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15513                }
15514
15515                let request = req_builder
15516                    .header(CONTENT_LENGTH, 0_u64)
15517                    .body(common::to_body::<String>(None));
15518
15519                client.request(request.unwrap()).await
15520            };
15521
15522            match req_result {
15523                Err(err) => {
15524                    if let common::Retry::After(d) = dlg.http_error(&err) {
15525                        sleep(d).await;
15526                        continue;
15527                    }
15528                    dlg.finished(false);
15529                    return Err(common::Error::HttpError(err));
15530                }
15531                Ok(res) => {
15532                    let (mut parts, body) = res.into_parts();
15533                    let mut body = common::Body::new(body);
15534                    if !parts.status.is_success() {
15535                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15536                        let error = serde_json::from_str(&common::to_string(&bytes));
15537                        let response = common::to_response(parts, bytes.into());
15538
15539                        if let common::Retry::After(d) =
15540                            dlg.http_failure(&response, error.as_ref().ok())
15541                        {
15542                            sleep(d).await;
15543                            continue;
15544                        }
15545
15546                        dlg.finished(false);
15547
15548                        return Err(match error {
15549                            Ok(value) => common::Error::BadRequest(value),
15550                            _ => common::Error::Failure(response),
15551                        });
15552                    }
15553                    let response = {
15554                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15555                        let encoded = common::to_string(&bytes);
15556                        match serde_json::from_str(&encoded) {
15557                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15558                            Err(error) => {
15559                                dlg.response_json_decode_error(&encoded, &error);
15560                                return Err(common::Error::JsonDecodeError(
15561                                    encoded.to_string(),
15562                                    error,
15563                                ));
15564                            }
15565                        }
15566                    };
15567
15568                    dlg.finished(true);
15569                    return Ok(response);
15570                }
15571            }
15572        }
15573    }
15574
15575    /// User profile ID associated with this request.
15576    ///
15577    /// Sets the *profile id* path property to the given value.
15578    ///
15579    /// Even though the property as already been set when instantiating this call,
15580    /// we provide this method for API completeness.
15581    pub fn profile_id(mut self, new_value: i64) -> AccountPermissionGroupGetCall<'a, C> {
15582        self._profile_id = new_value;
15583        self
15584    }
15585    /// Account permission group ID.
15586    ///
15587    /// Sets the *id* path property to the given value.
15588    ///
15589    /// Even though the property as already been set when instantiating this call,
15590    /// we provide this method for API completeness.
15591    pub fn id(mut self, new_value: i64) -> AccountPermissionGroupGetCall<'a, C> {
15592        self._id = new_value;
15593        self
15594    }
15595    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15596    /// while executing the actual API request.
15597    ///
15598    /// ````text
15599    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15600    /// ````
15601    ///
15602    /// Sets the *delegate* property to the given value.
15603    pub fn delegate(
15604        mut self,
15605        new_value: &'a mut dyn common::Delegate,
15606    ) -> AccountPermissionGroupGetCall<'a, C> {
15607        self._delegate = Some(new_value);
15608        self
15609    }
15610
15611    /// Set any additional parameter of the query string used in the request.
15612    /// It should be used to set parameters which are not yet available through their own
15613    /// setters.
15614    ///
15615    /// Please note that this method must not be used to set any of the known parameters
15616    /// which have their own setter method. If done anyway, the request will fail.
15617    ///
15618    /// # Additional Parameters
15619    ///
15620    /// * *$.xgafv* (query-string) - V1 error format.
15621    /// * *access_token* (query-string) - OAuth access token.
15622    /// * *alt* (query-string) - Data format for response.
15623    /// * *callback* (query-string) - JSONP
15624    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15625    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
15626    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15627    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15628    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
15629    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15630    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15631    pub fn param<T>(mut self, name: T, value: T) -> AccountPermissionGroupGetCall<'a, C>
15632    where
15633        T: AsRef<str>,
15634    {
15635        self._additional_params
15636            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15637        self
15638    }
15639
15640    /// Identifies the authorization scope for the method you are building.
15641    ///
15642    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15643    /// [`Scope::Dfatrafficking`].
15644    ///
15645    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15646    /// tokens for more than one scope.
15647    ///
15648    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15649    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15650    /// sufficient, a read-write scope will do as well.
15651    pub fn add_scope<St>(mut self, scope: St) -> AccountPermissionGroupGetCall<'a, C>
15652    where
15653        St: AsRef<str>,
15654    {
15655        self._scopes.insert(String::from(scope.as_ref()));
15656        self
15657    }
15658    /// Identifies the authorization scope(s) for the method you are building.
15659    ///
15660    /// See [`Self::add_scope()`] for details.
15661    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountPermissionGroupGetCall<'a, C>
15662    where
15663        I: IntoIterator<Item = St>,
15664        St: AsRef<str>,
15665    {
15666        self._scopes
15667            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15668        self
15669    }
15670
15671    /// Removes all scopes, and no default scope will be used either.
15672    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15673    /// for details).
15674    pub fn clear_scopes(mut self) -> AccountPermissionGroupGetCall<'a, C> {
15675        self._scopes.clear();
15676        self
15677    }
15678}
15679
15680/// Retrieves the list of account permission groups.
15681///
15682/// A builder for the *list* method supported by a *accountPermissionGroup* resource.
15683/// It is not used directly, but through a [`AccountPermissionGroupMethods`] instance.
15684///
15685/// # Example
15686///
15687/// Instantiate a resource method builder
15688///
15689/// ```test_harness,no_run
15690/// # extern crate hyper;
15691/// # extern crate hyper_rustls;
15692/// # extern crate google_dfareporting3d3 as dfareporting3d3;
15693/// # async fn dox() {
15694/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15695///
15696/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15697/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15698/// #     secret,
15699/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15700/// # ).build().await.unwrap();
15701///
15702/// # let client = hyper_util::client::legacy::Client::builder(
15703/// #     hyper_util::rt::TokioExecutor::new()
15704/// # )
15705/// # .build(
15706/// #     hyper_rustls::HttpsConnectorBuilder::new()
15707/// #         .with_native_roots()
15708/// #         .unwrap()
15709/// #         .https_or_http()
15710/// #         .enable_http1()
15711/// #         .build()
15712/// # );
15713/// # let mut hub = Dfareporting::new(client, auth);
15714/// // You can configure optional parameters by calling the respective setters at will, and
15715/// // execute the final call using `doit()`.
15716/// // Values shown here are possibly random and not representative !
15717/// let result = hub.account_permission_groups().list(-20)
15718///              .doit().await;
15719/// # }
15720/// ```
15721pub struct AccountPermissionGroupListCall<'a, C>
15722where
15723    C: 'a,
15724{
15725    hub: &'a Dfareporting<C>,
15726    _profile_id: i64,
15727    _delegate: Option<&'a mut dyn common::Delegate>,
15728    _additional_params: HashMap<String, String>,
15729    _scopes: BTreeSet<String>,
15730}
15731
15732impl<'a, C> common::CallBuilder for AccountPermissionGroupListCall<'a, C> {}
15733
15734impl<'a, C> AccountPermissionGroupListCall<'a, C>
15735where
15736    C: common::Connector,
15737{
15738    /// Perform the operation you have build so far.
15739    pub async fn doit(
15740        mut self,
15741    ) -> common::Result<(common::Response, AccountPermissionGroupsListResponse)> {
15742        use std::borrow::Cow;
15743        use std::io::{Read, Seek};
15744
15745        use common::{url::Params, ToParts};
15746        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15747
15748        let mut dd = common::DefaultDelegate;
15749        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15750        dlg.begin(common::MethodInfo {
15751            id: "dfareporting.accountPermissionGroups.list",
15752            http_method: hyper::Method::GET,
15753        });
15754
15755        for &field in ["alt", "profileId"].iter() {
15756            if self._additional_params.contains_key(field) {
15757                dlg.finished(false);
15758                return Err(common::Error::FieldClash(field));
15759            }
15760        }
15761
15762        let mut params = Params::with_capacity(3 + self._additional_params.len());
15763        params.push("profileId", self._profile_id.to_string());
15764
15765        params.extend(self._additional_params.iter());
15766
15767        params.push("alt", "json");
15768        let mut url =
15769            self.hub._base_url.clone() + "userprofiles/{profileId}/accountPermissionGroups";
15770        if self._scopes.is_empty() {
15771            self._scopes
15772                .insert(Scope::Dfatrafficking.as_ref().to_string());
15773        }
15774
15775        #[allow(clippy::single_element_loop)]
15776        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
15777            url = params.uri_replacement(url, param_name, find_this, false);
15778        }
15779        {
15780            let to_remove = ["profileId"];
15781            params.remove_params(&to_remove);
15782        }
15783
15784        let url = params.parse_with_url(&url);
15785
15786        loop {
15787            let token = match self
15788                .hub
15789                .auth
15790                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15791                .await
15792            {
15793                Ok(token) => token,
15794                Err(e) => match dlg.token(e) {
15795                    Ok(token) => token,
15796                    Err(e) => {
15797                        dlg.finished(false);
15798                        return Err(common::Error::MissingToken(e));
15799                    }
15800                },
15801            };
15802            let mut req_result = {
15803                let client = &self.hub.client;
15804                dlg.pre_request();
15805                let mut req_builder = hyper::Request::builder()
15806                    .method(hyper::Method::GET)
15807                    .uri(url.as_str())
15808                    .header(USER_AGENT, self.hub._user_agent.clone());
15809
15810                if let Some(token) = token.as_ref() {
15811                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15812                }
15813
15814                let request = req_builder
15815                    .header(CONTENT_LENGTH, 0_u64)
15816                    .body(common::to_body::<String>(None));
15817
15818                client.request(request.unwrap()).await
15819            };
15820
15821            match req_result {
15822                Err(err) => {
15823                    if let common::Retry::After(d) = dlg.http_error(&err) {
15824                        sleep(d).await;
15825                        continue;
15826                    }
15827                    dlg.finished(false);
15828                    return Err(common::Error::HttpError(err));
15829                }
15830                Ok(res) => {
15831                    let (mut parts, body) = res.into_parts();
15832                    let mut body = common::Body::new(body);
15833                    if !parts.status.is_success() {
15834                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15835                        let error = serde_json::from_str(&common::to_string(&bytes));
15836                        let response = common::to_response(parts, bytes.into());
15837
15838                        if let common::Retry::After(d) =
15839                            dlg.http_failure(&response, error.as_ref().ok())
15840                        {
15841                            sleep(d).await;
15842                            continue;
15843                        }
15844
15845                        dlg.finished(false);
15846
15847                        return Err(match error {
15848                            Ok(value) => common::Error::BadRequest(value),
15849                            _ => common::Error::Failure(response),
15850                        });
15851                    }
15852                    let response = {
15853                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15854                        let encoded = common::to_string(&bytes);
15855                        match serde_json::from_str(&encoded) {
15856                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15857                            Err(error) => {
15858                                dlg.response_json_decode_error(&encoded, &error);
15859                                return Err(common::Error::JsonDecodeError(
15860                                    encoded.to_string(),
15861                                    error,
15862                                ));
15863                            }
15864                        }
15865                    };
15866
15867                    dlg.finished(true);
15868                    return Ok(response);
15869                }
15870            }
15871        }
15872    }
15873
15874    /// User profile ID associated with this request.
15875    ///
15876    /// Sets the *profile id* path property to the given value.
15877    ///
15878    /// Even though the property as already been set when instantiating this call,
15879    /// we provide this method for API completeness.
15880    pub fn profile_id(mut self, new_value: i64) -> AccountPermissionGroupListCall<'a, C> {
15881        self._profile_id = new_value;
15882        self
15883    }
15884    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15885    /// while executing the actual API request.
15886    ///
15887    /// ````text
15888    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15889    /// ````
15890    ///
15891    /// Sets the *delegate* property to the given value.
15892    pub fn delegate(
15893        mut self,
15894        new_value: &'a mut dyn common::Delegate,
15895    ) -> AccountPermissionGroupListCall<'a, C> {
15896        self._delegate = Some(new_value);
15897        self
15898    }
15899
15900    /// Set any additional parameter of the query string used in the request.
15901    /// It should be used to set parameters which are not yet available through their own
15902    /// setters.
15903    ///
15904    /// Please note that this method must not be used to set any of the known parameters
15905    /// which have their own setter method. If done anyway, the request will fail.
15906    ///
15907    /// # Additional Parameters
15908    ///
15909    /// * *$.xgafv* (query-string) - V1 error format.
15910    /// * *access_token* (query-string) - OAuth access token.
15911    /// * *alt* (query-string) - Data format for response.
15912    /// * *callback* (query-string) - JSONP
15913    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15914    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
15915    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15916    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15917    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
15918    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15919    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15920    pub fn param<T>(mut self, name: T, value: T) -> AccountPermissionGroupListCall<'a, C>
15921    where
15922        T: AsRef<str>,
15923    {
15924        self._additional_params
15925            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15926        self
15927    }
15928
15929    /// Identifies the authorization scope for the method you are building.
15930    ///
15931    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15932    /// [`Scope::Dfatrafficking`].
15933    ///
15934    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15935    /// tokens for more than one scope.
15936    ///
15937    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15938    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15939    /// sufficient, a read-write scope will do as well.
15940    pub fn add_scope<St>(mut self, scope: St) -> AccountPermissionGroupListCall<'a, C>
15941    where
15942        St: AsRef<str>,
15943    {
15944        self._scopes.insert(String::from(scope.as_ref()));
15945        self
15946    }
15947    /// Identifies the authorization scope(s) for the method you are building.
15948    ///
15949    /// See [`Self::add_scope()`] for details.
15950    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountPermissionGroupListCall<'a, C>
15951    where
15952        I: IntoIterator<Item = St>,
15953        St: AsRef<str>,
15954    {
15955        self._scopes
15956            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15957        self
15958    }
15959
15960    /// Removes all scopes, and no default scope will be used either.
15961    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15962    /// for details).
15963    pub fn clear_scopes(mut self) -> AccountPermissionGroupListCall<'a, C> {
15964        self._scopes.clear();
15965        self
15966    }
15967}
15968
15969/// Gets one account permission by ID.
15970///
15971/// A builder for the *get* method supported by a *accountPermission* resource.
15972/// It is not used directly, but through a [`AccountPermissionMethods`] instance.
15973///
15974/// # Example
15975///
15976/// Instantiate a resource method builder
15977///
15978/// ```test_harness,no_run
15979/// # extern crate hyper;
15980/// # extern crate hyper_rustls;
15981/// # extern crate google_dfareporting3d3 as dfareporting3d3;
15982/// # async fn dox() {
15983/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15984///
15985/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15986/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15987/// #     secret,
15988/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15989/// # ).build().await.unwrap();
15990///
15991/// # let client = hyper_util::client::legacy::Client::builder(
15992/// #     hyper_util::rt::TokioExecutor::new()
15993/// # )
15994/// # .build(
15995/// #     hyper_rustls::HttpsConnectorBuilder::new()
15996/// #         .with_native_roots()
15997/// #         .unwrap()
15998/// #         .https_or_http()
15999/// #         .enable_http1()
16000/// #         .build()
16001/// # );
16002/// # let mut hub = Dfareporting::new(client, auth);
16003/// // You can configure optional parameters by calling the respective setters at will, and
16004/// // execute the final call using `doit()`.
16005/// // Values shown here are possibly random and not representative !
16006/// let result = hub.account_permissions().get(-50, -93)
16007///              .doit().await;
16008/// # }
16009/// ```
16010pub struct AccountPermissionGetCall<'a, C>
16011where
16012    C: 'a,
16013{
16014    hub: &'a Dfareporting<C>,
16015    _profile_id: i64,
16016    _id: i64,
16017    _delegate: Option<&'a mut dyn common::Delegate>,
16018    _additional_params: HashMap<String, String>,
16019    _scopes: BTreeSet<String>,
16020}
16021
16022impl<'a, C> common::CallBuilder for AccountPermissionGetCall<'a, C> {}
16023
16024impl<'a, C> AccountPermissionGetCall<'a, C>
16025where
16026    C: common::Connector,
16027{
16028    /// Perform the operation you have build so far.
16029    pub async fn doit(mut self) -> common::Result<(common::Response, AccountPermission)> {
16030        use std::borrow::Cow;
16031        use std::io::{Read, Seek};
16032
16033        use common::{url::Params, ToParts};
16034        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16035
16036        let mut dd = common::DefaultDelegate;
16037        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16038        dlg.begin(common::MethodInfo {
16039            id: "dfareporting.accountPermissions.get",
16040            http_method: hyper::Method::GET,
16041        });
16042
16043        for &field in ["alt", "profileId", "id"].iter() {
16044            if self._additional_params.contains_key(field) {
16045                dlg.finished(false);
16046                return Err(common::Error::FieldClash(field));
16047            }
16048        }
16049
16050        let mut params = Params::with_capacity(4 + self._additional_params.len());
16051        params.push("profileId", self._profile_id.to_string());
16052        params.push("id", self._id.to_string());
16053
16054        params.extend(self._additional_params.iter());
16055
16056        params.push("alt", "json");
16057        let mut url =
16058            self.hub._base_url.clone() + "userprofiles/{profileId}/accountPermissions/{id}";
16059        if self._scopes.is_empty() {
16060            self._scopes
16061                .insert(Scope::Dfatrafficking.as_ref().to_string());
16062        }
16063
16064        #[allow(clippy::single_element_loop)]
16065        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
16066            url = params.uri_replacement(url, param_name, find_this, false);
16067        }
16068        {
16069            let to_remove = ["id", "profileId"];
16070            params.remove_params(&to_remove);
16071        }
16072
16073        let url = params.parse_with_url(&url);
16074
16075        loop {
16076            let token = match self
16077                .hub
16078                .auth
16079                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16080                .await
16081            {
16082                Ok(token) => token,
16083                Err(e) => match dlg.token(e) {
16084                    Ok(token) => token,
16085                    Err(e) => {
16086                        dlg.finished(false);
16087                        return Err(common::Error::MissingToken(e));
16088                    }
16089                },
16090            };
16091            let mut req_result = {
16092                let client = &self.hub.client;
16093                dlg.pre_request();
16094                let mut req_builder = hyper::Request::builder()
16095                    .method(hyper::Method::GET)
16096                    .uri(url.as_str())
16097                    .header(USER_AGENT, self.hub._user_agent.clone());
16098
16099                if let Some(token) = token.as_ref() {
16100                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16101                }
16102
16103                let request = req_builder
16104                    .header(CONTENT_LENGTH, 0_u64)
16105                    .body(common::to_body::<String>(None));
16106
16107                client.request(request.unwrap()).await
16108            };
16109
16110            match req_result {
16111                Err(err) => {
16112                    if let common::Retry::After(d) = dlg.http_error(&err) {
16113                        sleep(d).await;
16114                        continue;
16115                    }
16116                    dlg.finished(false);
16117                    return Err(common::Error::HttpError(err));
16118                }
16119                Ok(res) => {
16120                    let (mut parts, body) = res.into_parts();
16121                    let mut body = common::Body::new(body);
16122                    if !parts.status.is_success() {
16123                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16124                        let error = serde_json::from_str(&common::to_string(&bytes));
16125                        let response = common::to_response(parts, bytes.into());
16126
16127                        if let common::Retry::After(d) =
16128                            dlg.http_failure(&response, error.as_ref().ok())
16129                        {
16130                            sleep(d).await;
16131                            continue;
16132                        }
16133
16134                        dlg.finished(false);
16135
16136                        return Err(match error {
16137                            Ok(value) => common::Error::BadRequest(value),
16138                            _ => common::Error::Failure(response),
16139                        });
16140                    }
16141                    let response = {
16142                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16143                        let encoded = common::to_string(&bytes);
16144                        match serde_json::from_str(&encoded) {
16145                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16146                            Err(error) => {
16147                                dlg.response_json_decode_error(&encoded, &error);
16148                                return Err(common::Error::JsonDecodeError(
16149                                    encoded.to_string(),
16150                                    error,
16151                                ));
16152                            }
16153                        }
16154                    };
16155
16156                    dlg.finished(true);
16157                    return Ok(response);
16158                }
16159            }
16160        }
16161    }
16162
16163    /// User profile ID associated with this request.
16164    ///
16165    /// Sets the *profile id* path property to the given value.
16166    ///
16167    /// Even though the property as already been set when instantiating this call,
16168    /// we provide this method for API completeness.
16169    pub fn profile_id(mut self, new_value: i64) -> AccountPermissionGetCall<'a, C> {
16170        self._profile_id = new_value;
16171        self
16172    }
16173    /// Account permission ID.
16174    ///
16175    /// Sets the *id* path property to the given value.
16176    ///
16177    /// Even though the property as already been set when instantiating this call,
16178    /// we provide this method for API completeness.
16179    pub fn id(mut self, new_value: i64) -> AccountPermissionGetCall<'a, C> {
16180        self._id = new_value;
16181        self
16182    }
16183    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16184    /// while executing the actual API request.
16185    ///
16186    /// ````text
16187    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16188    /// ````
16189    ///
16190    /// Sets the *delegate* property to the given value.
16191    pub fn delegate(
16192        mut self,
16193        new_value: &'a mut dyn common::Delegate,
16194    ) -> AccountPermissionGetCall<'a, C> {
16195        self._delegate = Some(new_value);
16196        self
16197    }
16198
16199    /// Set any additional parameter of the query string used in the request.
16200    /// It should be used to set parameters which are not yet available through their own
16201    /// setters.
16202    ///
16203    /// Please note that this method must not be used to set any of the known parameters
16204    /// which have their own setter method. If done anyway, the request will fail.
16205    ///
16206    /// # Additional Parameters
16207    ///
16208    /// * *$.xgafv* (query-string) - V1 error format.
16209    /// * *access_token* (query-string) - OAuth access token.
16210    /// * *alt* (query-string) - Data format for response.
16211    /// * *callback* (query-string) - JSONP
16212    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16213    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
16214    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16215    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16216    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
16217    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16218    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16219    pub fn param<T>(mut self, name: T, value: T) -> AccountPermissionGetCall<'a, C>
16220    where
16221        T: AsRef<str>,
16222    {
16223        self._additional_params
16224            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16225        self
16226    }
16227
16228    /// Identifies the authorization scope for the method you are building.
16229    ///
16230    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16231    /// [`Scope::Dfatrafficking`].
16232    ///
16233    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16234    /// tokens for more than one scope.
16235    ///
16236    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16237    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16238    /// sufficient, a read-write scope will do as well.
16239    pub fn add_scope<St>(mut self, scope: St) -> AccountPermissionGetCall<'a, C>
16240    where
16241        St: AsRef<str>,
16242    {
16243        self._scopes.insert(String::from(scope.as_ref()));
16244        self
16245    }
16246    /// Identifies the authorization scope(s) for the method you are building.
16247    ///
16248    /// See [`Self::add_scope()`] for details.
16249    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountPermissionGetCall<'a, C>
16250    where
16251        I: IntoIterator<Item = St>,
16252        St: AsRef<str>,
16253    {
16254        self._scopes
16255            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16256        self
16257    }
16258
16259    /// Removes all scopes, and no default scope will be used either.
16260    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16261    /// for details).
16262    pub fn clear_scopes(mut self) -> AccountPermissionGetCall<'a, C> {
16263        self._scopes.clear();
16264        self
16265    }
16266}
16267
16268/// Retrieves the list of account permissions.
16269///
16270/// A builder for the *list* method supported by a *accountPermission* resource.
16271/// It is not used directly, but through a [`AccountPermissionMethods`] instance.
16272///
16273/// # Example
16274///
16275/// Instantiate a resource method builder
16276///
16277/// ```test_harness,no_run
16278/// # extern crate hyper;
16279/// # extern crate hyper_rustls;
16280/// # extern crate google_dfareporting3d3 as dfareporting3d3;
16281/// # async fn dox() {
16282/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16283///
16284/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16285/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16286/// #     secret,
16287/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16288/// # ).build().await.unwrap();
16289///
16290/// # let client = hyper_util::client::legacy::Client::builder(
16291/// #     hyper_util::rt::TokioExecutor::new()
16292/// # )
16293/// # .build(
16294/// #     hyper_rustls::HttpsConnectorBuilder::new()
16295/// #         .with_native_roots()
16296/// #         .unwrap()
16297/// #         .https_or_http()
16298/// #         .enable_http1()
16299/// #         .build()
16300/// # );
16301/// # let mut hub = Dfareporting::new(client, auth);
16302/// // You can configure optional parameters by calling the respective setters at will, and
16303/// // execute the final call using `doit()`.
16304/// // Values shown here are possibly random and not representative !
16305/// let result = hub.account_permissions().list(-37)
16306///              .doit().await;
16307/// # }
16308/// ```
16309pub struct AccountPermissionListCall<'a, C>
16310where
16311    C: 'a,
16312{
16313    hub: &'a Dfareporting<C>,
16314    _profile_id: i64,
16315    _delegate: Option<&'a mut dyn common::Delegate>,
16316    _additional_params: HashMap<String, String>,
16317    _scopes: BTreeSet<String>,
16318}
16319
16320impl<'a, C> common::CallBuilder for AccountPermissionListCall<'a, C> {}
16321
16322impl<'a, C> AccountPermissionListCall<'a, C>
16323where
16324    C: common::Connector,
16325{
16326    /// Perform the operation you have build so far.
16327    pub async fn doit(
16328        mut self,
16329    ) -> common::Result<(common::Response, AccountPermissionsListResponse)> {
16330        use std::borrow::Cow;
16331        use std::io::{Read, Seek};
16332
16333        use common::{url::Params, ToParts};
16334        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16335
16336        let mut dd = common::DefaultDelegate;
16337        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16338        dlg.begin(common::MethodInfo {
16339            id: "dfareporting.accountPermissions.list",
16340            http_method: hyper::Method::GET,
16341        });
16342
16343        for &field in ["alt", "profileId"].iter() {
16344            if self._additional_params.contains_key(field) {
16345                dlg.finished(false);
16346                return Err(common::Error::FieldClash(field));
16347            }
16348        }
16349
16350        let mut params = Params::with_capacity(3 + self._additional_params.len());
16351        params.push("profileId", self._profile_id.to_string());
16352
16353        params.extend(self._additional_params.iter());
16354
16355        params.push("alt", "json");
16356        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/accountPermissions";
16357        if self._scopes.is_empty() {
16358            self._scopes
16359                .insert(Scope::Dfatrafficking.as_ref().to_string());
16360        }
16361
16362        #[allow(clippy::single_element_loop)]
16363        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
16364            url = params.uri_replacement(url, param_name, find_this, false);
16365        }
16366        {
16367            let to_remove = ["profileId"];
16368            params.remove_params(&to_remove);
16369        }
16370
16371        let url = params.parse_with_url(&url);
16372
16373        loop {
16374            let token = match self
16375                .hub
16376                .auth
16377                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16378                .await
16379            {
16380                Ok(token) => token,
16381                Err(e) => match dlg.token(e) {
16382                    Ok(token) => token,
16383                    Err(e) => {
16384                        dlg.finished(false);
16385                        return Err(common::Error::MissingToken(e));
16386                    }
16387                },
16388            };
16389            let mut req_result = {
16390                let client = &self.hub.client;
16391                dlg.pre_request();
16392                let mut req_builder = hyper::Request::builder()
16393                    .method(hyper::Method::GET)
16394                    .uri(url.as_str())
16395                    .header(USER_AGENT, self.hub._user_agent.clone());
16396
16397                if let Some(token) = token.as_ref() {
16398                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16399                }
16400
16401                let request = req_builder
16402                    .header(CONTENT_LENGTH, 0_u64)
16403                    .body(common::to_body::<String>(None));
16404
16405                client.request(request.unwrap()).await
16406            };
16407
16408            match req_result {
16409                Err(err) => {
16410                    if let common::Retry::After(d) = dlg.http_error(&err) {
16411                        sleep(d).await;
16412                        continue;
16413                    }
16414                    dlg.finished(false);
16415                    return Err(common::Error::HttpError(err));
16416                }
16417                Ok(res) => {
16418                    let (mut parts, body) = res.into_parts();
16419                    let mut body = common::Body::new(body);
16420                    if !parts.status.is_success() {
16421                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16422                        let error = serde_json::from_str(&common::to_string(&bytes));
16423                        let response = common::to_response(parts, bytes.into());
16424
16425                        if let common::Retry::After(d) =
16426                            dlg.http_failure(&response, error.as_ref().ok())
16427                        {
16428                            sleep(d).await;
16429                            continue;
16430                        }
16431
16432                        dlg.finished(false);
16433
16434                        return Err(match error {
16435                            Ok(value) => common::Error::BadRequest(value),
16436                            _ => common::Error::Failure(response),
16437                        });
16438                    }
16439                    let response = {
16440                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16441                        let encoded = common::to_string(&bytes);
16442                        match serde_json::from_str(&encoded) {
16443                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16444                            Err(error) => {
16445                                dlg.response_json_decode_error(&encoded, &error);
16446                                return Err(common::Error::JsonDecodeError(
16447                                    encoded.to_string(),
16448                                    error,
16449                                ));
16450                            }
16451                        }
16452                    };
16453
16454                    dlg.finished(true);
16455                    return Ok(response);
16456                }
16457            }
16458        }
16459    }
16460
16461    /// User profile ID associated with this request.
16462    ///
16463    /// Sets the *profile id* path property to the given value.
16464    ///
16465    /// Even though the property as already been set when instantiating this call,
16466    /// we provide this method for API completeness.
16467    pub fn profile_id(mut self, new_value: i64) -> AccountPermissionListCall<'a, C> {
16468        self._profile_id = new_value;
16469        self
16470    }
16471    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16472    /// while executing the actual API request.
16473    ///
16474    /// ````text
16475    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16476    /// ````
16477    ///
16478    /// Sets the *delegate* property to the given value.
16479    pub fn delegate(
16480        mut self,
16481        new_value: &'a mut dyn common::Delegate,
16482    ) -> AccountPermissionListCall<'a, C> {
16483        self._delegate = Some(new_value);
16484        self
16485    }
16486
16487    /// Set any additional parameter of the query string used in the request.
16488    /// It should be used to set parameters which are not yet available through their own
16489    /// setters.
16490    ///
16491    /// Please note that this method must not be used to set any of the known parameters
16492    /// which have their own setter method. If done anyway, the request will fail.
16493    ///
16494    /// # Additional Parameters
16495    ///
16496    /// * *$.xgafv* (query-string) - V1 error format.
16497    /// * *access_token* (query-string) - OAuth access token.
16498    /// * *alt* (query-string) - Data format for response.
16499    /// * *callback* (query-string) - JSONP
16500    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16501    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
16502    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16503    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16504    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
16505    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16506    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16507    pub fn param<T>(mut self, name: T, value: T) -> AccountPermissionListCall<'a, C>
16508    where
16509        T: AsRef<str>,
16510    {
16511        self._additional_params
16512            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16513        self
16514    }
16515
16516    /// Identifies the authorization scope for the method you are building.
16517    ///
16518    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16519    /// [`Scope::Dfatrafficking`].
16520    ///
16521    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16522    /// tokens for more than one scope.
16523    ///
16524    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16525    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16526    /// sufficient, a read-write scope will do as well.
16527    pub fn add_scope<St>(mut self, scope: St) -> AccountPermissionListCall<'a, C>
16528    where
16529        St: AsRef<str>,
16530    {
16531        self._scopes.insert(String::from(scope.as_ref()));
16532        self
16533    }
16534    /// Identifies the authorization scope(s) for the method you are building.
16535    ///
16536    /// See [`Self::add_scope()`] for details.
16537    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountPermissionListCall<'a, C>
16538    where
16539        I: IntoIterator<Item = St>,
16540        St: AsRef<str>,
16541    {
16542        self._scopes
16543            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16544        self
16545    }
16546
16547    /// Removes all scopes, and no default scope will be used either.
16548    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16549    /// for details).
16550    pub fn clear_scopes(mut self) -> AccountPermissionListCall<'a, C> {
16551        self._scopes.clear();
16552        self
16553    }
16554}
16555
16556/// Gets one account user profile by ID.
16557///
16558/// A builder for the *get* method supported by a *accountUserProfile* resource.
16559/// It is not used directly, but through a [`AccountUserProfileMethods`] instance.
16560///
16561/// # Example
16562///
16563/// Instantiate a resource method builder
16564///
16565/// ```test_harness,no_run
16566/// # extern crate hyper;
16567/// # extern crate hyper_rustls;
16568/// # extern crate google_dfareporting3d3 as dfareporting3d3;
16569/// # async fn dox() {
16570/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16571///
16572/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16573/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16574/// #     secret,
16575/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16576/// # ).build().await.unwrap();
16577///
16578/// # let client = hyper_util::client::legacy::Client::builder(
16579/// #     hyper_util::rt::TokioExecutor::new()
16580/// # )
16581/// # .build(
16582/// #     hyper_rustls::HttpsConnectorBuilder::new()
16583/// #         .with_native_roots()
16584/// #         .unwrap()
16585/// #         .https_or_http()
16586/// #         .enable_http1()
16587/// #         .build()
16588/// # );
16589/// # let mut hub = Dfareporting::new(client, auth);
16590/// // You can configure optional parameters by calling the respective setters at will, and
16591/// // execute the final call using `doit()`.
16592/// // Values shown here are possibly random and not representative !
16593/// let result = hub.account_user_profiles().get(-12, -16)
16594///              .doit().await;
16595/// # }
16596/// ```
16597pub struct AccountUserProfileGetCall<'a, C>
16598where
16599    C: 'a,
16600{
16601    hub: &'a Dfareporting<C>,
16602    _profile_id: i64,
16603    _id: i64,
16604    _delegate: Option<&'a mut dyn common::Delegate>,
16605    _additional_params: HashMap<String, String>,
16606    _scopes: BTreeSet<String>,
16607}
16608
16609impl<'a, C> common::CallBuilder for AccountUserProfileGetCall<'a, C> {}
16610
16611impl<'a, C> AccountUserProfileGetCall<'a, C>
16612where
16613    C: common::Connector,
16614{
16615    /// Perform the operation you have build so far.
16616    pub async fn doit(mut self) -> common::Result<(common::Response, AccountUserProfile)> {
16617        use std::borrow::Cow;
16618        use std::io::{Read, Seek};
16619
16620        use common::{url::Params, ToParts};
16621        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16622
16623        let mut dd = common::DefaultDelegate;
16624        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16625        dlg.begin(common::MethodInfo {
16626            id: "dfareporting.accountUserProfiles.get",
16627            http_method: hyper::Method::GET,
16628        });
16629
16630        for &field in ["alt", "profileId", "id"].iter() {
16631            if self._additional_params.contains_key(field) {
16632                dlg.finished(false);
16633                return Err(common::Error::FieldClash(field));
16634            }
16635        }
16636
16637        let mut params = Params::with_capacity(4 + self._additional_params.len());
16638        params.push("profileId", self._profile_id.to_string());
16639        params.push("id", self._id.to_string());
16640
16641        params.extend(self._additional_params.iter());
16642
16643        params.push("alt", "json");
16644        let mut url =
16645            self.hub._base_url.clone() + "userprofiles/{profileId}/accountUserProfiles/{id}";
16646        if self._scopes.is_empty() {
16647            self._scopes
16648                .insert(Scope::Dfatrafficking.as_ref().to_string());
16649        }
16650
16651        #[allow(clippy::single_element_loop)]
16652        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
16653            url = params.uri_replacement(url, param_name, find_this, false);
16654        }
16655        {
16656            let to_remove = ["id", "profileId"];
16657            params.remove_params(&to_remove);
16658        }
16659
16660        let url = params.parse_with_url(&url);
16661
16662        loop {
16663            let token = match self
16664                .hub
16665                .auth
16666                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16667                .await
16668            {
16669                Ok(token) => token,
16670                Err(e) => match dlg.token(e) {
16671                    Ok(token) => token,
16672                    Err(e) => {
16673                        dlg.finished(false);
16674                        return Err(common::Error::MissingToken(e));
16675                    }
16676                },
16677            };
16678            let mut req_result = {
16679                let client = &self.hub.client;
16680                dlg.pre_request();
16681                let mut req_builder = hyper::Request::builder()
16682                    .method(hyper::Method::GET)
16683                    .uri(url.as_str())
16684                    .header(USER_AGENT, self.hub._user_agent.clone());
16685
16686                if let Some(token) = token.as_ref() {
16687                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16688                }
16689
16690                let request = req_builder
16691                    .header(CONTENT_LENGTH, 0_u64)
16692                    .body(common::to_body::<String>(None));
16693
16694                client.request(request.unwrap()).await
16695            };
16696
16697            match req_result {
16698                Err(err) => {
16699                    if let common::Retry::After(d) = dlg.http_error(&err) {
16700                        sleep(d).await;
16701                        continue;
16702                    }
16703                    dlg.finished(false);
16704                    return Err(common::Error::HttpError(err));
16705                }
16706                Ok(res) => {
16707                    let (mut parts, body) = res.into_parts();
16708                    let mut body = common::Body::new(body);
16709                    if !parts.status.is_success() {
16710                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16711                        let error = serde_json::from_str(&common::to_string(&bytes));
16712                        let response = common::to_response(parts, bytes.into());
16713
16714                        if let common::Retry::After(d) =
16715                            dlg.http_failure(&response, error.as_ref().ok())
16716                        {
16717                            sleep(d).await;
16718                            continue;
16719                        }
16720
16721                        dlg.finished(false);
16722
16723                        return Err(match error {
16724                            Ok(value) => common::Error::BadRequest(value),
16725                            _ => common::Error::Failure(response),
16726                        });
16727                    }
16728                    let response = {
16729                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16730                        let encoded = common::to_string(&bytes);
16731                        match serde_json::from_str(&encoded) {
16732                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16733                            Err(error) => {
16734                                dlg.response_json_decode_error(&encoded, &error);
16735                                return Err(common::Error::JsonDecodeError(
16736                                    encoded.to_string(),
16737                                    error,
16738                                ));
16739                            }
16740                        }
16741                    };
16742
16743                    dlg.finished(true);
16744                    return Ok(response);
16745                }
16746            }
16747        }
16748    }
16749
16750    /// User profile ID associated with this request.
16751    ///
16752    /// Sets the *profile id* path property to the given value.
16753    ///
16754    /// Even though the property as already been set when instantiating this call,
16755    /// we provide this method for API completeness.
16756    pub fn profile_id(mut self, new_value: i64) -> AccountUserProfileGetCall<'a, C> {
16757        self._profile_id = new_value;
16758        self
16759    }
16760    /// User profile ID.
16761    ///
16762    /// Sets the *id* path property to the given value.
16763    ///
16764    /// Even though the property as already been set when instantiating this call,
16765    /// we provide this method for API completeness.
16766    pub fn id(mut self, new_value: i64) -> AccountUserProfileGetCall<'a, C> {
16767        self._id = new_value;
16768        self
16769    }
16770    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16771    /// while executing the actual API request.
16772    ///
16773    /// ````text
16774    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16775    /// ````
16776    ///
16777    /// Sets the *delegate* property to the given value.
16778    pub fn delegate(
16779        mut self,
16780        new_value: &'a mut dyn common::Delegate,
16781    ) -> AccountUserProfileGetCall<'a, C> {
16782        self._delegate = Some(new_value);
16783        self
16784    }
16785
16786    /// Set any additional parameter of the query string used in the request.
16787    /// It should be used to set parameters which are not yet available through their own
16788    /// setters.
16789    ///
16790    /// Please note that this method must not be used to set any of the known parameters
16791    /// which have their own setter method. If done anyway, the request will fail.
16792    ///
16793    /// # Additional Parameters
16794    ///
16795    /// * *$.xgafv* (query-string) - V1 error format.
16796    /// * *access_token* (query-string) - OAuth access token.
16797    /// * *alt* (query-string) - Data format for response.
16798    /// * *callback* (query-string) - JSONP
16799    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16800    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
16801    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16802    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16803    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
16804    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16805    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16806    pub fn param<T>(mut self, name: T, value: T) -> AccountUserProfileGetCall<'a, C>
16807    where
16808        T: AsRef<str>,
16809    {
16810        self._additional_params
16811            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16812        self
16813    }
16814
16815    /// Identifies the authorization scope for the method you are building.
16816    ///
16817    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16818    /// [`Scope::Dfatrafficking`].
16819    ///
16820    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16821    /// tokens for more than one scope.
16822    ///
16823    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16824    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16825    /// sufficient, a read-write scope will do as well.
16826    pub fn add_scope<St>(mut self, scope: St) -> AccountUserProfileGetCall<'a, C>
16827    where
16828        St: AsRef<str>,
16829    {
16830        self._scopes.insert(String::from(scope.as_ref()));
16831        self
16832    }
16833    /// Identifies the authorization scope(s) for the method you are building.
16834    ///
16835    /// See [`Self::add_scope()`] for details.
16836    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountUserProfileGetCall<'a, C>
16837    where
16838        I: IntoIterator<Item = St>,
16839        St: AsRef<str>,
16840    {
16841        self._scopes
16842            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16843        self
16844    }
16845
16846    /// Removes all scopes, and no default scope will be used either.
16847    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16848    /// for details).
16849    pub fn clear_scopes(mut self) -> AccountUserProfileGetCall<'a, C> {
16850        self._scopes.clear();
16851        self
16852    }
16853}
16854
16855/// Inserts a new account user profile.
16856///
16857/// A builder for the *insert* method supported by a *accountUserProfile* resource.
16858/// It is not used directly, but through a [`AccountUserProfileMethods`] instance.
16859///
16860/// # Example
16861///
16862/// Instantiate a resource method builder
16863///
16864/// ```test_harness,no_run
16865/// # extern crate hyper;
16866/// # extern crate hyper_rustls;
16867/// # extern crate google_dfareporting3d3 as dfareporting3d3;
16868/// use dfareporting3d3::api::AccountUserProfile;
16869/// # async fn dox() {
16870/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16871///
16872/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16873/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16874/// #     secret,
16875/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16876/// # ).build().await.unwrap();
16877///
16878/// # let client = hyper_util::client::legacy::Client::builder(
16879/// #     hyper_util::rt::TokioExecutor::new()
16880/// # )
16881/// # .build(
16882/// #     hyper_rustls::HttpsConnectorBuilder::new()
16883/// #         .with_native_roots()
16884/// #         .unwrap()
16885/// #         .https_or_http()
16886/// #         .enable_http1()
16887/// #         .build()
16888/// # );
16889/// # let mut hub = Dfareporting::new(client, auth);
16890/// // As the method needs a request, you would usually fill it with the desired information
16891/// // into the respective structure. Some of the parts shown here might not be applicable !
16892/// // Values shown here are possibly random and not representative !
16893/// let mut req = AccountUserProfile::default();
16894///
16895/// // You can configure optional parameters by calling the respective setters at will, and
16896/// // execute the final call using `doit()`.
16897/// // Values shown here are possibly random and not representative !
16898/// let result = hub.account_user_profiles().insert(req, -57)
16899///              .doit().await;
16900/// # }
16901/// ```
16902pub struct AccountUserProfileInsertCall<'a, C>
16903where
16904    C: 'a,
16905{
16906    hub: &'a Dfareporting<C>,
16907    _request: AccountUserProfile,
16908    _profile_id: i64,
16909    _delegate: Option<&'a mut dyn common::Delegate>,
16910    _additional_params: HashMap<String, String>,
16911    _scopes: BTreeSet<String>,
16912}
16913
16914impl<'a, C> common::CallBuilder for AccountUserProfileInsertCall<'a, C> {}
16915
16916impl<'a, C> AccountUserProfileInsertCall<'a, C>
16917where
16918    C: common::Connector,
16919{
16920    /// Perform the operation you have build so far.
16921    pub async fn doit(mut self) -> common::Result<(common::Response, AccountUserProfile)> {
16922        use std::borrow::Cow;
16923        use std::io::{Read, Seek};
16924
16925        use common::{url::Params, ToParts};
16926        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16927
16928        let mut dd = common::DefaultDelegate;
16929        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16930        dlg.begin(common::MethodInfo {
16931            id: "dfareporting.accountUserProfiles.insert",
16932            http_method: hyper::Method::POST,
16933        });
16934
16935        for &field in ["alt", "profileId"].iter() {
16936            if self._additional_params.contains_key(field) {
16937                dlg.finished(false);
16938                return Err(common::Error::FieldClash(field));
16939            }
16940        }
16941
16942        let mut params = Params::with_capacity(4 + self._additional_params.len());
16943        params.push("profileId", self._profile_id.to_string());
16944
16945        params.extend(self._additional_params.iter());
16946
16947        params.push("alt", "json");
16948        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/accountUserProfiles";
16949        if self._scopes.is_empty() {
16950            self._scopes
16951                .insert(Scope::Dfatrafficking.as_ref().to_string());
16952        }
16953
16954        #[allow(clippy::single_element_loop)]
16955        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
16956            url = params.uri_replacement(url, param_name, find_this, false);
16957        }
16958        {
16959            let to_remove = ["profileId"];
16960            params.remove_params(&to_remove);
16961        }
16962
16963        let url = params.parse_with_url(&url);
16964
16965        let mut json_mime_type = mime::APPLICATION_JSON;
16966        let mut request_value_reader = {
16967            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16968            common::remove_json_null_values(&mut value);
16969            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16970            serde_json::to_writer(&mut dst, &value).unwrap();
16971            dst
16972        };
16973        let request_size = request_value_reader
16974            .seek(std::io::SeekFrom::End(0))
16975            .unwrap();
16976        request_value_reader
16977            .seek(std::io::SeekFrom::Start(0))
16978            .unwrap();
16979
16980        loop {
16981            let token = match self
16982                .hub
16983                .auth
16984                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16985                .await
16986            {
16987                Ok(token) => token,
16988                Err(e) => match dlg.token(e) {
16989                    Ok(token) => token,
16990                    Err(e) => {
16991                        dlg.finished(false);
16992                        return Err(common::Error::MissingToken(e));
16993                    }
16994                },
16995            };
16996            request_value_reader
16997                .seek(std::io::SeekFrom::Start(0))
16998                .unwrap();
16999            let mut req_result = {
17000                let client = &self.hub.client;
17001                dlg.pre_request();
17002                let mut req_builder = hyper::Request::builder()
17003                    .method(hyper::Method::POST)
17004                    .uri(url.as_str())
17005                    .header(USER_AGENT, self.hub._user_agent.clone());
17006
17007                if let Some(token) = token.as_ref() {
17008                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17009                }
17010
17011                let request = req_builder
17012                    .header(CONTENT_TYPE, json_mime_type.to_string())
17013                    .header(CONTENT_LENGTH, request_size as u64)
17014                    .body(common::to_body(
17015                        request_value_reader.get_ref().clone().into(),
17016                    ));
17017
17018                client.request(request.unwrap()).await
17019            };
17020
17021            match req_result {
17022                Err(err) => {
17023                    if let common::Retry::After(d) = dlg.http_error(&err) {
17024                        sleep(d).await;
17025                        continue;
17026                    }
17027                    dlg.finished(false);
17028                    return Err(common::Error::HttpError(err));
17029                }
17030                Ok(res) => {
17031                    let (mut parts, body) = res.into_parts();
17032                    let mut body = common::Body::new(body);
17033                    if !parts.status.is_success() {
17034                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17035                        let error = serde_json::from_str(&common::to_string(&bytes));
17036                        let response = common::to_response(parts, bytes.into());
17037
17038                        if let common::Retry::After(d) =
17039                            dlg.http_failure(&response, error.as_ref().ok())
17040                        {
17041                            sleep(d).await;
17042                            continue;
17043                        }
17044
17045                        dlg.finished(false);
17046
17047                        return Err(match error {
17048                            Ok(value) => common::Error::BadRequest(value),
17049                            _ => common::Error::Failure(response),
17050                        });
17051                    }
17052                    let response = {
17053                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17054                        let encoded = common::to_string(&bytes);
17055                        match serde_json::from_str(&encoded) {
17056                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17057                            Err(error) => {
17058                                dlg.response_json_decode_error(&encoded, &error);
17059                                return Err(common::Error::JsonDecodeError(
17060                                    encoded.to_string(),
17061                                    error,
17062                                ));
17063                            }
17064                        }
17065                    };
17066
17067                    dlg.finished(true);
17068                    return Ok(response);
17069                }
17070            }
17071        }
17072    }
17073
17074    ///
17075    /// Sets the *request* property to the given value.
17076    ///
17077    /// Even though the property as already been set when instantiating this call,
17078    /// we provide this method for API completeness.
17079    pub fn request(mut self, new_value: AccountUserProfile) -> AccountUserProfileInsertCall<'a, C> {
17080        self._request = new_value;
17081        self
17082    }
17083    /// User profile ID associated with this request.
17084    ///
17085    /// Sets the *profile id* path property to the given value.
17086    ///
17087    /// Even though the property as already been set when instantiating this call,
17088    /// we provide this method for API completeness.
17089    pub fn profile_id(mut self, new_value: i64) -> AccountUserProfileInsertCall<'a, C> {
17090        self._profile_id = new_value;
17091        self
17092    }
17093    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17094    /// while executing the actual API request.
17095    ///
17096    /// ````text
17097    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17098    /// ````
17099    ///
17100    /// Sets the *delegate* property to the given value.
17101    pub fn delegate(
17102        mut self,
17103        new_value: &'a mut dyn common::Delegate,
17104    ) -> AccountUserProfileInsertCall<'a, C> {
17105        self._delegate = Some(new_value);
17106        self
17107    }
17108
17109    /// Set any additional parameter of the query string used in the request.
17110    /// It should be used to set parameters which are not yet available through their own
17111    /// setters.
17112    ///
17113    /// Please note that this method must not be used to set any of the known parameters
17114    /// which have their own setter method. If done anyway, the request will fail.
17115    ///
17116    /// # Additional Parameters
17117    ///
17118    /// * *$.xgafv* (query-string) - V1 error format.
17119    /// * *access_token* (query-string) - OAuth access token.
17120    /// * *alt* (query-string) - Data format for response.
17121    /// * *callback* (query-string) - JSONP
17122    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17123    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
17124    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17125    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17126    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
17127    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17128    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17129    pub fn param<T>(mut self, name: T, value: T) -> AccountUserProfileInsertCall<'a, C>
17130    where
17131        T: AsRef<str>,
17132    {
17133        self._additional_params
17134            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17135        self
17136    }
17137
17138    /// Identifies the authorization scope for the method you are building.
17139    ///
17140    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17141    /// [`Scope::Dfatrafficking`].
17142    ///
17143    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17144    /// tokens for more than one scope.
17145    ///
17146    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17147    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17148    /// sufficient, a read-write scope will do as well.
17149    pub fn add_scope<St>(mut self, scope: St) -> AccountUserProfileInsertCall<'a, C>
17150    where
17151        St: AsRef<str>,
17152    {
17153        self._scopes.insert(String::from(scope.as_ref()));
17154        self
17155    }
17156    /// Identifies the authorization scope(s) for the method you are building.
17157    ///
17158    /// See [`Self::add_scope()`] for details.
17159    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountUserProfileInsertCall<'a, C>
17160    where
17161        I: IntoIterator<Item = St>,
17162        St: AsRef<str>,
17163    {
17164        self._scopes
17165            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17166        self
17167    }
17168
17169    /// Removes all scopes, and no default scope will be used either.
17170    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17171    /// for details).
17172    pub fn clear_scopes(mut self) -> AccountUserProfileInsertCall<'a, C> {
17173        self._scopes.clear();
17174        self
17175    }
17176}
17177
17178/// Retrieves a list of account user profiles, possibly filtered. This method supports paging.
17179///
17180/// A builder for the *list* method supported by a *accountUserProfile* resource.
17181/// It is not used directly, but through a [`AccountUserProfileMethods`] instance.
17182///
17183/// # Example
17184///
17185/// Instantiate a resource method builder
17186///
17187/// ```test_harness,no_run
17188/// # extern crate hyper;
17189/// # extern crate hyper_rustls;
17190/// # extern crate google_dfareporting3d3 as dfareporting3d3;
17191/// # async fn dox() {
17192/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17193///
17194/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17195/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17196/// #     secret,
17197/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17198/// # ).build().await.unwrap();
17199///
17200/// # let client = hyper_util::client::legacy::Client::builder(
17201/// #     hyper_util::rt::TokioExecutor::new()
17202/// # )
17203/// # .build(
17204/// #     hyper_rustls::HttpsConnectorBuilder::new()
17205/// #         .with_native_roots()
17206/// #         .unwrap()
17207/// #         .https_or_http()
17208/// #         .enable_http1()
17209/// #         .build()
17210/// # );
17211/// # let mut hub = Dfareporting::new(client, auth);
17212/// // You can configure optional parameters by calling the respective setters at will, and
17213/// // execute the final call using `doit()`.
17214/// // Values shown here are possibly random and not representative !
17215/// let result = hub.account_user_profiles().list(-50)
17216///              .user_role_id(-50)
17217///              .subaccount_id(-7)
17218///              .sort_order("gubergren")
17219///              .sort_field("ea")
17220///              .search_string("dolor")
17221///              .page_token("Lorem")
17222///              .max_results(-25)
17223///              .add_ids(-86)
17224///              .active(true)
17225///              .doit().await;
17226/// # }
17227/// ```
17228pub struct AccountUserProfileListCall<'a, C>
17229where
17230    C: 'a,
17231{
17232    hub: &'a Dfareporting<C>,
17233    _profile_id: i64,
17234    _user_role_id: Option<i64>,
17235    _subaccount_id: Option<i64>,
17236    _sort_order: Option<String>,
17237    _sort_field: Option<String>,
17238    _search_string: Option<String>,
17239    _page_token: Option<String>,
17240    _max_results: Option<i32>,
17241    _ids: Vec<i64>,
17242    _active: Option<bool>,
17243    _delegate: Option<&'a mut dyn common::Delegate>,
17244    _additional_params: HashMap<String, String>,
17245    _scopes: BTreeSet<String>,
17246}
17247
17248impl<'a, C> common::CallBuilder for AccountUserProfileListCall<'a, C> {}
17249
17250impl<'a, C> AccountUserProfileListCall<'a, C>
17251where
17252    C: common::Connector,
17253{
17254    /// Perform the operation you have build so far.
17255    pub async fn doit(
17256        mut self,
17257    ) -> common::Result<(common::Response, AccountUserProfilesListResponse)> {
17258        use std::borrow::Cow;
17259        use std::io::{Read, Seek};
17260
17261        use common::{url::Params, ToParts};
17262        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17263
17264        let mut dd = common::DefaultDelegate;
17265        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17266        dlg.begin(common::MethodInfo {
17267            id: "dfareporting.accountUserProfiles.list",
17268            http_method: hyper::Method::GET,
17269        });
17270
17271        for &field in [
17272            "alt",
17273            "profileId",
17274            "userRoleId",
17275            "subaccountId",
17276            "sortOrder",
17277            "sortField",
17278            "searchString",
17279            "pageToken",
17280            "maxResults",
17281            "ids",
17282            "active",
17283        ]
17284        .iter()
17285        {
17286            if self._additional_params.contains_key(field) {
17287                dlg.finished(false);
17288                return Err(common::Error::FieldClash(field));
17289            }
17290        }
17291
17292        let mut params = Params::with_capacity(12 + self._additional_params.len());
17293        params.push("profileId", self._profile_id.to_string());
17294        if let Some(value) = self._user_role_id.as_ref() {
17295            params.push("userRoleId", value.to_string());
17296        }
17297        if let Some(value) = self._subaccount_id.as_ref() {
17298            params.push("subaccountId", value.to_string());
17299        }
17300        if let Some(value) = self._sort_order.as_ref() {
17301            params.push("sortOrder", value);
17302        }
17303        if let Some(value) = self._sort_field.as_ref() {
17304            params.push("sortField", value);
17305        }
17306        if let Some(value) = self._search_string.as_ref() {
17307            params.push("searchString", value);
17308        }
17309        if let Some(value) = self._page_token.as_ref() {
17310            params.push("pageToken", value);
17311        }
17312        if let Some(value) = self._max_results.as_ref() {
17313            params.push("maxResults", value.to_string());
17314        }
17315        if !self._ids.is_empty() {
17316            for f in self._ids.iter() {
17317                params.push("ids", f.to_string());
17318            }
17319        }
17320        if let Some(value) = self._active.as_ref() {
17321            params.push("active", value.to_string());
17322        }
17323
17324        params.extend(self._additional_params.iter());
17325
17326        params.push("alt", "json");
17327        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/accountUserProfiles";
17328        if self._scopes.is_empty() {
17329            self._scopes
17330                .insert(Scope::Dfatrafficking.as_ref().to_string());
17331        }
17332
17333        #[allow(clippy::single_element_loop)]
17334        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
17335            url = params.uri_replacement(url, param_name, find_this, false);
17336        }
17337        {
17338            let to_remove = ["profileId"];
17339            params.remove_params(&to_remove);
17340        }
17341
17342        let url = params.parse_with_url(&url);
17343
17344        loop {
17345            let token = match self
17346                .hub
17347                .auth
17348                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17349                .await
17350            {
17351                Ok(token) => token,
17352                Err(e) => match dlg.token(e) {
17353                    Ok(token) => token,
17354                    Err(e) => {
17355                        dlg.finished(false);
17356                        return Err(common::Error::MissingToken(e));
17357                    }
17358                },
17359            };
17360            let mut req_result = {
17361                let client = &self.hub.client;
17362                dlg.pre_request();
17363                let mut req_builder = hyper::Request::builder()
17364                    .method(hyper::Method::GET)
17365                    .uri(url.as_str())
17366                    .header(USER_AGENT, self.hub._user_agent.clone());
17367
17368                if let Some(token) = token.as_ref() {
17369                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17370                }
17371
17372                let request = req_builder
17373                    .header(CONTENT_LENGTH, 0_u64)
17374                    .body(common::to_body::<String>(None));
17375
17376                client.request(request.unwrap()).await
17377            };
17378
17379            match req_result {
17380                Err(err) => {
17381                    if let common::Retry::After(d) = dlg.http_error(&err) {
17382                        sleep(d).await;
17383                        continue;
17384                    }
17385                    dlg.finished(false);
17386                    return Err(common::Error::HttpError(err));
17387                }
17388                Ok(res) => {
17389                    let (mut parts, body) = res.into_parts();
17390                    let mut body = common::Body::new(body);
17391                    if !parts.status.is_success() {
17392                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17393                        let error = serde_json::from_str(&common::to_string(&bytes));
17394                        let response = common::to_response(parts, bytes.into());
17395
17396                        if let common::Retry::After(d) =
17397                            dlg.http_failure(&response, error.as_ref().ok())
17398                        {
17399                            sleep(d).await;
17400                            continue;
17401                        }
17402
17403                        dlg.finished(false);
17404
17405                        return Err(match error {
17406                            Ok(value) => common::Error::BadRequest(value),
17407                            _ => common::Error::Failure(response),
17408                        });
17409                    }
17410                    let response = {
17411                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17412                        let encoded = common::to_string(&bytes);
17413                        match serde_json::from_str(&encoded) {
17414                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17415                            Err(error) => {
17416                                dlg.response_json_decode_error(&encoded, &error);
17417                                return Err(common::Error::JsonDecodeError(
17418                                    encoded.to_string(),
17419                                    error,
17420                                ));
17421                            }
17422                        }
17423                    };
17424
17425                    dlg.finished(true);
17426                    return Ok(response);
17427                }
17428            }
17429        }
17430    }
17431
17432    /// User profile ID associated with this request.
17433    ///
17434    /// Sets the *profile id* path property to the given value.
17435    ///
17436    /// Even though the property as already been set when instantiating this call,
17437    /// we provide this method for API completeness.
17438    pub fn profile_id(mut self, new_value: i64) -> AccountUserProfileListCall<'a, C> {
17439        self._profile_id = new_value;
17440        self
17441    }
17442    /// Select only user profiles with the specified user role ID.
17443    ///
17444    /// Sets the *user role id* query property to the given value.
17445    pub fn user_role_id(mut self, new_value: i64) -> AccountUserProfileListCall<'a, C> {
17446        self._user_role_id = Some(new_value);
17447        self
17448    }
17449    /// Select only user profiles with the specified subaccount ID.
17450    ///
17451    /// Sets the *subaccount id* query property to the given value.
17452    pub fn subaccount_id(mut self, new_value: i64) -> AccountUserProfileListCall<'a, C> {
17453        self._subaccount_id = Some(new_value);
17454        self
17455    }
17456    /// Order of sorted results.
17457    ///
17458    /// Sets the *sort order* query property to the given value.
17459    pub fn sort_order(mut self, new_value: &str) -> AccountUserProfileListCall<'a, C> {
17460        self._sort_order = Some(new_value.to_string());
17461        self
17462    }
17463    /// Field by which to sort the list.
17464    ///
17465    /// Sets the *sort field* query property to the given value.
17466    pub fn sort_field(mut self, new_value: &str) -> AccountUserProfileListCall<'a, C> {
17467        self._sort_field = Some(new_value.to_string());
17468        self
17469    }
17470    /// Allows searching for objects by name, ID or email. Wildcards (*) are allowed. For example, "user profile*2015" will return objects with names like "user profile June 2015", "user profile April 2015", or simply "user profile 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "user profile" will match objects with name "my user profile", "user profile 2015", or simply "user profile".
17471    ///
17472    /// Sets the *search string* query property to the given value.
17473    pub fn search_string(mut self, new_value: &str) -> AccountUserProfileListCall<'a, C> {
17474        self._search_string = Some(new_value.to_string());
17475        self
17476    }
17477    /// Value of the nextPageToken from the previous result page.
17478    ///
17479    /// Sets the *page token* query property to the given value.
17480    pub fn page_token(mut self, new_value: &str) -> AccountUserProfileListCall<'a, C> {
17481        self._page_token = Some(new_value.to_string());
17482        self
17483    }
17484    /// Maximum number of results to return.
17485    ///
17486    /// Sets the *max results* query property to the given value.
17487    pub fn max_results(mut self, new_value: i32) -> AccountUserProfileListCall<'a, C> {
17488        self._max_results = Some(new_value);
17489        self
17490    }
17491    /// Select only user profiles with these IDs.
17492    ///
17493    /// Append the given value to the *ids* query property.
17494    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
17495    pub fn add_ids(mut self, new_value: i64) -> AccountUserProfileListCall<'a, C> {
17496        self._ids.push(new_value);
17497        self
17498    }
17499    /// Select only active user profiles.
17500    ///
17501    /// Sets the *active* query property to the given value.
17502    pub fn active(mut self, new_value: bool) -> AccountUserProfileListCall<'a, C> {
17503        self._active = Some(new_value);
17504        self
17505    }
17506    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17507    /// while executing the actual API request.
17508    ///
17509    /// ````text
17510    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17511    /// ````
17512    ///
17513    /// Sets the *delegate* property to the given value.
17514    pub fn delegate(
17515        mut self,
17516        new_value: &'a mut dyn common::Delegate,
17517    ) -> AccountUserProfileListCall<'a, C> {
17518        self._delegate = Some(new_value);
17519        self
17520    }
17521
17522    /// Set any additional parameter of the query string used in the request.
17523    /// It should be used to set parameters which are not yet available through their own
17524    /// setters.
17525    ///
17526    /// Please note that this method must not be used to set any of the known parameters
17527    /// which have their own setter method. If done anyway, the request will fail.
17528    ///
17529    /// # Additional Parameters
17530    ///
17531    /// * *$.xgafv* (query-string) - V1 error format.
17532    /// * *access_token* (query-string) - OAuth access token.
17533    /// * *alt* (query-string) - Data format for response.
17534    /// * *callback* (query-string) - JSONP
17535    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17536    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
17537    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17538    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17539    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
17540    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17541    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17542    pub fn param<T>(mut self, name: T, value: T) -> AccountUserProfileListCall<'a, C>
17543    where
17544        T: AsRef<str>,
17545    {
17546        self._additional_params
17547            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17548        self
17549    }
17550
17551    /// Identifies the authorization scope for the method you are building.
17552    ///
17553    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17554    /// [`Scope::Dfatrafficking`].
17555    ///
17556    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17557    /// tokens for more than one scope.
17558    ///
17559    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17560    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17561    /// sufficient, a read-write scope will do as well.
17562    pub fn add_scope<St>(mut self, scope: St) -> AccountUserProfileListCall<'a, C>
17563    where
17564        St: AsRef<str>,
17565    {
17566        self._scopes.insert(String::from(scope.as_ref()));
17567        self
17568    }
17569    /// Identifies the authorization scope(s) for the method you are building.
17570    ///
17571    /// See [`Self::add_scope()`] for details.
17572    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountUserProfileListCall<'a, C>
17573    where
17574        I: IntoIterator<Item = St>,
17575        St: AsRef<str>,
17576    {
17577        self._scopes
17578            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17579        self
17580    }
17581
17582    /// Removes all scopes, and no default scope will be used either.
17583    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17584    /// for details).
17585    pub fn clear_scopes(mut self) -> AccountUserProfileListCall<'a, C> {
17586        self._scopes.clear();
17587        self
17588    }
17589}
17590
17591/// Updates an existing account user profile. This method supports patch semantics.
17592///
17593/// A builder for the *patch* method supported by a *accountUserProfile* resource.
17594/// It is not used directly, but through a [`AccountUserProfileMethods`] instance.
17595///
17596/// # Example
17597///
17598/// Instantiate a resource method builder
17599///
17600/// ```test_harness,no_run
17601/// # extern crate hyper;
17602/// # extern crate hyper_rustls;
17603/// # extern crate google_dfareporting3d3 as dfareporting3d3;
17604/// use dfareporting3d3::api::AccountUserProfile;
17605/// # async fn dox() {
17606/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17607///
17608/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17609/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17610/// #     secret,
17611/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17612/// # ).build().await.unwrap();
17613///
17614/// # let client = hyper_util::client::legacy::Client::builder(
17615/// #     hyper_util::rt::TokioExecutor::new()
17616/// # )
17617/// # .build(
17618/// #     hyper_rustls::HttpsConnectorBuilder::new()
17619/// #         .with_native_roots()
17620/// #         .unwrap()
17621/// #         .https_or_http()
17622/// #         .enable_http1()
17623/// #         .build()
17624/// # );
17625/// # let mut hub = Dfareporting::new(client, auth);
17626/// // As the method needs a request, you would usually fill it with the desired information
17627/// // into the respective structure. Some of the parts shown here might not be applicable !
17628/// // Values shown here are possibly random and not representative !
17629/// let mut req = AccountUserProfile::default();
17630///
17631/// // You can configure optional parameters by calling the respective setters at will, and
17632/// // execute the final call using `doit()`.
17633/// // Values shown here are possibly random and not representative !
17634/// let result = hub.account_user_profiles().patch(req, -70, -80)
17635///              .doit().await;
17636/// # }
17637/// ```
17638pub struct AccountUserProfilePatchCall<'a, C>
17639where
17640    C: 'a,
17641{
17642    hub: &'a Dfareporting<C>,
17643    _request: AccountUserProfile,
17644    _profile_id: i64,
17645    _id: i64,
17646    _delegate: Option<&'a mut dyn common::Delegate>,
17647    _additional_params: HashMap<String, String>,
17648    _scopes: BTreeSet<String>,
17649}
17650
17651impl<'a, C> common::CallBuilder for AccountUserProfilePatchCall<'a, C> {}
17652
17653impl<'a, C> AccountUserProfilePatchCall<'a, C>
17654where
17655    C: common::Connector,
17656{
17657    /// Perform the operation you have build so far.
17658    pub async fn doit(mut self) -> common::Result<(common::Response, AccountUserProfile)> {
17659        use std::borrow::Cow;
17660        use std::io::{Read, Seek};
17661
17662        use common::{url::Params, ToParts};
17663        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17664
17665        let mut dd = common::DefaultDelegate;
17666        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17667        dlg.begin(common::MethodInfo {
17668            id: "dfareporting.accountUserProfiles.patch",
17669            http_method: hyper::Method::PATCH,
17670        });
17671
17672        for &field in ["alt", "profileId", "id"].iter() {
17673            if self._additional_params.contains_key(field) {
17674                dlg.finished(false);
17675                return Err(common::Error::FieldClash(field));
17676            }
17677        }
17678
17679        let mut params = Params::with_capacity(5 + self._additional_params.len());
17680        params.push("profileId", self._profile_id.to_string());
17681        params.push("id", self._id.to_string());
17682
17683        params.extend(self._additional_params.iter());
17684
17685        params.push("alt", "json");
17686        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/accountUserProfiles";
17687        if self._scopes.is_empty() {
17688            self._scopes
17689                .insert(Scope::Dfatrafficking.as_ref().to_string());
17690        }
17691
17692        #[allow(clippy::single_element_loop)]
17693        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
17694            url = params.uri_replacement(url, param_name, find_this, false);
17695        }
17696        {
17697            let to_remove = ["profileId"];
17698            params.remove_params(&to_remove);
17699        }
17700
17701        let url = params.parse_with_url(&url);
17702
17703        let mut json_mime_type = mime::APPLICATION_JSON;
17704        let mut request_value_reader = {
17705            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17706            common::remove_json_null_values(&mut value);
17707            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17708            serde_json::to_writer(&mut dst, &value).unwrap();
17709            dst
17710        };
17711        let request_size = request_value_reader
17712            .seek(std::io::SeekFrom::End(0))
17713            .unwrap();
17714        request_value_reader
17715            .seek(std::io::SeekFrom::Start(0))
17716            .unwrap();
17717
17718        loop {
17719            let token = match self
17720                .hub
17721                .auth
17722                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17723                .await
17724            {
17725                Ok(token) => token,
17726                Err(e) => match dlg.token(e) {
17727                    Ok(token) => token,
17728                    Err(e) => {
17729                        dlg.finished(false);
17730                        return Err(common::Error::MissingToken(e));
17731                    }
17732                },
17733            };
17734            request_value_reader
17735                .seek(std::io::SeekFrom::Start(0))
17736                .unwrap();
17737            let mut req_result = {
17738                let client = &self.hub.client;
17739                dlg.pre_request();
17740                let mut req_builder = hyper::Request::builder()
17741                    .method(hyper::Method::PATCH)
17742                    .uri(url.as_str())
17743                    .header(USER_AGENT, self.hub._user_agent.clone());
17744
17745                if let Some(token) = token.as_ref() {
17746                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17747                }
17748
17749                let request = req_builder
17750                    .header(CONTENT_TYPE, json_mime_type.to_string())
17751                    .header(CONTENT_LENGTH, request_size as u64)
17752                    .body(common::to_body(
17753                        request_value_reader.get_ref().clone().into(),
17754                    ));
17755
17756                client.request(request.unwrap()).await
17757            };
17758
17759            match req_result {
17760                Err(err) => {
17761                    if let common::Retry::After(d) = dlg.http_error(&err) {
17762                        sleep(d).await;
17763                        continue;
17764                    }
17765                    dlg.finished(false);
17766                    return Err(common::Error::HttpError(err));
17767                }
17768                Ok(res) => {
17769                    let (mut parts, body) = res.into_parts();
17770                    let mut body = common::Body::new(body);
17771                    if !parts.status.is_success() {
17772                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17773                        let error = serde_json::from_str(&common::to_string(&bytes));
17774                        let response = common::to_response(parts, bytes.into());
17775
17776                        if let common::Retry::After(d) =
17777                            dlg.http_failure(&response, error.as_ref().ok())
17778                        {
17779                            sleep(d).await;
17780                            continue;
17781                        }
17782
17783                        dlg.finished(false);
17784
17785                        return Err(match error {
17786                            Ok(value) => common::Error::BadRequest(value),
17787                            _ => common::Error::Failure(response),
17788                        });
17789                    }
17790                    let response = {
17791                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17792                        let encoded = common::to_string(&bytes);
17793                        match serde_json::from_str(&encoded) {
17794                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17795                            Err(error) => {
17796                                dlg.response_json_decode_error(&encoded, &error);
17797                                return Err(common::Error::JsonDecodeError(
17798                                    encoded.to_string(),
17799                                    error,
17800                                ));
17801                            }
17802                        }
17803                    };
17804
17805                    dlg.finished(true);
17806                    return Ok(response);
17807                }
17808            }
17809        }
17810    }
17811
17812    ///
17813    /// Sets the *request* property to the given value.
17814    ///
17815    /// Even though the property as already been set when instantiating this call,
17816    /// we provide this method for API completeness.
17817    pub fn request(mut self, new_value: AccountUserProfile) -> AccountUserProfilePatchCall<'a, C> {
17818        self._request = new_value;
17819        self
17820    }
17821    /// User profile ID associated with this request.
17822    ///
17823    /// Sets the *profile id* path property to the given value.
17824    ///
17825    /// Even though the property as already been set when instantiating this call,
17826    /// we provide this method for API completeness.
17827    pub fn profile_id(mut self, new_value: i64) -> AccountUserProfilePatchCall<'a, C> {
17828        self._profile_id = new_value;
17829        self
17830    }
17831    /// AccountUserProfile ID.
17832    ///
17833    /// Sets the *id* query property to the given value.
17834    ///
17835    /// Even though the property as already been set when instantiating this call,
17836    /// we provide this method for API completeness.
17837    pub fn id(mut self, new_value: i64) -> AccountUserProfilePatchCall<'a, C> {
17838        self._id = new_value;
17839        self
17840    }
17841    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17842    /// while executing the actual API request.
17843    ///
17844    /// ````text
17845    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17846    /// ````
17847    ///
17848    /// Sets the *delegate* property to the given value.
17849    pub fn delegate(
17850        mut self,
17851        new_value: &'a mut dyn common::Delegate,
17852    ) -> AccountUserProfilePatchCall<'a, C> {
17853        self._delegate = Some(new_value);
17854        self
17855    }
17856
17857    /// Set any additional parameter of the query string used in the request.
17858    /// It should be used to set parameters which are not yet available through their own
17859    /// setters.
17860    ///
17861    /// Please note that this method must not be used to set any of the known parameters
17862    /// which have their own setter method. If done anyway, the request will fail.
17863    ///
17864    /// # Additional Parameters
17865    ///
17866    /// * *$.xgafv* (query-string) - V1 error format.
17867    /// * *access_token* (query-string) - OAuth access token.
17868    /// * *alt* (query-string) - Data format for response.
17869    /// * *callback* (query-string) - JSONP
17870    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17871    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
17872    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17873    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17874    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
17875    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17876    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17877    pub fn param<T>(mut self, name: T, value: T) -> AccountUserProfilePatchCall<'a, C>
17878    where
17879        T: AsRef<str>,
17880    {
17881        self._additional_params
17882            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17883        self
17884    }
17885
17886    /// Identifies the authorization scope for the method you are building.
17887    ///
17888    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17889    /// [`Scope::Dfatrafficking`].
17890    ///
17891    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17892    /// tokens for more than one scope.
17893    ///
17894    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17895    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17896    /// sufficient, a read-write scope will do as well.
17897    pub fn add_scope<St>(mut self, scope: St) -> AccountUserProfilePatchCall<'a, C>
17898    where
17899        St: AsRef<str>,
17900    {
17901        self._scopes.insert(String::from(scope.as_ref()));
17902        self
17903    }
17904    /// Identifies the authorization scope(s) for the method you are building.
17905    ///
17906    /// See [`Self::add_scope()`] for details.
17907    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountUserProfilePatchCall<'a, C>
17908    where
17909        I: IntoIterator<Item = St>,
17910        St: AsRef<str>,
17911    {
17912        self._scopes
17913            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17914        self
17915    }
17916
17917    /// Removes all scopes, and no default scope will be used either.
17918    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17919    /// for details).
17920    pub fn clear_scopes(mut self) -> AccountUserProfilePatchCall<'a, C> {
17921        self._scopes.clear();
17922        self
17923    }
17924}
17925
17926/// Updates an existing account user profile.
17927///
17928/// A builder for the *update* method supported by a *accountUserProfile* resource.
17929/// It is not used directly, but through a [`AccountUserProfileMethods`] instance.
17930///
17931/// # Example
17932///
17933/// Instantiate a resource method builder
17934///
17935/// ```test_harness,no_run
17936/// # extern crate hyper;
17937/// # extern crate hyper_rustls;
17938/// # extern crate google_dfareporting3d3 as dfareporting3d3;
17939/// use dfareporting3d3::api::AccountUserProfile;
17940/// # async fn dox() {
17941/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17942///
17943/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17944/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17945/// #     secret,
17946/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17947/// # ).build().await.unwrap();
17948///
17949/// # let client = hyper_util::client::legacy::Client::builder(
17950/// #     hyper_util::rt::TokioExecutor::new()
17951/// # )
17952/// # .build(
17953/// #     hyper_rustls::HttpsConnectorBuilder::new()
17954/// #         .with_native_roots()
17955/// #         .unwrap()
17956/// #         .https_or_http()
17957/// #         .enable_http1()
17958/// #         .build()
17959/// # );
17960/// # let mut hub = Dfareporting::new(client, auth);
17961/// // As the method needs a request, you would usually fill it with the desired information
17962/// // into the respective structure. Some of the parts shown here might not be applicable !
17963/// // Values shown here are possibly random and not representative !
17964/// let mut req = AccountUserProfile::default();
17965///
17966/// // You can configure optional parameters by calling the respective setters at will, and
17967/// // execute the final call using `doit()`.
17968/// // Values shown here are possibly random and not representative !
17969/// let result = hub.account_user_profiles().update(req, -61)
17970///              .doit().await;
17971/// # }
17972/// ```
17973pub struct AccountUserProfileUpdateCall<'a, C>
17974where
17975    C: 'a,
17976{
17977    hub: &'a Dfareporting<C>,
17978    _request: AccountUserProfile,
17979    _profile_id: i64,
17980    _delegate: Option<&'a mut dyn common::Delegate>,
17981    _additional_params: HashMap<String, String>,
17982    _scopes: BTreeSet<String>,
17983}
17984
17985impl<'a, C> common::CallBuilder for AccountUserProfileUpdateCall<'a, C> {}
17986
17987impl<'a, C> AccountUserProfileUpdateCall<'a, C>
17988where
17989    C: common::Connector,
17990{
17991    /// Perform the operation you have build so far.
17992    pub async fn doit(mut self) -> common::Result<(common::Response, AccountUserProfile)> {
17993        use std::borrow::Cow;
17994        use std::io::{Read, Seek};
17995
17996        use common::{url::Params, ToParts};
17997        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17998
17999        let mut dd = common::DefaultDelegate;
18000        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18001        dlg.begin(common::MethodInfo {
18002            id: "dfareporting.accountUserProfiles.update",
18003            http_method: hyper::Method::PUT,
18004        });
18005
18006        for &field in ["alt", "profileId"].iter() {
18007            if self._additional_params.contains_key(field) {
18008                dlg.finished(false);
18009                return Err(common::Error::FieldClash(field));
18010            }
18011        }
18012
18013        let mut params = Params::with_capacity(4 + self._additional_params.len());
18014        params.push("profileId", self._profile_id.to_string());
18015
18016        params.extend(self._additional_params.iter());
18017
18018        params.push("alt", "json");
18019        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/accountUserProfiles";
18020        if self._scopes.is_empty() {
18021            self._scopes
18022                .insert(Scope::Dfatrafficking.as_ref().to_string());
18023        }
18024
18025        #[allow(clippy::single_element_loop)]
18026        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
18027            url = params.uri_replacement(url, param_name, find_this, false);
18028        }
18029        {
18030            let to_remove = ["profileId"];
18031            params.remove_params(&to_remove);
18032        }
18033
18034        let url = params.parse_with_url(&url);
18035
18036        let mut json_mime_type = mime::APPLICATION_JSON;
18037        let mut request_value_reader = {
18038            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18039            common::remove_json_null_values(&mut value);
18040            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18041            serde_json::to_writer(&mut dst, &value).unwrap();
18042            dst
18043        };
18044        let request_size = request_value_reader
18045            .seek(std::io::SeekFrom::End(0))
18046            .unwrap();
18047        request_value_reader
18048            .seek(std::io::SeekFrom::Start(0))
18049            .unwrap();
18050
18051        loop {
18052            let token = match self
18053                .hub
18054                .auth
18055                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18056                .await
18057            {
18058                Ok(token) => token,
18059                Err(e) => match dlg.token(e) {
18060                    Ok(token) => token,
18061                    Err(e) => {
18062                        dlg.finished(false);
18063                        return Err(common::Error::MissingToken(e));
18064                    }
18065                },
18066            };
18067            request_value_reader
18068                .seek(std::io::SeekFrom::Start(0))
18069                .unwrap();
18070            let mut req_result = {
18071                let client = &self.hub.client;
18072                dlg.pre_request();
18073                let mut req_builder = hyper::Request::builder()
18074                    .method(hyper::Method::PUT)
18075                    .uri(url.as_str())
18076                    .header(USER_AGENT, self.hub._user_agent.clone());
18077
18078                if let Some(token) = token.as_ref() {
18079                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18080                }
18081
18082                let request = req_builder
18083                    .header(CONTENT_TYPE, json_mime_type.to_string())
18084                    .header(CONTENT_LENGTH, request_size as u64)
18085                    .body(common::to_body(
18086                        request_value_reader.get_ref().clone().into(),
18087                    ));
18088
18089                client.request(request.unwrap()).await
18090            };
18091
18092            match req_result {
18093                Err(err) => {
18094                    if let common::Retry::After(d) = dlg.http_error(&err) {
18095                        sleep(d).await;
18096                        continue;
18097                    }
18098                    dlg.finished(false);
18099                    return Err(common::Error::HttpError(err));
18100                }
18101                Ok(res) => {
18102                    let (mut parts, body) = res.into_parts();
18103                    let mut body = common::Body::new(body);
18104                    if !parts.status.is_success() {
18105                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18106                        let error = serde_json::from_str(&common::to_string(&bytes));
18107                        let response = common::to_response(parts, bytes.into());
18108
18109                        if let common::Retry::After(d) =
18110                            dlg.http_failure(&response, error.as_ref().ok())
18111                        {
18112                            sleep(d).await;
18113                            continue;
18114                        }
18115
18116                        dlg.finished(false);
18117
18118                        return Err(match error {
18119                            Ok(value) => common::Error::BadRequest(value),
18120                            _ => common::Error::Failure(response),
18121                        });
18122                    }
18123                    let response = {
18124                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18125                        let encoded = common::to_string(&bytes);
18126                        match serde_json::from_str(&encoded) {
18127                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18128                            Err(error) => {
18129                                dlg.response_json_decode_error(&encoded, &error);
18130                                return Err(common::Error::JsonDecodeError(
18131                                    encoded.to_string(),
18132                                    error,
18133                                ));
18134                            }
18135                        }
18136                    };
18137
18138                    dlg.finished(true);
18139                    return Ok(response);
18140                }
18141            }
18142        }
18143    }
18144
18145    ///
18146    /// Sets the *request* property to the given value.
18147    ///
18148    /// Even though the property as already been set when instantiating this call,
18149    /// we provide this method for API completeness.
18150    pub fn request(mut self, new_value: AccountUserProfile) -> AccountUserProfileUpdateCall<'a, C> {
18151        self._request = new_value;
18152        self
18153    }
18154    /// User profile ID associated with this request.
18155    ///
18156    /// Sets the *profile id* path property to the given value.
18157    ///
18158    /// Even though the property as already been set when instantiating this call,
18159    /// we provide this method for API completeness.
18160    pub fn profile_id(mut self, new_value: i64) -> AccountUserProfileUpdateCall<'a, C> {
18161        self._profile_id = new_value;
18162        self
18163    }
18164    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18165    /// while executing the actual API request.
18166    ///
18167    /// ````text
18168    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18169    /// ````
18170    ///
18171    /// Sets the *delegate* property to the given value.
18172    pub fn delegate(
18173        mut self,
18174        new_value: &'a mut dyn common::Delegate,
18175    ) -> AccountUserProfileUpdateCall<'a, C> {
18176        self._delegate = Some(new_value);
18177        self
18178    }
18179
18180    /// Set any additional parameter of the query string used in the request.
18181    /// It should be used to set parameters which are not yet available through their own
18182    /// setters.
18183    ///
18184    /// Please note that this method must not be used to set any of the known parameters
18185    /// which have their own setter method. If done anyway, the request will fail.
18186    ///
18187    /// # Additional Parameters
18188    ///
18189    /// * *$.xgafv* (query-string) - V1 error format.
18190    /// * *access_token* (query-string) - OAuth access token.
18191    /// * *alt* (query-string) - Data format for response.
18192    /// * *callback* (query-string) - JSONP
18193    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18194    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
18195    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18196    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18197    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
18198    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18199    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18200    pub fn param<T>(mut self, name: T, value: T) -> AccountUserProfileUpdateCall<'a, C>
18201    where
18202        T: AsRef<str>,
18203    {
18204        self._additional_params
18205            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18206        self
18207    }
18208
18209    /// Identifies the authorization scope for the method you are building.
18210    ///
18211    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18212    /// [`Scope::Dfatrafficking`].
18213    ///
18214    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18215    /// tokens for more than one scope.
18216    ///
18217    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18218    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18219    /// sufficient, a read-write scope will do as well.
18220    pub fn add_scope<St>(mut self, scope: St) -> AccountUserProfileUpdateCall<'a, C>
18221    where
18222        St: AsRef<str>,
18223    {
18224        self._scopes.insert(String::from(scope.as_ref()));
18225        self
18226    }
18227    /// Identifies the authorization scope(s) for the method you are building.
18228    ///
18229    /// See [`Self::add_scope()`] for details.
18230    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountUserProfileUpdateCall<'a, C>
18231    where
18232        I: IntoIterator<Item = St>,
18233        St: AsRef<str>,
18234    {
18235        self._scopes
18236            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18237        self
18238    }
18239
18240    /// Removes all scopes, and no default scope will be used either.
18241    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18242    /// for details).
18243    pub fn clear_scopes(mut self) -> AccountUserProfileUpdateCall<'a, C> {
18244        self._scopes.clear();
18245        self
18246    }
18247}
18248
18249/// Gets one account by ID.
18250///
18251/// A builder for the *get* method supported by a *account* resource.
18252/// It is not used directly, but through a [`AccountMethods`] instance.
18253///
18254/// # Example
18255///
18256/// Instantiate a resource method builder
18257///
18258/// ```test_harness,no_run
18259/// # extern crate hyper;
18260/// # extern crate hyper_rustls;
18261/// # extern crate google_dfareporting3d3 as dfareporting3d3;
18262/// # async fn dox() {
18263/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18264///
18265/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18266/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18267/// #     secret,
18268/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18269/// # ).build().await.unwrap();
18270///
18271/// # let client = hyper_util::client::legacy::Client::builder(
18272/// #     hyper_util::rt::TokioExecutor::new()
18273/// # )
18274/// # .build(
18275/// #     hyper_rustls::HttpsConnectorBuilder::new()
18276/// #         .with_native_roots()
18277/// #         .unwrap()
18278/// #         .https_or_http()
18279/// #         .enable_http1()
18280/// #         .build()
18281/// # );
18282/// # let mut hub = Dfareporting::new(client, auth);
18283/// // You can configure optional parameters by calling the respective setters at will, and
18284/// // execute the final call using `doit()`.
18285/// // Values shown here are possibly random and not representative !
18286/// let result = hub.accounts().get(-15, -13)
18287///              .doit().await;
18288/// # }
18289/// ```
18290pub struct AccountGetCall<'a, C>
18291where
18292    C: 'a,
18293{
18294    hub: &'a Dfareporting<C>,
18295    _profile_id: i64,
18296    _id: i64,
18297    _delegate: Option<&'a mut dyn common::Delegate>,
18298    _additional_params: HashMap<String, String>,
18299    _scopes: BTreeSet<String>,
18300}
18301
18302impl<'a, C> common::CallBuilder for AccountGetCall<'a, C> {}
18303
18304impl<'a, C> AccountGetCall<'a, C>
18305where
18306    C: common::Connector,
18307{
18308    /// Perform the operation you have build so far.
18309    pub async fn doit(mut self) -> common::Result<(common::Response, Account)> {
18310        use std::borrow::Cow;
18311        use std::io::{Read, Seek};
18312
18313        use common::{url::Params, ToParts};
18314        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18315
18316        let mut dd = common::DefaultDelegate;
18317        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18318        dlg.begin(common::MethodInfo {
18319            id: "dfareporting.accounts.get",
18320            http_method: hyper::Method::GET,
18321        });
18322
18323        for &field in ["alt", "profileId", "id"].iter() {
18324            if self._additional_params.contains_key(field) {
18325                dlg.finished(false);
18326                return Err(common::Error::FieldClash(field));
18327            }
18328        }
18329
18330        let mut params = Params::with_capacity(4 + self._additional_params.len());
18331        params.push("profileId", self._profile_id.to_string());
18332        params.push("id", self._id.to_string());
18333
18334        params.extend(self._additional_params.iter());
18335
18336        params.push("alt", "json");
18337        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/accounts/{id}";
18338        if self._scopes.is_empty() {
18339            self._scopes
18340                .insert(Scope::Dfatrafficking.as_ref().to_string());
18341        }
18342
18343        #[allow(clippy::single_element_loop)]
18344        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
18345            url = params.uri_replacement(url, param_name, find_this, false);
18346        }
18347        {
18348            let to_remove = ["id", "profileId"];
18349            params.remove_params(&to_remove);
18350        }
18351
18352        let url = params.parse_with_url(&url);
18353
18354        loop {
18355            let token = match self
18356                .hub
18357                .auth
18358                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18359                .await
18360            {
18361                Ok(token) => token,
18362                Err(e) => match dlg.token(e) {
18363                    Ok(token) => token,
18364                    Err(e) => {
18365                        dlg.finished(false);
18366                        return Err(common::Error::MissingToken(e));
18367                    }
18368                },
18369            };
18370            let mut req_result = {
18371                let client = &self.hub.client;
18372                dlg.pre_request();
18373                let mut req_builder = hyper::Request::builder()
18374                    .method(hyper::Method::GET)
18375                    .uri(url.as_str())
18376                    .header(USER_AGENT, self.hub._user_agent.clone());
18377
18378                if let Some(token) = token.as_ref() {
18379                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18380                }
18381
18382                let request = req_builder
18383                    .header(CONTENT_LENGTH, 0_u64)
18384                    .body(common::to_body::<String>(None));
18385
18386                client.request(request.unwrap()).await
18387            };
18388
18389            match req_result {
18390                Err(err) => {
18391                    if let common::Retry::After(d) = dlg.http_error(&err) {
18392                        sleep(d).await;
18393                        continue;
18394                    }
18395                    dlg.finished(false);
18396                    return Err(common::Error::HttpError(err));
18397                }
18398                Ok(res) => {
18399                    let (mut parts, body) = res.into_parts();
18400                    let mut body = common::Body::new(body);
18401                    if !parts.status.is_success() {
18402                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18403                        let error = serde_json::from_str(&common::to_string(&bytes));
18404                        let response = common::to_response(parts, bytes.into());
18405
18406                        if let common::Retry::After(d) =
18407                            dlg.http_failure(&response, error.as_ref().ok())
18408                        {
18409                            sleep(d).await;
18410                            continue;
18411                        }
18412
18413                        dlg.finished(false);
18414
18415                        return Err(match error {
18416                            Ok(value) => common::Error::BadRequest(value),
18417                            _ => common::Error::Failure(response),
18418                        });
18419                    }
18420                    let response = {
18421                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18422                        let encoded = common::to_string(&bytes);
18423                        match serde_json::from_str(&encoded) {
18424                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18425                            Err(error) => {
18426                                dlg.response_json_decode_error(&encoded, &error);
18427                                return Err(common::Error::JsonDecodeError(
18428                                    encoded.to_string(),
18429                                    error,
18430                                ));
18431                            }
18432                        }
18433                    };
18434
18435                    dlg.finished(true);
18436                    return Ok(response);
18437                }
18438            }
18439        }
18440    }
18441
18442    /// User profile ID associated with this request.
18443    ///
18444    /// Sets the *profile id* path property to the given value.
18445    ///
18446    /// Even though the property as already been set when instantiating this call,
18447    /// we provide this method for API completeness.
18448    pub fn profile_id(mut self, new_value: i64) -> AccountGetCall<'a, C> {
18449        self._profile_id = new_value;
18450        self
18451    }
18452    /// Account ID.
18453    ///
18454    /// Sets the *id* path property to the given value.
18455    ///
18456    /// Even though the property as already been set when instantiating this call,
18457    /// we provide this method for API completeness.
18458    pub fn id(mut self, new_value: i64) -> AccountGetCall<'a, C> {
18459        self._id = new_value;
18460        self
18461    }
18462    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18463    /// while executing the actual API request.
18464    ///
18465    /// ````text
18466    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18467    /// ````
18468    ///
18469    /// Sets the *delegate* property to the given value.
18470    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AccountGetCall<'a, C> {
18471        self._delegate = Some(new_value);
18472        self
18473    }
18474
18475    /// Set any additional parameter of the query string used in the request.
18476    /// It should be used to set parameters which are not yet available through their own
18477    /// setters.
18478    ///
18479    /// Please note that this method must not be used to set any of the known parameters
18480    /// which have their own setter method. If done anyway, the request will fail.
18481    ///
18482    /// # Additional Parameters
18483    ///
18484    /// * *$.xgafv* (query-string) - V1 error format.
18485    /// * *access_token* (query-string) - OAuth access token.
18486    /// * *alt* (query-string) - Data format for response.
18487    /// * *callback* (query-string) - JSONP
18488    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18489    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
18490    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18491    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18492    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
18493    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18494    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18495    pub fn param<T>(mut self, name: T, value: T) -> AccountGetCall<'a, C>
18496    where
18497        T: AsRef<str>,
18498    {
18499        self._additional_params
18500            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18501        self
18502    }
18503
18504    /// Identifies the authorization scope for the method you are building.
18505    ///
18506    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18507    /// [`Scope::Dfatrafficking`].
18508    ///
18509    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18510    /// tokens for more than one scope.
18511    ///
18512    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18513    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18514    /// sufficient, a read-write scope will do as well.
18515    pub fn add_scope<St>(mut self, scope: St) -> AccountGetCall<'a, C>
18516    where
18517        St: AsRef<str>,
18518    {
18519        self._scopes.insert(String::from(scope.as_ref()));
18520        self
18521    }
18522    /// Identifies the authorization scope(s) for the method you are building.
18523    ///
18524    /// See [`Self::add_scope()`] for details.
18525    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountGetCall<'a, C>
18526    where
18527        I: IntoIterator<Item = St>,
18528        St: AsRef<str>,
18529    {
18530        self._scopes
18531            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18532        self
18533    }
18534
18535    /// Removes all scopes, and no default scope will be used either.
18536    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18537    /// for details).
18538    pub fn clear_scopes(mut self) -> AccountGetCall<'a, C> {
18539        self._scopes.clear();
18540        self
18541    }
18542}
18543
18544/// Retrieves the list of accounts, possibly filtered. This method supports paging.
18545///
18546/// A builder for the *list* method supported by a *account* resource.
18547/// It is not used directly, but through a [`AccountMethods`] instance.
18548///
18549/// # Example
18550///
18551/// Instantiate a resource method builder
18552///
18553/// ```test_harness,no_run
18554/// # extern crate hyper;
18555/// # extern crate hyper_rustls;
18556/// # extern crate google_dfareporting3d3 as dfareporting3d3;
18557/// # async fn dox() {
18558/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18559///
18560/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18561/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18562/// #     secret,
18563/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18564/// # ).build().await.unwrap();
18565///
18566/// # let client = hyper_util::client::legacy::Client::builder(
18567/// #     hyper_util::rt::TokioExecutor::new()
18568/// # )
18569/// # .build(
18570/// #     hyper_rustls::HttpsConnectorBuilder::new()
18571/// #         .with_native_roots()
18572/// #         .unwrap()
18573/// #         .https_or_http()
18574/// #         .enable_http1()
18575/// #         .build()
18576/// # );
18577/// # let mut hub = Dfareporting::new(client, auth);
18578/// // You can configure optional parameters by calling the respective setters at will, and
18579/// // execute the final call using `doit()`.
18580/// // Values shown here are possibly random and not representative !
18581/// let result = hub.accounts().list(-24)
18582///              .sort_order("sed")
18583///              .sort_field("et")
18584///              .search_string("et")
18585///              .page_token("vero")
18586///              .max_results(-31)
18587///              .add_ids(-93)
18588///              .active(false)
18589///              .doit().await;
18590/// # }
18591/// ```
18592pub struct AccountListCall<'a, C>
18593where
18594    C: 'a,
18595{
18596    hub: &'a Dfareporting<C>,
18597    _profile_id: i64,
18598    _sort_order: Option<String>,
18599    _sort_field: Option<String>,
18600    _search_string: Option<String>,
18601    _page_token: Option<String>,
18602    _max_results: Option<i32>,
18603    _ids: Vec<i64>,
18604    _active: Option<bool>,
18605    _delegate: Option<&'a mut dyn common::Delegate>,
18606    _additional_params: HashMap<String, String>,
18607    _scopes: BTreeSet<String>,
18608}
18609
18610impl<'a, C> common::CallBuilder for AccountListCall<'a, C> {}
18611
18612impl<'a, C> AccountListCall<'a, C>
18613where
18614    C: common::Connector,
18615{
18616    /// Perform the operation you have build so far.
18617    pub async fn doit(mut self) -> common::Result<(common::Response, AccountsListResponse)> {
18618        use std::borrow::Cow;
18619        use std::io::{Read, Seek};
18620
18621        use common::{url::Params, ToParts};
18622        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18623
18624        let mut dd = common::DefaultDelegate;
18625        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18626        dlg.begin(common::MethodInfo {
18627            id: "dfareporting.accounts.list",
18628            http_method: hyper::Method::GET,
18629        });
18630
18631        for &field in [
18632            "alt",
18633            "profileId",
18634            "sortOrder",
18635            "sortField",
18636            "searchString",
18637            "pageToken",
18638            "maxResults",
18639            "ids",
18640            "active",
18641        ]
18642        .iter()
18643        {
18644            if self._additional_params.contains_key(field) {
18645                dlg.finished(false);
18646                return Err(common::Error::FieldClash(field));
18647            }
18648        }
18649
18650        let mut params = Params::with_capacity(10 + self._additional_params.len());
18651        params.push("profileId", self._profile_id.to_string());
18652        if let Some(value) = self._sort_order.as_ref() {
18653            params.push("sortOrder", value);
18654        }
18655        if let Some(value) = self._sort_field.as_ref() {
18656            params.push("sortField", value);
18657        }
18658        if let Some(value) = self._search_string.as_ref() {
18659            params.push("searchString", value);
18660        }
18661        if let Some(value) = self._page_token.as_ref() {
18662            params.push("pageToken", value);
18663        }
18664        if let Some(value) = self._max_results.as_ref() {
18665            params.push("maxResults", value.to_string());
18666        }
18667        if !self._ids.is_empty() {
18668            for f in self._ids.iter() {
18669                params.push("ids", f.to_string());
18670            }
18671        }
18672        if let Some(value) = self._active.as_ref() {
18673            params.push("active", value.to_string());
18674        }
18675
18676        params.extend(self._additional_params.iter());
18677
18678        params.push("alt", "json");
18679        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/accounts";
18680        if self._scopes.is_empty() {
18681            self._scopes
18682                .insert(Scope::Dfatrafficking.as_ref().to_string());
18683        }
18684
18685        #[allow(clippy::single_element_loop)]
18686        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
18687            url = params.uri_replacement(url, param_name, find_this, false);
18688        }
18689        {
18690            let to_remove = ["profileId"];
18691            params.remove_params(&to_remove);
18692        }
18693
18694        let url = params.parse_with_url(&url);
18695
18696        loop {
18697            let token = match self
18698                .hub
18699                .auth
18700                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18701                .await
18702            {
18703                Ok(token) => token,
18704                Err(e) => match dlg.token(e) {
18705                    Ok(token) => token,
18706                    Err(e) => {
18707                        dlg.finished(false);
18708                        return Err(common::Error::MissingToken(e));
18709                    }
18710                },
18711            };
18712            let mut req_result = {
18713                let client = &self.hub.client;
18714                dlg.pre_request();
18715                let mut req_builder = hyper::Request::builder()
18716                    .method(hyper::Method::GET)
18717                    .uri(url.as_str())
18718                    .header(USER_AGENT, self.hub._user_agent.clone());
18719
18720                if let Some(token) = token.as_ref() {
18721                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18722                }
18723
18724                let request = req_builder
18725                    .header(CONTENT_LENGTH, 0_u64)
18726                    .body(common::to_body::<String>(None));
18727
18728                client.request(request.unwrap()).await
18729            };
18730
18731            match req_result {
18732                Err(err) => {
18733                    if let common::Retry::After(d) = dlg.http_error(&err) {
18734                        sleep(d).await;
18735                        continue;
18736                    }
18737                    dlg.finished(false);
18738                    return Err(common::Error::HttpError(err));
18739                }
18740                Ok(res) => {
18741                    let (mut parts, body) = res.into_parts();
18742                    let mut body = common::Body::new(body);
18743                    if !parts.status.is_success() {
18744                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18745                        let error = serde_json::from_str(&common::to_string(&bytes));
18746                        let response = common::to_response(parts, bytes.into());
18747
18748                        if let common::Retry::After(d) =
18749                            dlg.http_failure(&response, error.as_ref().ok())
18750                        {
18751                            sleep(d).await;
18752                            continue;
18753                        }
18754
18755                        dlg.finished(false);
18756
18757                        return Err(match error {
18758                            Ok(value) => common::Error::BadRequest(value),
18759                            _ => common::Error::Failure(response),
18760                        });
18761                    }
18762                    let response = {
18763                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18764                        let encoded = common::to_string(&bytes);
18765                        match serde_json::from_str(&encoded) {
18766                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18767                            Err(error) => {
18768                                dlg.response_json_decode_error(&encoded, &error);
18769                                return Err(common::Error::JsonDecodeError(
18770                                    encoded.to_string(),
18771                                    error,
18772                                ));
18773                            }
18774                        }
18775                    };
18776
18777                    dlg.finished(true);
18778                    return Ok(response);
18779                }
18780            }
18781        }
18782    }
18783
18784    /// User profile ID associated with this request.
18785    ///
18786    /// Sets the *profile id* path property to the given value.
18787    ///
18788    /// Even though the property as already been set when instantiating this call,
18789    /// we provide this method for API completeness.
18790    pub fn profile_id(mut self, new_value: i64) -> AccountListCall<'a, C> {
18791        self._profile_id = new_value;
18792        self
18793    }
18794    /// Order of sorted results.
18795    ///
18796    /// Sets the *sort order* query property to the given value.
18797    pub fn sort_order(mut self, new_value: &str) -> AccountListCall<'a, C> {
18798        self._sort_order = Some(new_value.to_string());
18799        self
18800    }
18801    /// Field by which to sort the list.
18802    ///
18803    /// Sets the *sort field* query property to the given value.
18804    pub fn sort_field(mut self, new_value: &str) -> AccountListCall<'a, C> {
18805        self._sort_field = Some(new_value.to_string());
18806        self
18807    }
18808    /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "account*2015" will return objects with names like "account June 2015", "account April 2015", or simply "account 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "account" will match objects with name "my account", "account 2015", or simply "account".
18809    ///
18810    /// Sets the *search string* query property to the given value.
18811    pub fn search_string(mut self, new_value: &str) -> AccountListCall<'a, C> {
18812        self._search_string = Some(new_value.to_string());
18813        self
18814    }
18815    /// Value of the nextPageToken from the previous result page.
18816    ///
18817    /// Sets the *page token* query property to the given value.
18818    pub fn page_token(mut self, new_value: &str) -> AccountListCall<'a, C> {
18819        self._page_token = Some(new_value.to_string());
18820        self
18821    }
18822    /// Maximum number of results to return.
18823    ///
18824    /// Sets the *max results* query property to the given value.
18825    pub fn max_results(mut self, new_value: i32) -> AccountListCall<'a, C> {
18826        self._max_results = Some(new_value);
18827        self
18828    }
18829    /// Select only accounts with these IDs.
18830    ///
18831    /// Append the given value to the *ids* query property.
18832    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
18833    pub fn add_ids(mut self, new_value: i64) -> AccountListCall<'a, C> {
18834        self._ids.push(new_value);
18835        self
18836    }
18837    /// Select only active accounts. Don't set this field to select both active and non-active accounts.
18838    ///
18839    /// Sets the *active* query property to the given value.
18840    pub fn active(mut self, new_value: bool) -> AccountListCall<'a, C> {
18841        self._active = Some(new_value);
18842        self
18843    }
18844    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18845    /// while executing the actual API request.
18846    ///
18847    /// ````text
18848    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18849    /// ````
18850    ///
18851    /// Sets the *delegate* property to the given value.
18852    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AccountListCall<'a, C> {
18853        self._delegate = Some(new_value);
18854        self
18855    }
18856
18857    /// Set any additional parameter of the query string used in the request.
18858    /// It should be used to set parameters which are not yet available through their own
18859    /// setters.
18860    ///
18861    /// Please note that this method must not be used to set any of the known parameters
18862    /// which have their own setter method. If done anyway, the request will fail.
18863    ///
18864    /// # Additional Parameters
18865    ///
18866    /// * *$.xgafv* (query-string) - V1 error format.
18867    /// * *access_token* (query-string) - OAuth access token.
18868    /// * *alt* (query-string) - Data format for response.
18869    /// * *callback* (query-string) - JSONP
18870    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18871    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
18872    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18873    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18874    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
18875    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18876    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18877    pub fn param<T>(mut self, name: T, value: T) -> AccountListCall<'a, C>
18878    where
18879        T: AsRef<str>,
18880    {
18881        self._additional_params
18882            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18883        self
18884    }
18885
18886    /// Identifies the authorization scope for the method you are building.
18887    ///
18888    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18889    /// [`Scope::Dfatrafficking`].
18890    ///
18891    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18892    /// tokens for more than one scope.
18893    ///
18894    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18895    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18896    /// sufficient, a read-write scope will do as well.
18897    pub fn add_scope<St>(mut self, scope: St) -> AccountListCall<'a, C>
18898    where
18899        St: AsRef<str>,
18900    {
18901        self._scopes.insert(String::from(scope.as_ref()));
18902        self
18903    }
18904    /// Identifies the authorization scope(s) for the method you are building.
18905    ///
18906    /// See [`Self::add_scope()`] for details.
18907    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountListCall<'a, C>
18908    where
18909        I: IntoIterator<Item = St>,
18910        St: AsRef<str>,
18911    {
18912        self._scopes
18913            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18914        self
18915    }
18916
18917    /// Removes all scopes, and no default scope will be used either.
18918    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18919    /// for details).
18920    pub fn clear_scopes(mut self) -> AccountListCall<'a, C> {
18921        self._scopes.clear();
18922        self
18923    }
18924}
18925
18926/// Updates an existing account. This method supports patch semantics.
18927///
18928/// A builder for the *patch* method supported by a *account* resource.
18929/// It is not used directly, but through a [`AccountMethods`] instance.
18930///
18931/// # Example
18932///
18933/// Instantiate a resource method builder
18934///
18935/// ```test_harness,no_run
18936/// # extern crate hyper;
18937/// # extern crate hyper_rustls;
18938/// # extern crate google_dfareporting3d3 as dfareporting3d3;
18939/// use dfareporting3d3::api::Account;
18940/// # async fn dox() {
18941/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18942///
18943/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18944/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18945/// #     secret,
18946/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18947/// # ).build().await.unwrap();
18948///
18949/// # let client = hyper_util::client::legacy::Client::builder(
18950/// #     hyper_util::rt::TokioExecutor::new()
18951/// # )
18952/// # .build(
18953/// #     hyper_rustls::HttpsConnectorBuilder::new()
18954/// #         .with_native_roots()
18955/// #         .unwrap()
18956/// #         .https_or_http()
18957/// #         .enable_http1()
18958/// #         .build()
18959/// # );
18960/// # let mut hub = Dfareporting::new(client, auth);
18961/// // As the method needs a request, you would usually fill it with the desired information
18962/// // into the respective structure. Some of the parts shown here might not be applicable !
18963/// // Values shown here are possibly random and not representative !
18964/// let mut req = Account::default();
18965///
18966/// // You can configure optional parameters by calling the respective setters at will, and
18967/// // execute the final call using `doit()`.
18968/// // Values shown here are possibly random and not representative !
18969/// let result = hub.accounts().patch(req, -92, -49)
18970///              .doit().await;
18971/// # }
18972/// ```
18973pub struct AccountPatchCall<'a, C>
18974where
18975    C: 'a,
18976{
18977    hub: &'a Dfareporting<C>,
18978    _request: Account,
18979    _profile_id: i64,
18980    _id: i64,
18981    _delegate: Option<&'a mut dyn common::Delegate>,
18982    _additional_params: HashMap<String, String>,
18983    _scopes: BTreeSet<String>,
18984}
18985
18986impl<'a, C> common::CallBuilder for AccountPatchCall<'a, C> {}
18987
18988impl<'a, C> AccountPatchCall<'a, C>
18989where
18990    C: common::Connector,
18991{
18992    /// Perform the operation you have build so far.
18993    pub async fn doit(mut self) -> common::Result<(common::Response, Account)> {
18994        use std::borrow::Cow;
18995        use std::io::{Read, Seek};
18996
18997        use common::{url::Params, ToParts};
18998        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18999
19000        let mut dd = common::DefaultDelegate;
19001        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19002        dlg.begin(common::MethodInfo {
19003            id: "dfareporting.accounts.patch",
19004            http_method: hyper::Method::PATCH,
19005        });
19006
19007        for &field in ["alt", "profileId", "id"].iter() {
19008            if self._additional_params.contains_key(field) {
19009                dlg.finished(false);
19010                return Err(common::Error::FieldClash(field));
19011            }
19012        }
19013
19014        let mut params = Params::with_capacity(5 + self._additional_params.len());
19015        params.push("profileId", self._profile_id.to_string());
19016        params.push("id", self._id.to_string());
19017
19018        params.extend(self._additional_params.iter());
19019
19020        params.push("alt", "json");
19021        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/accounts";
19022        if self._scopes.is_empty() {
19023            self._scopes
19024                .insert(Scope::Dfatrafficking.as_ref().to_string());
19025        }
19026
19027        #[allow(clippy::single_element_loop)]
19028        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
19029            url = params.uri_replacement(url, param_name, find_this, false);
19030        }
19031        {
19032            let to_remove = ["profileId"];
19033            params.remove_params(&to_remove);
19034        }
19035
19036        let url = params.parse_with_url(&url);
19037
19038        let mut json_mime_type = mime::APPLICATION_JSON;
19039        let mut request_value_reader = {
19040            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19041            common::remove_json_null_values(&mut value);
19042            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19043            serde_json::to_writer(&mut dst, &value).unwrap();
19044            dst
19045        };
19046        let request_size = request_value_reader
19047            .seek(std::io::SeekFrom::End(0))
19048            .unwrap();
19049        request_value_reader
19050            .seek(std::io::SeekFrom::Start(0))
19051            .unwrap();
19052
19053        loop {
19054            let token = match self
19055                .hub
19056                .auth
19057                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19058                .await
19059            {
19060                Ok(token) => token,
19061                Err(e) => match dlg.token(e) {
19062                    Ok(token) => token,
19063                    Err(e) => {
19064                        dlg.finished(false);
19065                        return Err(common::Error::MissingToken(e));
19066                    }
19067                },
19068            };
19069            request_value_reader
19070                .seek(std::io::SeekFrom::Start(0))
19071                .unwrap();
19072            let mut req_result = {
19073                let client = &self.hub.client;
19074                dlg.pre_request();
19075                let mut req_builder = hyper::Request::builder()
19076                    .method(hyper::Method::PATCH)
19077                    .uri(url.as_str())
19078                    .header(USER_AGENT, self.hub._user_agent.clone());
19079
19080                if let Some(token) = token.as_ref() {
19081                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19082                }
19083
19084                let request = req_builder
19085                    .header(CONTENT_TYPE, json_mime_type.to_string())
19086                    .header(CONTENT_LENGTH, request_size as u64)
19087                    .body(common::to_body(
19088                        request_value_reader.get_ref().clone().into(),
19089                    ));
19090
19091                client.request(request.unwrap()).await
19092            };
19093
19094            match req_result {
19095                Err(err) => {
19096                    if let common::Retry::After(d) = dlg.http_error(&err) {
19097                        sleep(d).await;
19098                        continue;
19099                    }
19100                    dlg.finished(false);
19101                    return Err(common::Error::HttpError(err));
19102                }
19103                Ok(res) => {
19104                    let (mut parts, body) = res.into_parts();
19105                    let mut body = common::Body::new(body);
19106                    if !parts.status.is_success() {
19107                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19108                        let error = serde_json::from_str(&common::to_string(&bytes));
19109                        let response = common::to_response(parts, bytes.into());
19110
19111                        if let common::Retry::After(d) =
19112                            dlg.http_failure(&response, error.as_ref().ok())
19113                        {
19114                            sleep(d).await;
19115                            continue;
19116                        }
19117
19118                        dlg.finished(false);
19119
19120                        return Err(match error {
19121                            Ok(value) => common::Error::BadRequest(value),
19122                            _ => common::Error::Failure(response),
19123                        });
19124                    }
19125                    let response = {
19126                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19127                        let encoded = common::to_string(&bytes);
19128                        match serde_json::from_str(&encoded) {
19129                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19130                            Err(error) => {
19131                                dlg.response_json_decode_error(&encoded, &error);
19132                                return Err(common::Error::JsonDecodeError(
19133                                    encoded.to_string(),
19134                                    error,
19135                                ));
19136                            }
19137                        }
19138                    };
19139
19140                    dlg.finished(true);
19141                    return Ok(response);
19142                }
19143            }
19144        }
19145    }
19146
19147    ///
19148    /// Sets the *request* property to the given value.
19149    ///
19150    /// Even though the property as already been set when instantiating this call,
19151    /// we provide this method for API completeness.
19152    pub fn request(mut self, new_value: Account) -> AccountPatchCall<'a, C> {
19153        self._request = new_value;
19154        self
19155    }
19156    /// User profile ID associated with this request.
19157    ///
19158    /// Sets the *profile id* path property to the given value.
19159    ///
19160    /// Even though the property as already been set when instantiating this call,
19161    /// we provide this method for API completeness.
19162    pub fn profile_id(mut self, new_value: i64) -> AccountPatchCall<'a, C> {
19163        self._profile_id = new_value;
19164        self
19165    }
19166    /// Account ID.
19167    ///
19168    /// Sets the *id* query property to the given value.
19169    ///
19170    /// Even though the property as already been set when instantiating this call,
19171    /// we provide this method for API completeness.
19172    pub fn id(mut self, new_value: i64) -> AccountPatchCall<'a, C> {
19173        self._id = new_value;
19174        self
19175    }
19176    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19177    /// while executing the actual API request.
19178    ///
19179    /// ````text
19180    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19181    /// ````
19182    ///
19183    /// Sets the *delegate* property to the given value.
19184    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AccountPatchCall<'a, C> {
19185        self._delegate = Some(new_value);
19186        self
19187    }
19188
19189    /// Set any additional parameter of the query string used in the request.
19190    /// It should be used to set parameters which are not yet available through their own
19191    /// setters.
19192    ///
19193    /// Please note that this method must not be used to set any of the known parameters
19194    /// which have their own setter method. If done anyway, the request will fail.
19195    ///
19196    /// # Additional Parameters
19197    ///
19198    /// * *$.xgafv* (query-string) - V1 error format.
19199    /// * *access_token* (query-string) - OAuth access token.
19200    /// * *alt* (query-string) - Data format for response.
19201    /// * *callback* (query-string) - JSONP
19202    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19203    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
19204    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19205    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19206    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
19207    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19208    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19209    pub fn param<T>(mut self, name: T, value: T) -> AccountPatchCall<'a, C>
19210    where
19211        T: AsRef<str>,
19212    {
19213        self._additional_params
19214            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19215        self
19216    }
19217
19218    /// Identifies the authorization scope for the method you are building.
19219    ///
19220    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19221    /// [`Scope::Dfatrafficking`].
19222    ///
19223    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19224    /// tokens for more than one scope.
19225    ///
19226    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19227    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19228    /// sufficient, a read-write scope will do as well.
19229    pub fn add_scope<St>(mut self, scope: St) -> AccountPatchCall<'a, C>
19230    where
19231        St: AsRef<str>,
19232    {
19233        self._scopes.insert(String::from(scope.as_ref()));
19234        self
19235    }
19236    /// Identifies the authorization scope(s) for the method you are building.
19237    ///
19238    /// See [`Self::add_scope()`] for details.
19239    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountPatchCall<'a, C>
19240    where
19241        I: IntoIterator<Item = St>,
19242        St: AsRef<str>,
19243    {
19244        self._scopes
19245            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19246        self
19247    }
19248
19249    /// Removes all scopes, and no default scope will be used either.
19250    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19251    /// for details).
19252    pub fn clear_scopes(mut self) -> AccountPatchCall<'a, C> {
19253        self._scopes.clear();
19254        self
19255    }
19256}
19257
19258/// Updates an existing account.
19259///
19260/// A builder for the *update* method supported by a *account* resource.
19261/// It is not used directly, but through a [`AccountMethods`] instance.
19262///
19263/// # Example
19264///
19265/// Instantiate a resource method builder
19266///
19267/// ```test_harness,no_run
19268/// # extern crate hyper;
19269/// # extern crate hyper_rustls;
19270/// # extern crate google_dfareporting3d3 as dfareporting3d3;
19271/// use dfareporting3d3::api::Account;
19272/// # async fn dox() {
19273/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19274///
19275/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19276/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19277/// #     secret,
19278/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19279/// # ).build().await.unwrap();
19280///
19281/// # let client = hyper_util::client::legacy::Client::builder(
19282/// #     hyper_util::rt::TokioExecutor::new()
19283/// # )
19284/// # .build(
19285/// #     hyper_rustls::HttpsConnectorBuilder::new()
19286/// #         .with_native_roots()
19287/// #         .unwrap()
19288/// #         .https_or_http()
19289/// #         .enable_http1()
19290/// #         .build()
19291/// # );
19292/// # let mut hub = Dfareporting::new(client, auth);
19293/// // As the method needs a request, you would usually fill it with the desired information
19294/// // into the respective structure. Some of the parts shown here might not be applicable !
19295/// // Values shown here are possibly random and not representative !
19296/// let mut req = Account::default();
19297///
19298/// // You can configure optional parameters by calling the respective setters at will, and
19299/// // execute the final call using `doit()`.
19300/// // Values shown here are possibly random and not representative !
19301/// let result = hub.accounts().update(req, -18)
19302///              .doit().await;
19303/// # }
19304/// ```
19305pub struct AccountUpdateCall<'a, C>
19306where
19307    C: 'a,
19308{
19309    hub: &'a Dfareporting<C>,
19310    _request: Account,
19311    _profile_id: i64,
19312    _delegate: Option<&'a mut dyn common::Delegate>,
19313    _additional_params: HashMap<String, String>,
19314    _scopes: BTreeSet<String>,
19315}
19316
19317impl<'a, C> common::CallBuilder for AccountUpdateCall<'a, C> {}
19318
19319impl<'a, C> AccountUpdateCall<'a, C>
19320where
19321    C: common::Connector,
19322{
19323    /// Perform the operation you have build so far.
19324    pub async fn doit(mut self) -> common::Result<(common::Response, Account)> {
19325        use std::borrow::Cow;
19326        use std::io::{Read, Seek};
19327
19328        use common::{url::Params, ToParts};
19329        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19330
19331        let mut dd = common::DefaultDelegate;
19332        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19333        dlg.begin(common::MethodInfo {
19334            id: "dfareporting.accounts.update",
19335            http_method: hyper::Method::PUT,
19336        });
19337
19338        for &field in ["alt", "profileId"].iter() {
19339            if self._additional_params.contains_key(field) {
19340                dlg.finished(false);
19341                return Err(common::Error::FieldClash(field));
19342            }
19343        }
19344
19345        let mut params = Params::with_capacity(4 + self._additional_params.len());
19346        params.push("profileId", self._profile_id.to_string());
19347
19348        params.extend(self._additional_params.iter());
19349
19350        params.push("alt", "json");
19351        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/accounts";
19352        if self._scopes.is_empty() {
19353            self._scopes
19354                .insert(Scope::Dfatrafficking.as_ref().to_string());
19355        }
19356
19357        #[allow(clippy::single_element_loop)]
19358        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
19359            url = params.uri_replacement(url, param_name, find_this, false);
19360        }
19361        {
19362            let to_remove = ["profileId"];
19363            params.remove_params(&to_remove);
19364        }
19365
19366        let url = params.parse_with_url(&url);
19367
19368        let mut json_mime_type = mime::APPLICATION_JSON;
19369        let mut request_value_reader = {
19370            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19371            common::remove_json_null_values(&mut value);
19372            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19373            serde_json::to_writer(&mut dst, &value).unwrap();
19374            dst
19375        };
19376        let request_size = request_value_reader
19377            .seek(std::io::SeekFrom::End(0))
19378            .unwrap();
19379        request_value_reader
19380            .seek(std::io::SeekFrom::Start(0))
19381            .unwrap();
19382
19383        loop {
19384            let token = match self
19385                .hub
19386                .auth
19387                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19388                .await
19389            {
19390                Ok(token) => token,
19391                Err(e) => match dlg.token(e) {
19392                    Ok(token) => token,
19393                    Err(e) => {
19394                        dlg.finished(false);
19395                        return Err(common::Error::MissingToken(e));
19396                    }
19397                },
19398            };
19399            request_value_reader
19400                .seek(std::io::SeekFrom::Start(0))
19401                .unwrap();
19402            let mut req_result = {
19403                let client = &self.hub.client;
19404                dlg.pre_request();
19405                let mut req_builder = hyper::Request::builder()
19406                    .method(hyper::Method::PUT)
19407                    .uri(url.as_str())
19408                    .header(USER_AGENT, self.hub._user_agent.clone());
19409
19410                if let Some(token) = token.as_ref() {
19411                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19412                }
19413
19414                let request = req_builder
19415                    .header(CONTENT_TYPE, json_mime_type.to_string())
19416                    .header(CONTENT_LENGTH, request_size as u64)
19417                    .body(common::to_body(
19418                        request_value_reader.get_ref().clone().into(),
19419                    ));
19420
19421                client.request(request.unwrap()).await
19422            };
19423
19424            match req_result {
19425                Err(err) => {
19426                    if let common::Retry::After(d) = dlg.http_error(&err) {
19427                        sleep(d).await;
19428                        continue;
19429                    }
19430                    dlg.finished(false);
19431                    return Err(common::Error::HttpError(err));
19432                }
19433                Ok(res) => {
19434                    let (mut parts, body) = res.into_parts();
19435                    let mut body = common::Body::new(body);
19436                    if !parts.status.is_success() {
19437                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19438                        let error = serde_json::from_str(&common::to_string(&bytes));
19439                        let response = common::to_response(parts, bytes.into());
19440
19441                        if let common::Retry::After(d) =
19442                            dlg.http_failure(&response, error.as_ref().ok())
19443                        {
19444                            sleep(d).await;
19445                            continue;
19446                        }
19447
19448                        dlg.finished(false);
19449
19450                        return Err(match error {
19451                            Ok(value) => common::Error::BadRequest(value),
19452                            _ => common::Error::Failure(response),
19453                        });
19454                    }
19455                    let response = {
19456                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19457                        let encoded = common::to_string(&bytes);
19458                        match serde_json::from_str(&encoded) {
19459                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19460                            Err(error) => {
19461                                dlg.response_json_decode_error(&encoded, &error);
19462                                return Err(common::Error::JsonDecodeError(
19463                                    encoded.to_string(),
19464                                    error,
19465                                ));
19466                            }
19467                        }
19468                    };
19469
19470                    dlg.finished(true);
19471                    return Ok(response);
19472                }
19473            }
19474        }
19475    }
19476
19477    ///
19478    /// Sets the *request* property to the given value.
19479    ///
19480    /// Even though the property as already been set when instantiating this call,
19481    /// we provide this method for API completeness.
19482    pub fn request(mut self, new_value: Account) -> AccountUpdateCall<'a, C> {
19483        self._request = new_value;
19484        self
19485    }
19486    /// User profile ID associated with this request.
19487    ///
19488    /// Sets the *profile id* path property to the given value.
19489    ///
19490    /// Even though the property as already been set when instantiating this call,
19491    /// we provide this method for API completeness.
19492    pub fn profile_id(mut self, new_value: i64) -> AccountUpdateCall<'a, C> {
19493        self._profile_id = new_value;
19494        self
19495    }
19496    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19497    /// while executing the actual API request.
19498    ///
19499    /// ````text
19500    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19501    /// ````
19502    ///
19503    /// Sets the *delegate* property to the given value.
19504    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AccountUpdateCall<'a, C> {
19505        self._delegate = Some(new_value);
19506        self
19507    }
19508
19509    /// Set any additional parameter of the query string used in the request.
19510    /// It should be used to set parameters which are not yet available through their own
19511    /// setters.
19512    ///
19513    /// Please note that this method must not be used to set any of the known parameters
19514    /// which have their own setter method. If done anyway, the request will fail.
19515    ///
19516    /// # Additional Parameters
19517    ///
19518    /// * *$.xgafv* (query-string) - V1 error format.
19519    /// * *access_token* (query-string) - OAuth access token.
19520    /// * *alt* (query-string) - Data format for response.
19521    /// * *callback* (query-string) - JSONP
19522    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19523    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
19524    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19525    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19526    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
19527    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19528    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19529    pub fn param<T>(mut self, name: T, value: T) -> AccountUpdateCall<'a, C>
19530    where
19531        T: AsRef<str>,
19532    {
19533        self._additional_params
19534            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19535        self
19536    }
19537
19538    /// Identifies the authorization scope for the method you are building.
19539    ///
19540    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19541    /// [`Scope::Dfatrafficking`].
19542    ///
19543    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19544    /// tokens for more than one scope.
19545    ///
19546    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19547    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19548    /// sufficient, a read-write scope will do as well.
19549    pub fn add_scope<St>(mut self, scope: St) -> AccountUpdateCall<'a, C>
19550    where
19551        St: AsRef<str>,
19552    {
19553        self._scopes.insert(String::from(scope.as_ref()));
19554        self
19555    }
19556    /// Identifies the authorization scope(s) for the method you are building.
19557    ///
19558    /// See [`Self::add_scope()`] for details.
19559    pub fn add_scopes<I, St>(mut self, scopes: I) -> AccountUpdateCall<'a, C>
19560    where
19561        I: IntoIterator<Item = St>,
19562        St: AsRef<str>,
19563    {
19564        self._scopes
19565            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19566        self
19567    }
19568
19569    /// Removes all scopes, and no default scope will be used either.
19570    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19571    /// for details).
19572    pub fn clear_scopes(mut self) -> AccountUpdateCall<'a, C> {
19573        self._scopes.clear();
19574        self
19575    }
19576}
19577
19578/// Gets one ad by ID.
19579///
19580/// A builder for the *get* method supported by a *ad* resource.
19581/// It is not used directly, but through a [`AdMethods`] instance.
19582///
19583/// # Example
19584///
19585/// Instantiate a resource method builder
19586///
19587/// ```test_harness,no_run
19588/// # extern crate hyper;
19589/// # extern crate hyper_rustls;
19590/// # extern crate google_dfareporting3d3 as dfareporting3d3;
19591/// # async fn dox() {
19592/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19593///
19594/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19595/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19596/// #     secret,
19597/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19598/// # ).build().await.unwrap();
19599///
19600/// # let client = hyper_util::client::legacy::Client::builder(
19601/// #     hyper_util::rt::TokioExecutor::new()
19602/// # )
19603/// # .build(
19604/// #     hyper_rustls::HttpsConnectorBuilder::new()
19605/// #         .with_native_roots()
19606/// #         .unwrap()
19607/// #         .https_or_http()
19608/// #         .enable_http1()
19609/// #         .build()
19610/// # );
19611/// # let mut hub = Dfareporting::new(client, auth);
19612/// // You can configure optional parameters by calling the respective setters at will, and
19613/// // execute the final call using `doit()`.
19614/// // Values shown here are possibly random and not representative !
19615/// let result = hub.ads().get(-22, -95)
19616///              .doit().await;
19617/// # }
19618/// ```
19619pub struct AdGetCall<'a, C>
19620where
19621    C: 'a,
19622{
19623    hub: &'a Dfareporting<C>,
19624    _profile_id: i64,
19625    _id: i64,
19626    _delegate: Option<&'a mut dyn common::Delegate>,
19627    _additional_params: HashMap<String, String>,
19628    _scopes: BTreeSet<String>,
19629}
19630
19631impl<'a, C> common::CallBuilder for AdGetCall<'a, C> {}
19632
19633impl<'a, C> AdGetCall<'a, C>
19634where
19635    C: common::Connector,
19636{
19637    /// Perform the operation you have build so far.
19638    pub async fn doit(mut self) -> common::Result<(common::Response, Ad)> {
19639        use std::borrow::Cow;
19640        use std::io::{Read, Seek};
19641
19642        use common::{url::Params, ToParts};
19643        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19644
19645        let mut dd = common::DefaultDelegate;
19646        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19647        dlg.begin(common::MethodInfo {
19648            id: "dfareporting.ads.get",
19649            http_method: hyper::Method::GET,
19650        });
19651
19652        for &field in ["alt", "profileId", "id"].iter() {
19653            if self._additional_params.contains_key(field) {
19654                dlg.finished(false);
19655                return Err(common::Error::FieldClash(field));
19656            }
19657        }
19658
19659        let mut params = Params::with_capacity(4 + self._additional_params.len());
19660        params.push("profileId", self._profile_id.to_string());
19661        params.push("id", self._id.to_string());
19662
19663        params.extend(self._additional_params.iter());
19664
19665        params.push("alt", "json");
19666        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/ads/{id}";
19667        if self._scopes.is_empty() {
19668            self._scopes
19669                .insert(Scope::Dfatrafficking.as_ref().to_string());
19670        }
19671
19672        #[allow(clippy::single_element_loop)]
19673        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
19674            url = params.uri_replacement(url, param_name, find_this, false);
19675        }
19676        {
19677            let to_remove = ["id", "profileId"];
19678            params.remove_params(&to_remove);
19679        }
19680
19681        let url = params.parse_with_url(&url);
19682
19683        loop {
19684            let token = match self
19685                .hub
19686                .auth
19687                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19688                .await
19689            {
19690                Ok(token) => token,
19691                Err(e) => match dlg.token(e) {
19692                    Ok(token) => token,
19693                    Err(e) => {
19694                        dlg.finished(false);
19695                        return Err(common::Error::MissingToken(e));
19696                    }
19697                },
19698            };
19699            let mut req_result = {
19700                let client = &self.hub.client;
19701                dlg.pre_request();
19702                let mut req_builder = hyper::Request::builder()
19703                    .method(hyper::Method::GET)
19704                    .uri(url.as_str())
19705                    .header(USER_AGENT, self.hub._user_agent.clone());
19706
19707                if let Some(token) = token.as_ref() {
19708                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19709                }
19710
19711                let request = req_builder
19712                    .header(CONTENT_LENGTH, 0_u64)
19713                    .body(common::to_body::<String>(None));
19714
19715                client.request(request.unwrap()).await
19716            };
19717
19718            match req_result {
19719                Err(err) => {
19720                    if let common::Retry::After(d) = dlg.http_error(&err) {
19721                        sleep(d).await;
19722                        continue;
19723                    }
19724                    dlg.finished(false);
19725                    return Err(common::Error::HttpError(err));
19726                }
19727                Ok(res) => {
19728                    let (mut parts, body) = res.into_parts();
19729                    let mut body = common::Body::new(body);
19730                    if !parts.status.is_success() {
19731                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19732                        let error = serde_json::from_str(&common::to_string(&bytes));
19733                        let response = common::to_response(parts, bytes.into());
19734
19735                        if let common::Retry::After(d) =
19736                            dlg.http_failure(&response, error.as_ref().ok())
19737                        {
19738                            sleep(d).await;
19739                            continue;
19740                        }
19741
19742                        dlg.finished(false);
19743
19744                        return Err(match error {
19745                            Ok(value) => common::Error::BadRequest(value),
19746                            _ => common::Error::Failure(response),
19747                        });
19748                    }
19749                    let response = {
19750                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19751                        let encoded = common::to_string(&bytes);
19752                        match serde_json::from_str(&encoded) {
19753                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19754                            Err(error) => {
19755                                dlg.response_json_decode_error(&encoded, &error);
19756                                return Err(common::Error::JsonDecodeError(
19757                                    encoded.to_string(),
19758                                    error,
19759                                ));
19760                            }
19761                        }
19762                    };
19763
19764                    dlg.finished(true);
19765                    return Ok(response);
19766                }
19767            }
19768        }
19769    }
19770
19771    /// User profile ID associated with this request.
19772    ///
19773    /// Sets the *profile id* path property to the given value.
19774    ///
19775    /// Even though the property as already been set when instantiating this call,
19776    /// we provide this method for API completeness.
19777    pub fn profile_id(mut self, new_value: i64) -> AdGetCall<'a, C> {
19778        self._profile_id = new_value;
19779        self
19780    }
19781    /// Ad ID.
19782    ///
19783    /// Sets the *id* path property to the given value.
19784    ///
19785    /// Even though the property as already been set when instantiating this call,
19786    /// we provide this method for API completeness.
19787    pub fn id(mut self, new_value: i64) -> AdGetCall<'a, C> {
19788        self._id = new_value;
19789        self
19790    }
19791    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19792    /// while executing the actual API request.
19793    ///
19794    /// ````text
19795    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19796    /// ````
19797    ///
19798    /// Sets the *delegate* property to the given value.
19799    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AdGetCall<'a, C> {
19800        self._delegate = Some(new_value);
19801        self
19802    }
19803
19804    /// Set any additional parameter of the query string used in the request.
19805    /// It should be used to set parameters which are not yet available through their own
19806    /// setters.
19807    ///
19808    /// Please note that this method must not be used to set any of the known parameters
19809    /// which have their own setter method. If done anyway, the request will fail.
19810    ///
19811    /// # Additional Parameters
19812    ///
19813    /// * *$.xgafv* (query-string) - V1 error format.
19814    /// * *access_token* (query-string) - OAuth access token.
19815    /// * *alt* (query-string) - Data format for response.
19816    /// * *callback* (query-string) - JSONP
19817    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19818    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
19819    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19820    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19821    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
19822    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19823    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19824    pub fn param<T>(mut self, name: T, value: T) -> AdGetCall<'a, C>
19825    where
19826        T: AsRef<str>,
19827    {
19828        self._additional_params
19829            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19830        self
19831    }
19832
19833    /// Identifies the authorization scope for the method you are building.
19834    ///
19835    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19836    /// [`Scope::Dfatrafficking`].
19837    ///
19838    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19839    /// tokens for more than one scope.
19840    ///
19841    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19842    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19843    /// sufficient, a read-write scope will do as well.
19844    pub fn add_scope<St>(mut self, scope: St) -> AdGetCall<'a, C>
19845    where
19846        St: AsRef<str>,
19847    {
19848        self._scopes.insert(String::from(scope.as_ref()));
19849        self
19850    }
19851    /// Identifies the authorization scope(s) for the method you are building.
19852    ///
19853    /// See [`Self::add_scope()`] for details.
19854    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdGetCall<'a, C>
19855    where
19856        I: IntoIterator<Item = St>,
19857        St: AsRef<str>,
19858    {
19859        self._scopes
19860            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19861        self
19862    }
19863
19864    /// Removes all scopes, and no default scope will be used either.
19865    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19866    /// for details).
19867    pub fn clear_scopes(mut self) -> AdGetCall<'a, C> {
19868        self._scopes.clear();
19869        self
19870    }
19871}
19872
19873/// Inserts a new ad.
19874///
19875/// A builder for the *insert* method supported by a *ad* resource.
19876/// It is not used directly, but through a [`AdMethods`] instance.
19877///
19878/// # Example
19879///
19880/// Instantiate a resource method builder
19881///
19882/// ```test_harness,no_run
19883/// # extern crate hyper;
19884/// # extern crate hyper_rustls;
19885/// # extern crate google_dfareporting3d3 as dfareporting3d3;
19886/// use dfareporting3d3::api::Ad;
19887/// # async fn dox() {
19888/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19889///
19890/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19891/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19892/// #     secret,
19893/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19894/// # ).build().await.unwrap();
19895///
19896/// # let client = hyper_util::client::legacy::Client::builder(
19897/// #     hyper_util::rt::TokioExecutor::new()
19898/// # )
19899/// # .build(
19900/// #     hyper_rustls::HttpsConnectorBuilder::new()
19901/// #         .with_native_roots()
19902/// #         .unwrap()
19903/// #         .https_or_http()
19904/// #         .enable_http1()
19905/// #         .build()
19906/// # );
19907/// # let mut hub = Dfareporting::new(client, auth);
19908/// // As the method needs a request, you would usually fill it with the desired information
19909/// // into the respective structure. Some of the parts shown here might not be applicable !
19910/// // Values shown here are possibly random and not representative !
19911/// let mut req = Ad::default();
19912///
19913/// // You can configure optional parameters by calling the respective setters at will, and
19914/// // execute the final call using `doit()`.
19915/// // Values shown here are possibly random and not representative !
19916/// let result = hub.ads().insert(req, -15)
19917///              .doit().await;
19918/// # }
19919/// ```
19920pub struct AdInsertCall<'a, C>
19921where
19922    C: 'a,
19923{
19924    hub: &'a Dfareporting<C>,
19925    _request: Ad,
19926    _profile_id: i64,
19927    _delegate: Option<&'a mut dyn common::Delegate>,
19928    _additional_params: HashMap<String, String>,
19929    _scopes: BTreeSet<String>,
19930}
19931
19932impl<'a, C> common::CallBuilder for AdInsertCall<'a, C> {}
19933
19934impl<'a, C> AdInsertCall<'a, C>
19935where
19936    C: common::Connector,
19937{
19938    /// Perform the operation you have build so far.
19939    pub async fn doit(mut self) -> common::Result<(common::Response, Ad)> {
19940        use std::borrow::Cow;
19941        use std::io::{Read, Seek};
19942
19943        use common::{url::Params, ToParts};
19944        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19945
19946        let mut dd = common::DefaultDelegate;
19947        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19948        dlg.begin(common::MethodInfo {
19949            id: "dfareporting.ads.insert",
19950            http_method: hyper::Method::POST,
19951        });
19952
19953        for &field in ["alt", "profileId"].iter() {
19954            if self._additional_params.contains_key(field) {
19955                dlg.finished(false);
19956                return Err(common::Error::FieldClash(field));
19957            }
19958        }
19959
19960        let mut params = Params::with_capacity(4 + self._additional_params.len());
19961        params.push("profileId", self._profile_id.to_string());
19962
19963        params.extend(self._additional_params.iter());
19964
19965        params.push("alt", "json");
19966        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/ads";
19967        if self._scopes.is_empty() {
19968            self._scopes
19969                .insert(Scope::Dfatrafficking.as_ref().to_string());
19970        }
19971
19972        #[allow(clippy::single_element_loop)]
19973        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
19974            url = params.uri_replacement(url, param_name, find_this, false);
19975        }
19976        {
19977            let to_remove = ["profileId"];
19978            params.remove_params(&to_remove);
19979        }
19980
19981        let url = params.parse_with_url(&url);
19982
19983        let mut json_mime_type = mime::APPLICATION_JSON;
19984        let mut request_value_reader = {
19985            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19986            common::remove_json_null_values(&mut value);
19987            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19988            serde_json::to_writer(&mut dst, &value).unwrap();
19989            dst
19990        };
19991        let request_size = request_value_reader
19992            .seek(std::io::SeekFrom::End(0))
19993            .unwrap();
19994        request_value_reader
19995            .seek(std::io::SeekFrom::Start(0))
19996            .unwrap();
19997
19998        loop {
19999            let token = match self
20000                .hub
20001                .auth
20002                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20003                .await
20004            {
20005                Ok(token) => token,
20006                Err(e) => match dlg.token(e) {
20007                    Ok(token) => token,
20008                    Err(e) => {
20009                        dlg.finished(false);
20010                        return Err(common::Error::MissingToken(e));
20011                    }
20012                },
20013            };
20014            request_value_reader
20015                .seek(std::io::SeekFrom::Start(0))
20016                .unwrap();
20017            let mut req_result = {
20018                let client = &self.hub.client;
20019                dlg.pre_request();
20020                let mut req_builder = hyper::Request::builder()
20021                    .method(hyper::Method::POST)
20022                    .uri(url.as_str())
20023                    .header(USER_AGENT, self.hub._user_agent.clone());
20024
20025                if let Some(token) = token.as_ref() {
20026                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20027                }
20028
20029                let request = req_builder
20030                    .header(CONTENT_TYPE, json_mime_type.to_string())
20031                    .header(CONTENT_LENGTH, request_size as u64)
20032                    .body(common::to_body(
20033                        request_value_reader.get_ref().clone().into(),
20034                    ));
20035
20036                client.request(request.unwrap()).await
20037            };
20038
20039            match req_result {
20040                Err(err) => {
20041                    if let common::Retry::After(d) = dlg.http_error(&err) {
20042                        sleep(d).await;
20043                        continue;
20044                    }
20045                    dlg.finished(false);
20046                    return Err(common::Error::HttpError(err));
20047                }
20048                Ok(res) => {
20049                    let (mut parts, body) = res.into_parts();
20050                    let mut body = common::Body::new(body);
20051                    if !parts.status.is_success() {
20052                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20053                        let error = serde_json::from_str(&common::to_string(&bytes));
20054                        let response = common::to_response(parts, bytes.into());
20055
20056                        if let common::Retry::After(d) =
20057                            dlg.http_failure(&response, error.as_ref().ok())
20058                        {
20059                            sleep(d).await;
20060                            continue;
20061                        }
20062
20063                        dlg.finished(false);
20064
20065                        return Err(match error {
20066                            Ok(value) => common::Error::BadRequest(value),
20067                            _ => common::Error::Failure(response),
20068                        });
20069                    }
20070                    let response = {
20071                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20072                        let encoded = common::to_string(&bytes);
20073                        match serde_json::from_str(&encoded) {
20074                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20075                            Err(error) => {
20076                                dlg.response_json_decode_error(&encoded, &error);
20077                                return Err(common::Error::JsonDecodeError(
20078                                    encoded.to_string(),
20079                                    error,
20080                                ));
20081                            }
20082                        }
20083                    };
20084
20085                    dlg.finished(true);
20086                    return Ok(response);
20087                }
20088            }
20089        }
20090    }
20091
20092    ///
20093    /// Sets the *request* property to the given value.
20094    ///
20095    /// Even though the property as already been set when instantiating this call,
20096    /// we provide this method for API completeness.
20097    pub fn request(mut self, new_value: Ad) -> AdInsertCall<'a, C> {
20098        self._request = new_value;
20099        self
20100    }
20101    /// User profile ID associated with this request.
20102    ///
20103    /// Sets the *profile id* path property to the given value.
20104    ///
20105    /// Even though the property as already been set when instantiating this call,
20106    /// we provide this method for API completeness.
20107    pub fn profile_id(mut self, new_value: i64) -> AdInsertCall<'a, C> {
20108        self._profile_id = new_value;
20109        self
20110    }
20111    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20112    /// while executing the actual API request.
20113    ///
20114    /// ````text
20115    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20116    /// ````
20117    ///
20118    /// Sets the *delegate* property to the given value.
20119    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AdInsertCall<'a, C> {
20120        self._delegate = Some(new_value);
20121        self
20122    }
20123
20124    /// Set any additional parameter of the query string used in the request.
20125    /// It should be used to set parameters which are not yet available through their own
20126    /// setters.
20127    ///
20128    /// Please note that this method must not be used to set any of the known parameters
20129    /// which have their own setter method. If done anyway, the request will fail.
20130    ///
20131    /// # Additional Parameters
20132    ///
20133    /// * *$.xgafv* (query-string) - V1 error format.
20134    /// * *access_token* (query-string) - OAuth access token.
20135    /// * *alt* (query-string) - Data format for response.
20136    /// * *callback* (query-string) - JSONP
20137    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20138    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
20139    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20140    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20141    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
20142    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20143    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20144    pub fn param<T>(mut self, name: T, value: T) -> AdInsertCall<'a, C>
20145    where
20146        T: AsRef<str>,
20147    {
20148        self._additional_params
20149            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20150        self
20151    }
20152
20153    /// Identifies the authorization scope for the method you are building.
20154    ///
20155    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20156    /// [`Scope::Dfatrafficking`].
20157    ///
20158    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20159    /// tokens for more than one scope.
20160    ///
20161    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20162    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20163    /// sufficient, a read-write scope will do as well.
20164    pub fn add_scope<St>(mut self, scope: St) -> AdInsertCall<'a, C>
20165    where
20166        St: AsRef<str>,
20167    {
20168        self._scopes.insert(String::from(scope.as_ref()));
20169        self
20170    }
20171    /// Identifies the authorization scope(s) for the method you are building.
20172    ///
20173    /// See [`Self::add_scope()`] for details.
20174    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdInsertCall<'a, C>
20175    where
20176        I: IntoIterator<Item = St>,
20177        St: AsRef<str>,
20178    {
20179        self._scopes
20180            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20181        self
20182    }
20183
20184    /// Removes all scopes, and no default scope will be used either.
20185    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20186    /// for details).
20187    pub fn clear_scopes(mut self) -> AdInsertCall<'a, C> {
20188        self._scopes.clear();
20189        self
20190    }
20191}
20192
20193/// Retrieves a list of ads, possibly filtered. This method supports paging.
20194///
20195/// A builder for the *list* method supported by a *ad* resource.
20196/// It is not used directly, but through a [`AdMethods`] instance.
20197///
20198/// # Example
20199///
20200/// Instantiate a resource method builder
20201///
20202/// ```test_harness,no_run
20203/// # extern crate hyper;
20204/// # extern crate hyper_rustls;
20205/// # extern crate google_dfareporting3d3 as dfareporting3d3;
20206/// # async fn dox() {
20207/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20208///
20209/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20210/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20211/// #     secret,
20212/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20213/// # ).build().await.unwrap();
20214///
20215/// # let client = hyper_util::client::legacy::Client::builder(
20216/// #     hyper_util::rt::TokioExecutor::new()
20217/// # )
20218/// # .build(
20219/// #     hyper_rustls::HttpsConnectorBuilder::new()
20220/// #         .with_native_roots()
20221/// #         .unwrap()
20222/// #         .https_or_http()
20223/// #         .enable_http1()
20224/// #         .build()
20225/// # );
20226/// # let mut hub = Dfareporting::new(client, auth);
20227/// // You can configure optional parameters by calling the respective setters at will, and
20228/// // execute the final call using `doit()`.
20229/// // Values shown here are possibly random and not representative !
20230/// let result = hub.ads().list(-99)
20231///              .add_type("duo")
20232///              .ssl_required(false)
20233///              .ssl_compliant(false)
20234///              .sort_order("invidunt")
20235///              .sort_field("Stet")
20236///              .add_size_ids(-76)
20237///              .search_string("elitr")
20238///              .add_remarketing_list_ids(-6)
20239///              .add_placement_ids(-29)
20240///              .page_token("no")
20241///              .overridden_event_tag_id(-100)
20242///              .max_results(-23)
20243///              .add_landing_page_ids(-59)
20244///              .add_ids(-46)
20245///              .dynamic_click_tracker(false)
20246///              .add_creative_optimization_configuration_ids(-31)
20247///              .add_creative_ids(-96)
20248///              .compatibility("amet.")
20249///              .add_campaign_ids(-30)
20250///              .add_audience_segment_ids(-9)
20251///              .archived(true)
20252///              .advertiser_id(-74)
20253///              .active(false)
20254///              .doit().await;
20255/// # }
20256/// ```
20257pub struct AdListCall<'a, C>
20258where
20259    C: 'a,
20260{
20261    hub: &'a Dfareporting<C>,
20262    _profile_id: i64,
20263    _type_: Vec<String>,
20264    _ssl_required: Option<bool>,
20265    _ssl_compliant: Option<bool>,
20266    _sort_order: Option<String>,
20267    _sort_field: Option<String>,
20268    _size_ids: Vec<i64>,
20269    _search_string: Option<String>,
20270    _remarketing_list_ids: Vec<i64>,
20271    _placement_ids: Vec<i64>,
20272    _page_token: Option<String>,
20273    _overridden_event_tag_id: Option<i64>,
20274    _max_results: Option<i32>,
20275    _landing_page_ids: Vec<i64>,
20276    _ids: Vec<i64>,
20277    _dynamic_click_tracker: Option<bool>,
20278    _creative_optimization_configuration_ids: Vec<i64>,
20279    _creative_ids: Vec<i64>,
20280    _compatibility: Option<String>,
20281    _campaign_ids: Vec<i64>,
20282    _audience_segment_ids: Vec<i64>,
20283    _archived: Option<bool>,
20284    _advertiser_id: Option<i64>,
20285    _active: Option<bool>,
20286    _delegate: Option<&'a mut dyn common::Delegate>,
20287    _additional_params: HashMap<String, String>,
20288    _scopes: BTreeSet<String>,
20289}
20290
20291impl<'a, C> common::CallBuilder for AdListCall<'a, C> {}
20292
20293impl<'a, C> AdListCall<'a, C>
20294where
20295    C: common::Connector,
20296{
20297    /// Perform the operation you have build so far.
20298    pub async fn doit(mut self) -> common::Result<(common::Response, AdsListResponse)> {
20299        use std::borrow::Cow;
20300        use std::io::{Read, Seek};
20301
20302        use common::{url::Params, ToParts};
20303        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20304
20305        let mut dd = common::DefaultDelegate;
20306        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20307        dlg.begin(common::MethodInfo {
20308            id: "dfareporting.ads.list",
20309            http_method: hyper::Method::GET,
20310        });
20311
20312        for &field in [
20313            "alt",
20314            "profileId",
20315            "type",
20316            "sslRequired",
20317            "sslCompliant",
20318            "sortOrder",
20319            "sortField",
20320            "sizeIds",
20321            "searchString",
20322            "remarketingListIds",
20323            "placementIds",
20324            "pageToken",
20325            "overriddenEventTagId",
20326            "maxResults",
20327            "landingPageIds",
20328            "ids",
20329            "dynamicClickTracker",
20330            "creativeOptimizationConfigurationIds",
20331            "creativeIds",
20332            "compatibility",
20333            "campaignIds",
20334            "audienceSegmentIds",
20335            "archived",
20336            "advertiserId",
20337            "active",
20338        ]
20339        .iter()
20340        {
20341            if self._additional_params.contains_key(field) {
20342                dlg.finished(false);
20343                return Err(common::Error::FieldClash(field));
20344            }
20345        }
20346
20347        let mut params = Params::with_capacity(26 + self._additional_params.len());
20348        params.push("profileId", self._profile_id.to_string());
20349        if !self._type_.is_empty() {
20350            for f in self._type_.iter() {
20351                params.push("type", f);
20352            }
20353        }
20354        if let Some(value) = self._ssl_required.as_ref() {
20355            params.push("sslRequired", value.to_string());
20356        }
20357        if let Some(value) = self._ssl_compliant.as_ref() {
20358            params.push("sslCompliant", value.to_string());
20359        }
20360        if let Some(value) = self._sort_order.as_ref() {
20361            params.push("sortOrder", value);
20362        }
20363        if let Some(value) = self._sort_field.as_ref() {
20364            params.push("sortField", value);
20365        }
20366        if !self._size_ids.is_empty() {
20367            for f in self._size_ids.iter() {
20368                params.push("sizeIds", f.to_string());
20369            }
20370        }
20371        if let Some(value) = self._search_string.as_ref() {
20372            params.push("searchString", value);
20373        }
20374        if !self._remarketing_list_ids.is_empty() {
20375            for f in self._remarketing_list_ids.iter() {
20376                params.push("remarketingListIds", f.to_string());
20377            }
20378        }
20379        if !self._placement_ids.is_empty() {
20380            for f in self._placement_ids.iter() {
20381                params.push("placementIds", f.to_string());
20382            }
20383        }
20384        if let Some(value) = self._page_token.as_ref() {
20385            params.push("pageToken", value);
20386        }
20387        if let Some(value) = self._overridden_event_tag_id.as_ref() {
20388            params.push("overriddenEventTagId", value.to_string());
20389        }
20390        if let Some(value) = self._max_results.as_ref() {
20391            params.push("maxResults", value.to_string());
20392        }
20393        if !self._landing_page_ids.is_empty() {
20394            for f in self._landing_page_ids.iter() {
20395                params.push("landingPageIds", f.to_string());
20396            }
20397        }
20398        if !self._ids.is_empty() {
20399            for f in self._ids.iter() {
20400                params.push("ids", f.to_string());
20401            }
20402        }
20403        if let Some(value) = self._dynamic_click_tracker.as_ref() {
20404            params.push("dynamicClickTracker", value.to_string());
20405        }
20406        if !self._creative_optimization_configuration_ids.is_empty() {
20407            for f in self._creative_optimization_configuration_ids.iter() {
20408                params.push("creativeOptimizationConfigurationIds", f.to_string());
20409            }
20410        }
20411        if !self._creative_ids.is_empty() {
20412            for f in self._creative_ids.iter() {
20413                params.push("creativeIds", f.to_string());
20414            }
20415        }
20416        if let Some(value) = self._compatibility.as_ref() {
20417            params.push("compatibility", value);
20418        }
20419        if !self._campaign_ids.is_empty() {
20420            for f in self._campaign_ids.iter() {
20421                params.push("campaignIds", f.to_string());
20422            }
20423        }
20424        if !self._audience_segment_ids.is_empty() {
20425            for f in self._audience_segment_ids.iter() {
20426                params.push("audienceSegmentIds", f.to_string());
20427            }
20428        }
20429        if let Some(value) = self._archived.as_ref() {
20430            params.push("archived", value.to_string());
20431        }
20432        if let Some(value) = self._advertiser_id.as_ref() {
20433            params.push("advertiserId", value.to_string());
20434        }
20435        if let Some(value) = self._active.as_ref() {
20436            params.push("active", value.to_string());
20437        }
20438
20439        params.extend(self._additional_params.iter());
20440
20441        params.push("alt", "json");
20442        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/ads";
20443        if self._scopes.is_empty() {
20444            self._scopes
20445                .insert(Scope::Dfatrafficking.as_ref().to_string());
20446        }
20447
20448        #[allow(clippy::single_element_loop)]
20449        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
20450            url = params.uri_replacement(url, param_name, find_this, false);
20451        }
20452        {
20453            let to_remove = ["profileId"];
20454            params.remove_params(&to_remove);
20455        }
20456
20457        let url = params.parse_with_url(&url);
20458
20459        loop {
20460            let token = match self
20461                .hub
20462                .auth
20463                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20464                .await
20465            {
20466                Ok(token) => token,
20467                Err(e) => match dlg.token(e) {
20468                    Ok(token) => token,
20469                    Err(e) => {
20470                        dlg.finished(false);
20471                        return Err(common::Error::MissingToken(e));
20472                    }
20473                },
20474            };
20475            let mut req_result = {
20476                let client = &self.hub.client;
20477                dlg.pre_request();
20478                let mut req_builder = hyper::Request::builder()
20479                    .method(hyper::Method::GET)
20480                    .uri(url.as_str())
20481                    .header(USER_AGENT, self.hub._user_agent.clone());
20482
20483                if let Some(token) = token.as_ref() {
20484                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20485                }
20486
20487                let request = req_builder
20488                    .header(CONTENT_LENGTH, 0_u64)
20489                    .body(common::to_body::<String>(None));
20490
20491                client.request(request.unwrap()).await
20492            };
20493
20494            match req_result {
20495                Err(err) => {
20496                    if let common::Retry::After(d) = dlg.http_error(&err) {
20497                        sleep(d).await;
20498                        continue;
20499                    }
20500                    dlg.finished(false);
20501                    return Err(common::Error::HttpError(err));
20502                }
20503                Ok(res) => {
20504                    let (mut parts, body) = res.into_parts();
20505                    let mut body = common::Body::new(body);
20506                    if !parts.status.is_success() {
20507                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20508                        let error = serde_json::from_str(&common::to_string(&bytes));
20509                        let response = common::to_response(parts, bytes.into());
20510
20511                        if let common::Retry::After(d) =
20512                            dlg.http_failure(&response, error.as_ref().ok())
20513                        {
20514                            sleep(d).await;
20515                            continue;
20516                        }
20517
20518                        dlg.finished(false);
20519
20520                        return Err(match error {
20521                            Ok(value) => common::Error::BadRequest(value),
20522                            _ => common::Error::Failure(response),
20523                        });
20524                    }
20525                    let response = {
20526                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20527                        let encoded = common::to_string(&bytes);
20528                        match serde_json::from_str(&encoded) {
20529                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20530                            Err(error) => {
20531                                dlg.response_json_decode_error(&encoded, &error);
20532                                return Err(common::Error::JsonDecodeError(
20533                                    encoded.to_string(),
20534                                    error,
20535                                ));
20536                            }
20537                        }
20538                    };
20539
20540                    dlg.finished(true);
20541                    return Ok(response);
20542                }
20543            }
20544        }
20545    }
20546
20547    /// User profile ID associated with this request.
20548    ///
20549    /// Sets the *profile id* path property to the given value.
20550    ///
20551    /// Even though the property as already been set when instantiating this call,
20552    /// we provide this method for API completeness.
20553    pub fn profile_id(mut self, new_value: i64) -> AdListCall<'a, C> {
20554        self._profile_id = new_value;
20555        self
20556    }
20557    /// Select only ads with these types.
20558    ///
20559    /// Append the given value to the *type* query property.
20560    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
20561    pub fn add_type(mut self, new_value: &str) -> AdListCall<'a, C> {
20562        self._type_.push(new_value.to_string());
20563        self
20564    }
20565    /// Select only ads that require SSL.
20566    ///
20567    /// Sets the *ssl required* query property to the given value.
20568    pub fn ssl_required(mut self, new_value: bool) -> AdListCall<'a, C> {
20569        self._ssl_required = Some(new_value);
20570        self
20571    }
20572    /// Select only ads that are SSL-compliant.
20573    ///
20574    /// Sets the *ssl compliant* query property to the given value.
20575    pub fn ssl_compliant(mut self, new_value: bool) -> AdListCall<'a, C> {
20576        self._ssl_compliant = Some(new_value);
20577        self
20578    }
20579    /// Order of sorted results.
20580    ///
20581    /// Sets the *sort order* query property to the given value.
20582    pub fn sort_order(mut self, new_value: &str) -> AdListCall<'a, C> {
20583        self._sort_order = Some(new_value.to_string());
20584        self
20585    }
20586    /// Field by which to sort the list.
20587    ///
20588    /// Sets the *sort field* query property to the given value.
20589    pub fn sort_field(mut self, new_value: &str) -> AdListCall<'a, C> {
20590        self._sort_field = Some(new_value.to_string());
20591        self
20592    }
20593    /// Select only ads with these size IDs.
20594    ///
20595    /// Append the given value to the *size ids* query property.
20596    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
20597    pub fn add_size_ids(mut self, new_value: i64) -> AdListCall<'a, C> {
20598        self._size_ids.push(new_value);
20599        self
20600    }
20601    /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "ad*2015" will return objects with names like "ad June 2015", "ad April 2015", or simply "ad 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "ad" will match objects with name "my ad", "ad 2015", or simply "ad".
20602    ///
20603    /// Sets the *search string* query property to the given value.
20604    pub fn search_string(mut self, new_value: &str) -> AdListCall<'a, C> {
20605        self._search_string = Some(new_value.to_string());
20606        self
20607    }
20608    /// Select only ads whose list targeting expression use these remarketing list IDs.
20609    ///
20610    /// Append the given value to the *remarketing list ids* query property.
20611    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
20612    pub fn add_remarketing_list_ids(mut self, new_value: i64) -> AdListCall<'a, C> {
20613        self._remarketing_list_ids.push(new_value);
20614        self
20615    }
20616    /// Select only ads with these placement IDs assigned.
20617    ///
20618    /// Append the given value to the *placement ids* query property.
20619    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
20620    pub fn add_placement_ids(mut self, new_value: i64) -> AdListCall<'a, C> {
20621        self._placement_ids.push(new_value);
20622        self
20623    }
20624    /// Value of the nextPageToken from the previous result page.
20625    ///
20626    /// Sets the *page token* query property to the given value.
20627    pub fn page_token(mut self, new_value: &str) -> AdListCall<'a, C> {
20628        self._page_token = Some(new_value.to_string());
20629        self
20630    }
20631    /// Select only ads with this event tag override ID.
20632    ///
20633    /// Sets the *overridden event tag id* query property to the given value.
20634    pub fn overridden_event_tag_id(mut self, new_value: i64) -> AdListCall<'a, C> {
20635        self._overridden_event_tag_id = Some(new_value);
20636        self
20637    }
20638    /// Maximum number of results to return.
20639    ///
20640    /// Sets the *max results* query property to the given value.
20641    pub fn max_results(mut self, new_value: i32) -> AdListCall<'a, C> {
20642        self._max_results = Some(new_value);
20643        self
20644    }
20645    /// Select only ads with these landing page IDs.
20646    ///
20647    /// Append the given value to the *landing page ids* query property.
20648    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
20649    pub fn add_landing_page_ids(mut self, new_value: i64) -> AdListCall<'a, C> {
20650        self._landing_page_ids.push(new_value);
20651        self
20652    }
20653    /// Select only ads with these IDs.
20654    ///
20655    /// Append the given value to the *ids* query property.
20656    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
20657    pub fn add_ids(mut self, new_value: i64) -> AdListCall<'a, C> {
20658        self._ids.push(new_value);
20659        self
20660    }
20661    /// Select only dynamic click trackers. Applicable when type is AD_SERVING_CLICK_TRACKER. If true, select dynamic click trackers. If false, select static click trackers. Leave unset to select both.
20662    ///
20663    /// Sets the *dynamic click tracker* query property to the given value.
20664    pub fn dynamic_click_tracker(mut self, new_value: bool) -> AdListCall<'a, C> {
20665        self._dynamic_click_tracker = Some(new_value);
20666        self
20667    }
20668    /// Select only ads with these creative optimization configuration IDs.
20669    ///
20670    /// Append the given value to the *creative optimization configuration ids* query property.
20671    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
20672    pub fn add_creative_optimization_configuration_ids(
20673        mut self,
20674        new_value: i64,
20675    ) -> AdListCall<'a, C> {
20676        self._creative_optimization_configuration_ids
20677            .push(new_value);
20678        self
20679    }
20680    /// Select only ads with these creative IDs assigned.
20681    ///
20682    /// Append the given value to the *creative ids* query property.
20683    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
20684    pub fn add_creative_ids(mut self, new_value: i64) -> AdListCall<'a, C> {
20685        self._creative_ids.push(new_value);
20686        self
20687    }
20688    /// Select default ads with the specified compatibility. Applicable when type is AD_SERVING_DEFAULT_AD. DISPLAY and DISPLAY_INTERSTITIAL refer to rendering either on desktop or on mobile devices for regular or interstitial ads, respectively. APP and APP_INTERSTITIAL are for rendering in mobile apps. IN_STREAM_VIDEO refers to rendering an in-stream video ads developed with the VAST standard.
20689    ///
20690    /// Sets the *compatibility* query property to the given value.
20691    pub fn compatibility(mut self, new_value: &str) -> AdListCall<'a, C> {
20692        self._compatibility = Some(new_value.to_string());
20693        self
20694    }
20695    /// Select only ads with these campaign IDs.
20696    ///
20697    /// Append the given value to the *campaign ids* query property.
20698    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
20699    pub fn add_campaign_ids(mut self, new_value: i64) -> AdListCall<'a, C> {
20700        self._campaign_ids.push(new_value);
20701        self
20702    }
20703    /// Select only ads with these audience segment IDs.
20704    ///
20705    /// Append the given value to the *audience segment ids* query property.
20706    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
20707    pub fn add_audience_segment_ids(mut self, new_value: i64) -> AdListCall<'a, C> {
20708        self._audience_segment_ids.push(new_value);
20709        self
20710    }
20711    /// Select only archived ads.
20712    ///
20713    /// Sets the *archived* query property to the given value.
20714    pub fn archived(mut self, new_value: bool) -> AdListCall<'a, C> {
20715        self._archived = Some(new_value);
20716        self
20717    }
20718    /// Select only ads with this advertiser ID.
20719    ///
20720    /// Sets the *advertiser id* query property to the given value.
20721    pub fn advertiser_id(mut self, new_value: i64) -> AdListCall<'a, C> {
20722        self._advertiser_id = Some(new_value);
20723        self
20724    }
20725    /// Select only active ads.
20726    ///
20727    /// Sets the *active* query property to the given value.
20728    pub fn active(mut self, new_value: bool) -> AdListCall<'a, C> {
20729        self._active = Some(new_value);
20730        self
20731    }
20732    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20733    /// while executing the actual API request.
20734    ///
20735    /// ````text
20736    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20737    /// ````
20738    ///
20739    /// Sets the *delegate* property to the given value.
20740    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AdListCall<'a, C> {
20741        self._delegate = Some(new_value);
20742        self
20743    }
20744
20745    /// Set any additional parameter of the query string used in the request.
20746    /// It should be used to set parameters which are not yet available through their own
20747    /// setters.
20748    ///
20749    /// Please note that this method must not be used to set any of the known parameters
20750    /// which have their own setter method. If done anyway, the request will fail.
20751    ///
20752    /// # Additional Parameters
20753    ///
20754    /// * *$.xgafv* (query-string) - V1 error format.
20755    /// * *access_token* (query-string) - OAuth access token.
20756    /// * *alt* (query-string) - Data format for response.
20757    /// * *callback* (query-string) - JSONP
20758    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20759    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
20760    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20761    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20762    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
20763    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20764    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20765    pub fn param<T>(mut self, name: T, value: T) -> AdListCall<'a, C>
20766    where
20767        T: AsRef<str>,
20768    {
20769        self._additional_params
20770            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20771        self
20772    }
20773
20774    /// Identifies the authorization scope for the method you are building.
20775    ///
20776    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20777    /// [`Scope::Dfatrafficking`].
20778    ///
20779    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20780    /// tokens for more than one scope.
20781    ///
20782    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20783    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20784    /// sufficient, a read-write scope will do as well.
20785    pub fn add_scope<St>(mut self, scope: St) -> AdListCall<'a, C>
20786    where
20787        St: AsRef<str>,
20788    {
20789        self._scopes.insert(String::from(scope.as_ref()));
20790        self
20791    }
20792    /// Identifies the authorization scope(s) for the method you are building.
20793    ///
20794    /// See [`Self::add_scope()`] for details.
20795    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdListCall<'a, C>
20796    where
20797        I: IntoIterator<Item = St>,
20798        St: AsRef<str>,
20799    {
20800        self._scopes
20801            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20802        self
20803    }
20804
20805    /// Removes all scopes, and no default scope will be used either.
20806    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20807    /// for details).
20808    pub fn clear_scopes(mut self) -> AdListCall<'a, C> {
20809        self._scopes.clear();
20810        self
20811    }
20812}
20813
20814/// Updates an existing ad. This method supports patch semantics.
20815///
20816/// A builder for the *patch* method supported by a *ad* resource.
20817/// It is not used directly, but through a [`AdMethods`] instance.
20818///
20819/// # Example
20820///
20821/// Instantiate a resource method builder
20822///
20823/// ```test_harness,no_run
20824/// # extern crate hyper;
20825/// # extern crate hyper_rustls;
20826/// # extern crate google_dfareporting3d3 as dfareporting3d3;
20827/// use dfareporting3d3::api::Ad;
20828/// # async fn dox() {
20829/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20830///
20831/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20832/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20833/// #     secret,
20834/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20835/// # ).build().await.unwrap();
20836///
20837/// # let client = hyper_util::client::legacy::Client::builder(
20838/// #     hyper_util::rt::TokioExecutor::new()
20839/// # )
20840/// # .build(
20841/// #     hyper_rustls::HttpsConnectorBuilder::new()
20842/// #         .with_native_roots()
20843/// #         .unwrap()
20844/// #         .https_or_http()
20845/// #         .enable_http1()
20846/// #         .build()
20847/// # );
20848/// # let mut hub = Dfareporting::new(client, auth);
20849/// // As the method needs a request, you would usually fill it with the desired information
20850/// // into the respective structure. Some of the parts shown here might not be applicable !
20851/// // Values shown here are possibly random and not representative !
20852/// let mut req = Ad::default();
20853///
20854/// // You can configure optional parameters by calling the respective setters at will, and
20855/// // execute the final call using `doit()`.
20856/// // Values shown here are possibly random and not representative !
20857/// let result = hub.ads().patch(req, -34, -34)
20858///              .doit().await;
20859/// # }
20860/// ```
20861pub struct AdPatchCall<'a, C>
20862where
20863    C: 'a,
20864{
20865    hub: &'a Dfareporting<C>,
20866    _request: Ad,
20867    _profile_id: i64,
20868    _id: i64,
20869    _delegate: Option<&'a mut dyn common::Delegate>,
20870    _additional_params: HashMap<String, String>,
20871    _scopes: BTreeSet<String>,
20872}
20873
20874impl<'a, C> common::CallBuilder for AdPatchCall<'a, C> {}
20875
20876impl<'a, C> AdPatchCall<'a, C>
20877where
20878    C: common::Connector,
20879{
20880    /// Perform the operation you have build so far.
20881    pub async fn doit(mut self) -> common::Result<(common::Response, Ad)> {
20882        use std::borrow::Cow;
20883        use std::io::{Read, Seek};
20884
20885        use common::{url::Params, ToParts};
20886        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20887
20888        let mut dd = common::DefaultDelegate;
20889        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20890        dlg.begin(common::MethodInfo {
20891            id: "dfareporting.ads.patch",
20892            http_method: hyper::Method::PATCH,
20893        });
20894
20895        for &field in ["alt", "profileId", "id"].iter() {
20896            if self._additional_params.contains_key(field) {
20897                dlg.finished(false);
20898                return Err(common::Error::FieldClash(field));
20899            }
20900        }
20901
20902        let mut params = Params::with_capacity(5 + self._additional_params.len());
20903        params.push("profileId", self._profile_id.to_string());
20904        params.push("id", self._id.to_string());
20905
20906        params.extend(self._additional_params.iter());
20907
20908        params.push("alt", "json");
20909        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/ads";
20910        if self._scopes.is_empty() {
20911            self._scopes
20912                .insert(Scope::Dfatrafficking.as_ref().to_string());
20913        }
20914
20915        #[allow(clippy::single_element_loop)]
20916        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
20917            url = params.uri_replacement(url, param_name, find_this, false);
20918        }
20919        {
20920            let to_remove = ["profileId"];
20921            params.remove_params(&to_remove);
20922        }
20923
20924        let url = params.parse_with_url(&url);
20925
20926        let mut json_mime_type = mime::APPLICATION_JSON;
20927        let mut request_value_reader = {
20928            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20929            common::remove_json_null_values(&mut value);
20930            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20931            serde_json::to_writer(&mut dst, &value).unwrap();
20932            dst
20933        };
20934        let request_size = request_value_reader
20935            .seek(std::io::SeekFrom::End(0))
20936            .unwrap();
20937        request_value_reader
20938            .seek(std::io::SeekFrom::Start(0))
20939            .unwrap();
20940
20941        loop {
20942            let token = match self
20943                .hub
20944                .auth
20945                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20946                .await
20947            {
20948                Ok(token) => token,
20949                Err(e) => match dlg.token(e) {
20950                    Ok(token) => token,
20951                    Err(e) => {
20952                        dlg.finished(false);
20953                        return Err(common::Error::MissingToken(e));
20954                    }
20955                },
20956            };
20957            request_value_reader
20958                .seek(std::io::SeekFrom::Start(0))
20959                .unwrap();
20960            let mut req_result = {
20961                let client = &self.hub.client;
20962                dlg.pre_request();
20963                let mut req_builder = hyper::Request::builder()
20964                    .method(hyper::Method::PATCH)
20965                    .uri(url.as_str())
20966                    .header(USER_AGENT, self.hub._user_agent.clone());
20967
20968                if let Some(token) = token.as_ref() {
20969                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20970                }
20971
20972                let request = req_builder
20973                    .header(CONTENT_TYPE, json_mime_type.to_string())
20974                    .header(CONTENT_LENGTH, request_size as u64)
20975                    .body(common::to_body(
20976                        request_value_reader.get_ref().clone().into(),
20977                    ));
20978
20979                client.request(request.unwrap()).await
20980            };
20981
20982            match req_result {
20983                Err(err) => {
20984                    if let common::Retry::After(d) = dlg.http_error(&err) {
20985                        sleep(d).await;
20986                        continue;
20987                    }
20988                    dlg.finished(false);
20989                    return Err(common::Error::HttpError(err));
20990                }
20991                Ok(res) => {
20992                    let (mut parts, body) = res.into_parts();
20993                    let mut body = common::Body::new(body);
20994                    if !parts.status.is_success() {
20995                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20996                        let error = serde_json::from_str(&common::to_string(&bytes));
20997                        let response = common::to_response(parts, bytes.into());
20998
20999                        if let common::Retry::After(d) =
21000                            dlg.http_failure(&response, error.as_ref().ok())
21001                        {
21002                            sleep(d).await;
21003                            continue;
21004                        }
21005
21006                        dlg.finished(false);
21007
21008                        return Err(match error {
21009                            Ok(value) => common::Error::BadRequest(value),
21010                            _ => common::Error::Failure(response),
21011                        });
21012                    }
21013                    let response = {
21014                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21015                        let encoded = common::to_string(&bytes);
21016                        match serde_json::from_str(&encoded) {
21017                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21018                            Err(error) => {
21019                                dlg.response_json_decode_error(&encoded, &error);
21020                                return Err(common::Error::JsonDecodeError(
21021                                    encoded.to_string(),
21022                                    error,
21023                                ));
21024                            }
21025                        }
21026                    };
21027
21028                    dlg.finished(true);
21029                    return Ok(response);
21030                }
21031            }
21032        }
21033    }
21034
21035    ///
21036    /// Sets the *request* property to the given value.
21037    ///
21038    /// Even though the property as already been set when instantiating this call,
21039    /// we provide this method for API completeness.
21040    pub fn request(mut self, new_value: Ad) -> AdPatchCall<'a, C> {
21041        self._request = new_value;
21042        self
21043    }
21044    /// User profile ID associated with this request.
21045    ///
21046    /// Sets the *profile id* path property to the given value.
21047    ///
21048    /// Even though the property as already been set when instantiating this call,
21049    /// we provide this method for API completeness.
21050    pub fn profile_id(mut self, new_value: i64) -> AdPatchCall<'a, C> {
21051        self._profile_id = new_value;
21052        self
21053    }
21054    /// Ad ID.
21055    ///
21056    /// Sets the *id* query property to the given value.
21057    ///
21058    /// Even though the property as already been set when instantiating this call,
21059    /// we provide this method for API completeness.
21060    pub fn id(mut self, new_value: i64) -> AdPatchCall<'a, C> {
21061        self._id = new_value;
21062        self
21063    }
21064    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21065    /// while executing the actual API request.
21066    ///
21067    /// ````text
21068    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21069    /// ````
21070    ///
21071    /// Sets the *delegate* property to the given value.
21072    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AdPatchCall<'a, C> {
21073        self._delegate = Some(new_value);
21074        self
21075    }
21076
21077    /// Set any additional parameter of the query string used in the request.
21078    /// It should be used to set parameters which are not yet available through their own
21079    /// setters.
21080    ///
21081    /// Please note that this method must not be used to set any of the known parameters
21082    /// which have their own setter method. If done anyway, the request will fail.
21083    ///
21084    /// # Additional Parameters
21085    ///
21086    /// * *$.xgafv* (query-string) - V1 error format.
21087    /// * *access_token* (query-string) - OAuth access token.
21088    /// * *alt* (query-string) - Data format for response.
21089    /// * *callback* (query-string) - JSONP
21090    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21091    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21092    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21093    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21094    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21095    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21096    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21097    pub fn param<T>(mut self, name: T, value: T) -> AdPatchCall<'a, C>
21098    where
21099        T: AsRef<str>,
21100    {
21101        self._additional_params
21102            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21103        self
21104    }
21105
21106    /// Identifies the authorization scope for the method you are building.
21107    ///
21108    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21109    /// [`Scope::Dfatrafficking`].
21110    ///
21111    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21112    /// tokens for more than one scope.
21113    ///
21114    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21115    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21116    /// sufficient, a read-write scope will do as well.
21117    pub fn add_scope<St>(mut self, scope: St) -> AdPatchCall<'a, C>
21118    where
21119        St: AsRef<str>,
21120    {
21121        self._scopes.insert(String::from(scope.as_ref()));
21122        self
21123    }
21124    /// Identifies the authorization scope(s) for the method you are building.
21125    ///
21126    /// See [`Self::add_scope()`] for details.
21127    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdPatchCall<'a, C>
21128    where
21129        I: IntoIterator<Item = St>,
21130        St: AsRef<str>,
21131    {
21132        self._scopes
21133            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21134        self
21135    }
21136
21137    /// Removes all scopes, and no default scope will be used either.
21138    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21139    /// for details).
21140    pub fn clear_scopes(mut self) -> AdPatchCall<'a, C> {
21141        self._scopes.clear();
21142        self
21143    }
21144}
21145
21146/// Updates an existing ad.
21147///
21148/// A builder for the *update* method supported by a *ad* resource.
21149/// It is not used directly, but through a [`AdMethods`] instance.
21150///
21151/// # Example
21152///
21153/// Instantiate a resource method builder
21154///
21155/// ```test_harness,no_run
21156/// # extern crate hyper;
21157/// # extern crate hyper_rustls;
21158/// # extern crate google_dfareporting3d3 as dfareporting3d3;
21159/// use dfareporting3d3::api::Ad;
21160/// # async fn dox() {
21161/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21162///
21163/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21164/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21165/// #     secret,
21166/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21167/// # ).build().await.unwrap();
21168///
21169/// # let client = hyper_util::client::legacy::Client::builder(
21170/// #     hyper_util::rt::TokioExecutor::new()
21171/// # )
21172/// # .build(
21173/// #     hyper_rustls::HttpsConnectorBuilder::new()
21174/// #         .with_native_roots()
21175/// #         .unwrap()
21176/// #         .https_or_http()
21177/// #         .enable_http1()
21178/// #         .build()
21179/// # );
21180/// # let mut hub = Dfareporting::new(client, auth);
21181/// // As the method needs a request, you would usually fill it with the desired information
21182/// // into the respective structure. Some of the parts shown here might not be applicable !
21183/// // Values shown here are possibly random and not representative !
21184/// let mut req = Ad::default();
21185///
21186/// // You can configure optional parameters by calling the respective setters at will, and
21187/// // execute the final call using `doit()`.
21188/// // Values shown here are possibly random and not representative !
21189/// let result = hub.ads().update(req, -34)
21190///              .doit().await;
21191/// # }
21192/// ```
21193pub struct AdUpdateCall<'a, C>
21194where
21195    C: 'a,
21196{
21197    hub: &'a Dfareporting<C>,
21198    _request: Ad,
21199    _profile_id: i64,
21200    _delegate: Option<&'a mut dyn common::Delegate>,
21201    _additional_params: HashMap<String, String>,
21202    _scopes: BTreeSet<String>,
21203}
21204
21205impl<'a, C> common::CallBuilder for AdUpdateCall<'a, C> {}
21206
21207impl<'a, C> AdUpdateCall<'a, C>
21208where
21209    C: common::Connector,
21210{
21211    /// Perform the operation you have build so far.
21212    pub async fn doit(mut self) -> common::Result<(common::Response, Ad)> {
21213        use std::borrow::Cow;
21214        use std::io::{Read, Seek};
21215
21216        use common::{url::Params, ToParts};
21217        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21218
21219        let mut dd = common::DefaultDelegate;
21220        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21221        dlg.begin(common::MethodInfo {
21222            id: "dfareporting.ads.update",
21223            http_method: hyper::Method::PUT,
21224        });
21225
21226        for &field in ["alt", "profileId"].iter() {
21227            if self._additional_params.contains_key(field) {
21228                dlg.finished(false);
21229                return Err(common::Error::FieldClash(field));
21230            }
21231        }
21232
21233        let mut params = Params::with_capacity(4 + self._additional_params.len());
21234        params.push("profileId", self._profile_id.to_string());
21235
21236        params.extend(self._additional_params.iter());
21237
21238        params.push("alt", "json");
21239        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/ads";
21240        if self._scopes.is_empty() {
21241            self._scopes
21242                .insert(Scope::Dfatrafficking.as_ref().to_string());
21243        }
21244
21245        #[allow(clippy::single_element_loop)]
21246        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
21247            url = params.uri_replacement(url, param_name, find_this, false);
21248        }
21249        {
21250            let to_remove = ["profileId"];
21251            params.remove_params(&to_remove);
21252        }
21253
21254        let url = params.parse_with_url(&url);
21255
21256        let mut json_mime_type = mime::APPLICATION_JSON;
21257        let mut request_value_reader = {
21258            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21259            common::remove_json_null_values(&mut value);
21260            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21261            serde_json::to_writer(&mut dst, &value).unwrap();
21262            dst
21263        };
21264        let request_size = request_value_reader
21265            .seek(std::io::SeekFrom::End(0))
21266            .unwrap();
21267        request_value_reader
21268            .seek(std::io::SeekFrom::Start(0))
21269            .unwrap();
21270
21271        loop {
21272            let token = match self
21273                .hub
21274                .auth
21275                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21276                .await
21277            {
21278                Ok(token) => token,
21279                Err(e) => match dlg.token(e) {
21280                    Ok(token) => token,
21281                    Err(e) => {
21282                        dlg.finished(false);
21283                        return Err(common::Error::MissingToken(e));
21284                    }
21285                },
21286            };
21287            request_value_reader
21288                .seek(std::io::SeekFrom::Start(0))
21289                .unwrap();
21290            let mut req_result = {
21291                let client = &self.hub.client;
21292                dlg.pre_request();
21293                let mut req_builder = hyper::Request::builder()
21294                    .method(hyper::Method::PUT)
21295                    .uri(url.as_str())
21296                    .header(USER_AGENT, self.hub._user_agent.clone());
21297
21298                if let Some(token) = token.as_ref() {
21299                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21300                }
21301
21302                let request = req_builder
21303                    .header(CONTENT_TYPE, json_mime_type.to_string())
21304                    .header(CONTENT_LENGTH, request_size as u64)
21305                    .body(common::to_body(
21306                        request_value_reader.get_ref().clone().into(),
21307                    ));
21308
21309                client.request(request.unwrap()).await
21310            };
21311
21312            match req_result {
21313                Err(err) => {
21314                    if let common::Retry::After(d) = dlg.http_error(&err) {
21315                        sleep(d).await;
21316                        continue;
21317                    }
21318                    dlg.finished(false);
21319                    return Err(common::Error::HttpError(err));
21320                }
21321                Ok(res) => {
21322                    let (mut parts, body) = res.into_parts();
21323                    let mut body = common::Body::new(body);
21324                    if !parts.status.is_success() {
21325                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21326                        let error = serde_json::from_str(&common::to_string(&bytes));
21327                        let response = common::to_response(parts, bytes.into());
21328
21329                        if let common::Retry::After(d) =
21330                            dlg.http_failure(&response, error.as_ref().ok())
21331                        {
21332                            sleep(d).await;
21333                            continue;
21334                        }
21335
21336                        dlg.finished(false);
21337
21338                        return Err(match error {
21339                            Ok(value) => common::Error::BadRequest(value),
21340                            _ => common::Error::Failure(response),
21341                        });
21342                    }
21343                    let response = {
21344                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21345                        let encoded = common::to_string(&bytes);
21346                        match serde_json::from_str(&encoded) {
21347                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21348                            Err(error) => {
21349                                dlg.response_json_decode_error(&encoded, &error);
21350                                return Err(common::Error::JsonDecodeError(
21351                                    encoded.to_string(),
21352                                    error,
21353                                ));
21354                            }
21355                        }
21356                    };
21357
21358                    dlg.finished(true);
21359                    return Ok(response);
21360                }
21361            }
21362        }
21363    }
21364
21365    ///
21366    /// Sets the *request* property to the given value.
21367    ///
21368    /// Even though the property as already been set when instantiating this call,
21369    /// we provide this method for API completeness.
21370    pub fn request(mut self, new_value: Ad) -> AdUpdateCall<'a, C> {
21371        self._request = new_value;
21372        self
21373    }
21374    /// User profile ID associated with this request.
21375    ///
21376    /// Sets the *profile id* path property to the given value.
21377    ///
21378    /// Even though the property as already been set when instantiating this call,
21379    /// we provide this method for API completeness.
21380    pub fn profile_id(mut self, new_value: i64) -> AdUpdateCall<'a, C> {
21381        self._profile_id = new_value;
21382        self
21383    }
21384    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21385    /// while executing the actual API request.
21386    ///
21387    /// ````text
21388    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21389    /// ````
21390    ///
21391    /// Sets the *delegate* property to the given value.
21392    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AdUpdateCall<'a, C> {
21393        self._delegate = Some(new_value);
21394        self
21395    }
21396
21397    /// Set any additional parameter of the query string used in the request.
21398    /// It should be used to set parameters which are not yet available through their own
21399    /// setters.
21400    ///
21401    /// Please note that this method must not be used to set any of the known parameters
21402    /// which have their own setter method. If done anyway, the request will fail.
21403    ///
21404    /// # Additional Parameters
21405    ///
21406    /// * *$.xgafv* (query-string) - V1 error format.
21407    /// * *access_token* (query-string) - OAuth access token.
21408    /// * *alt* (query-string) - Data format for response.
21409    /// * *callback* (query-string) - JSONP
21410    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21411    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21412    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21413    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21414    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21415    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21416    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21417    pub fn param<T>(mut self, name: T, value: T) -> AdUpdateCall<'a, C>
21418    where
21419        T: AsRef<str>,
21420    {
21421        self._additional_params
21422            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21423        self
21424    }
21425
21426    /// Identifies the authorization scope for the method you are building.
21427    ///
21428    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21429    /// [`Scope::Dfatrafficking`].
21430    ///
21431    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21432    /// tokens for more than one scope.
21433    ///
21434    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21435    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21436    /// sufficient, a read-write scope will do as well.
21437    pub fn add_scope<St>(mut self, scope: St) -> AdUpdateCall<'a, C>
21438    where
21439        St: AsRef<str>,
21440    {
21441        self._scopes.insert(String::from(scope.as_ref()));
21442        self
21443    }
21444    /// Identifies the authorization scope(s) for the method you are building.
21445    ///
21446    /// See [`Self::add_scope()`] for details.
21447    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdUpdateCall<'a, C>
21448    where
21449        I: IntoIterator<Item = St>,
21450        St: AsRef<str>,
21451    {
21452        self._scopes
21453            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21454        self
21455    }
21456
21457    /// Removes all scopes, and no default scope will be used either.
21458    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21459    /// for details).
21460    pub fn clear_scopes(mut self) -> AdUpdateCall<'a, C> {
21461        self._scopes.clear();
21462        self
21463    }
21464}
21465
21466/// Deletes an existing advertiser group.
21467///
21468/// A builder for the *delete* method supported by a *advertiserGroup* resource.
21469/// It is not used directly, but through a [`AdvertiserGroupMethods`] instance.
21470///
21471/// # Example
21472///
21473/// Instantiate a resource method builder
21474///
21475/// ```test_harness,no_run
21476/// # extern crate hyper;
21477/// # extern crate hyper_rustls;
21478/// # extern crate google_dfareporting3d3 as dfareporting3d3;
21479/// # async fn dox() {
21480/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21481///
21482/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21483/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21484/// #     secret,
21485/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21486/// # ).build().await.unwrap();
21487///
21488/// # let client = hyper_util::client::legacy::Client::builder(
21489/// #     hyper_util::rt::TokioExecutor::new()
21490/// # )
21491/// # .build(
21492/// #     hyper_rustls::HttpsConnectorBuilder::new()
21493/// #         .with_native_roots()
21494/// #         .unwrap()
21495/// #         .https_or_http()
21496/// #         .enable_http1()
21497/// #         .build()
21498/// # );
21499/// # let mut hub = Dfareporting::new(client, auth);
21500/// // You can configure optional parameters by calling the respective setters at will, and
21501/// // execute the final call using `doit()`.
21502/// // Values shown here are possibly random and not representative !
21503/// let result = hub.advertiser_groups().delete(-78, -2)
21504///              .doit().await;
21505/// # }
21506/// ```
21507pub struct AdvertiserGroupDeleteCall<'a, C>
21508where
21509    C: 'a,
21510{
21511    hub: &'a Dfareporting<C>,
21512    _profile_id: i64,
21513    _id: i64,
21514    _delegate: Option<&'a mut dyn common::Delegate>,
21515    _additional_params: HashMap<String, String>,
21516    _scopes: BTreeSet<String>,
21517}
21518
21519impl<'a, C> common::CallBuilder for AdvertiserGroupDeleteCall<'a, C> {}
21520
21521impl<'a, C> AdvertiserGroupDeleteCall<'a, C>
21522where
21523    C: common::Connector,
21524{
21525    /// Perform the operation you have build so far.
21526    pub async fn doit(mut self) -> common::Result<common::Response> {
21527        use std::borrow::Cow;
21528        use std::io::{Read, Seek};
21529
21530        use common::{url::Params, ToParts};
21531        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21532
21533        let mut dd = common::DefaultDelegate;
21534        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21535        dlg.begin(common::MethodInfo {
21536            id: "dfareporting.advertiserGroups.delete",
21537            http_method: hyper::Method::DELETE,
21538        });
21539
21540        for &field in ["profileId", "id"].iter() {
21541            if self._additional_params.contains_key(field) {
21542                dlg.finished(false);
21543                return Err(common::Error::FieldClash(field));
21544            }
21545        }
21546
21547        let mut params = Params::with_capacity(3 + self._additional_params.len());
21548        params.push("profileId", self._profile_id.to_string());
21549        params.push("id", self._id.to_string());
21550
21551        params.extend(self._additional_params.iter());
21552
21553        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/advertiserGroups/{id}";
21554        if self._scopes.is_empty() {
21555            self._scopes
21556                .insert(Scope::Dfatrafficking.as_ref().to_string());
21557        }
21558
21559        #[allow(clippy::single_element_loop)]
21560        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
21561            url = params.uri_replacement(url, param_name, find_this, false);
21562        }
21563        {
21564            let to_remove = ["id", "profileId"];
21565            params.remove_params(&to_remove);
21566        }
21567
21568        let url = params.parse_with_url(&url);
21569
21570        loop {
21571            let token = match self
21572                .hub
21573                .auth
21574                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21575                .await
21576            {
21577                Ok(token) => token,
21578                Err(e) => match dlg.token(e) {
21579                    Ok(token) => token,
21580                    Err(e) => {
21581                        dlg.finished(false);
21582                        return Err(common::Error::MissingToken(e));
21583                    }
21584                },
21585            };
21586            let mut req_result = {
21587                let client = &self.hub.client;
21588                dlg.pre_request();
21589                let mut req_builder = hyper::Request::builder()
21590                    .method(hyper::Method::DELETE)
21591                    .uri(url.as_str())
21592                    .header(USER_AGENT, self.hub._user_agent.clone());
21593
21594                if let Some(token) = token.as_ref() {
21595                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21596                }
21597
21598                let request = req_builder
21599                    .header(CONTENT_LENGTH, 0_u64)
21600                    .body(common::to_body::<String>(None));
21601
21602                client.request(request.unwrap()).await
21603            };
21604
21605            match req_result {
21606                Err(err) => {
21607                    if let common::Retry::After(d) = dlg.http_error(&err) {
21608                        sleep(d).await;
21609                        continue;
21610                    }
21611                    dlg.finished(false);
21612                    return Err(common::Error::HttpError(err));
21613                }
21614                Ok(res) => {
21615                    let (mut parts, body) = res.into_parts();
21616                    let mut body = common::Body::new(body);
21617                    if !parts.status.is_success() {
21618                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21619                        let error = serde_json::from_str(&common::to_string(&bytes));
21620                        let response = common::to_response(parts, bytes.into());
21621
21622                        if let common::Retry::After(d) =
21623                            dlg.http_failure(&response, error.as_ref().ok())
21624                        {
21625                            sleep(d).await;
21626                            continue;
21627                        }
21628
21629                        dlg.finished(false);
21630
21631                        return Err(match error {
21632                            Ok(value) => common::Error::BadRequest(value),
21633                            _ => common::Error::Failure(response),
21634                        });
21635                    }
21636                    let response = common::Response::from_parts(parts, body);
21637
21638                    dlg.finished(true);
21639                    return Ok(response);
21640                }
21641            }
21642        }
21643    }
21644
21645    /// User profile ID associated with this request.
21646    ///
21647    /// Sets the *profile id* path property to the given value.
21648    ///
21649    /// Even though the property as already been set when instantiating this call,
21650    /// we provide this method for API completeness.
21651    pub fn profile_id(mut self, new_value: i64) -> AdvertiserGroupDeleteCall<'a, C> {
21652        self._profile_id = new_value;
21653        self
21654    }
21655    /// Advertiser group ID.
21656    ///
21657    /// Sets the *id* path property to the given value.
21658    ///
21659    /// Even though the property as already been set when instantiating this call,
21660    /// we provide this method for API completeness.
21661    pub fn id(mut self, new_value: i64) -> AdvertiserGroupDeleteCall<'a, C> {
21662        self._id = new_value;
21663        self
21664    }
21665    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21666    /// while executing the actual API request.
21667    ///
21668    /// ````text
21669    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21670    /// ````
21671    ///
21672    /// Sets the *delegate* property to the given value.
21673    pub fn delegate(
21674        mut self,
21675        new_value: &'a mut dyn common::Delegate,
21676    ) -> AdvertiserGroupDeleteCall<'a, C> {
21677        self._delegate = Some(new_value);
21678        self
21679    }
21680
21681    /// Set any additional parameter of the query string used in the request.
21682    /// It should be used to set parameters which are not yet available through their own
21683    /// setters.
21684    ///
21685    /// Please note that this method must not be used to set any of the known parameters
21686    /// which have their own setter method. If done anyway, the request will fail.
21687    ///
21688    /// # Additional Parameters
21689    ///
21690    /// * *$.xgafv* (query-string) - V1 error format.
21691    /// * *access_token* (query-string) - OAuth access token.
21692    /// * *alt* (query-string) - Data format for response.
21693    /// * *callback* (query-string) - JSONP
21694    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21695    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21696    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21697    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21698    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21699    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21700    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21701    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserGroupDeleteCall<'a, C>
21702    where
21703        T: AsRef<str>,
21704    {
21705        self._additional_params
21706            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21707        self
21708    }
21709
21710    /// Identifies the authorization scope for the method you are building.
21711    ///
21712    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21713    /// [`Scope::Dfatrafficking`].
21714    ///
21715    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21716    /// tokens for more than one scope.
21717    ///
21718    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21719    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21720    /// sufficient, a read-write scope will do as well.
21721    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserGroupDeleteCall<'a, C>
21722    where
21723        St: AsRef<str>,
21724    {
21725        self._scopes.insert(String::from(scope.as_ref()));
21726        self
21727    }
21728    /// Identifies the authorization scope(s) for the method you are building.
21729    ///
21730    /// See [`Self::add_scope()`] for details.
21731    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserGroupDeleteCall<'a, C>
21732    where
21733        I: IntoIterator<Item = St>,
21734        St: AsRef<str>,
21735    {
21736        self._scopes
21737            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21738        self
21739    }
21740
21741    /// Removes all scopes, and no default scope will be used either.
21742    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21743    /// for details).
21744    pub fn clear_scopes(mut self) -> AdvertiserGroupDeleteCall<'a, C> {
21745        self._scopes.clear();
21746        self
21747    }
21748}
21749
21750/// Gets one advertiser group by ID.
21751///
21752/// A builder for the *get* method supported by a *advertiserGroup* resource.
21753/// It is not used directly, but through a [`AdvertiserGroupMethods`] instance.
21754///
21755/// # Example
21756///
21757/// Instantiate a resource method builder
21758///
21759/// ```test_harness,no_run
21760/// # extern crate hyper;
21761/// # extern crate hyper_rustls;
21762/// # extern crate google_dfareporting3d3 as dfareporting3d3;
21763/// # async fn dox() {
21764/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21765///
21766/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21767/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21768/// #     secret,
21769/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21770/// # ).build().await.unwrap();
21771///
21772/// # let client = hyper_util::client::legacy::Client::builder(
21773/// #     hyper_util::rt::TokioExecutor::new()
21774/// # )
21775/// # .build(
21776/// #     hyper_rustls::HttpsConnectorBuilder::new()
21777/// #         .with_native_roots()
21778/// #         .unwrap()
21779/// #         .https_or_http()
21780/// #         .enable_http1()
21781/// #         .build()
21782/// # );
21783/// # let mut hub = Dfareporting::new(client, auth);
21784/// // You can configure optional parameters by calling the respective setters at will, and
21785/// // execute the final call using `doit()`.
21786/// // Values shown here are possibly random and not representative !
21787/// let result = hub.advertiser_groups().get(-17, -95)
21788///              .doit().await;
21789/// # }
21790/// ```
21791pub struct AdvertiserGroupGetCall<'a, C>
21792where
21793    C: 'a,
21794{
21795    hub: &'a Dfareporting<C>,
21796    _profile_id: i64,
21797    _id: i64,
21798    _delegate: Option<&'a mut dyn common::Delegate>,
21799    _additional_params: HashMap<String, String>,
21800    _scopes: BTreeSet<String>,
21801}
21802
21803impl<'a, C> common::CallBuilder for AdvertiserGroupGetCall<'a, C> {}
21804
21805impl<'a, C> AdvertiserGroupGetCall<'a, C>
21806where
21807    C: common::Connector,
21808{
21809    /// Perform the operation you have build so far.
21810    pub async fn doit(mut self) -> common::Result<(common::Response, AdvertiserGroup)> {
21811        use std::borrow::Cow;
21812        use std::io::{Read, Seek};
21813
21814        use common::{url::Params, ToParts};
21815        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21816
21817        let mut dd = common::DefaultDelegate;
21818        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21819        dlg.begin(common::MethodInfo {
21820            id: "dfareporting.advertiserGroups.get",
21821            http_method: hyper::Method::GET,
21822        });
21823
21824        for &field in ["alt", "profileId", "id"].iter() {
21825            if self._additional_params.contains_key(field) {
21826                dlg.finished(false);
21827                return Err(common::Error::FieldClash(field));
21828            }
21829        }
21830
21831        let mut params = Params::with_capacity(4 + self._additional_params.len());
21832        params.push("profileId", self._profile_id.to_string());
21833        params.push("id", self._id.to_string());
21834
21835        params.extend(self._additional_params.iter());
21836
21837        params.push("alt", "json");
21838        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/advertiserGroups/{id}";
21839        if self._scopes.is_empty() {
21840            self._scopes
21841                .insert(Scope::Dfatrafficking.as_ref().to_string());
21842        }
21843
21844        #[allow(clippy::single_element_loop)]
21845        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
21846            url = params.uri_replacement(url, param_name, find_this, false);
21847        }
21848        {
21849            let to_remove = ["id", "profileId"];
21850            params.remove_params(&to_remove);
21851        }
21852
21853        let url = params.parse_with_url(&url);
21854
21855        loop {
21856            let token = match self
21857                .hub
21858                .auth
21859                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21860                .await
21861            {
21862                Ok(token) => token,
21863                Err(e) => match dlg.token(e) {
21864                    Ok(token) => token,
21865                    Err(e) => {
21866                        dlg.finished(false);
21867                        return Err(common::Error::MissingToken(e));
21868                    }
21869                },
21870            };
21871            let mut req_result = {
21872                let client = &self.hub.client;
21873                dlg.pre_request();
21874                let mut req_builder = hyper::Request::builder()
21875                    .method(hyper::Method::GET)
21876                    .uri(url.as_str())
21877                    .header(USER_AGENT, self.hub._user_agent.clone());
21878
21879                if let Some(token) = token.as_ref() {
21880                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21881                }
21882
21883                let request = req_builder
21884                    .header(CONTENT_LENGTH, 0_u64)
21885                    .body(common::to_body::<String>(None));
21886
21887                client.request(request.unwrap()).await
21888            };
21889
21890            match req_result {
21891                Err(err) => {
21892                    if let common::Retry::After(d) = dlg.http_error(&err) {
21893                        sleep(d).await;
21894                        continue;
21895                    }
21896                    dlg.finished(false);
21897                    return Err(common::Error::HttpError(err));
21898                }
21899                Ok(res) => {
21900                    let (mut parts, body) = res.into_parts();
21901                    let mut body = common::Body::new(body);
21902                    if !parts.status.is_success() {
21903                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21904                        let error = serde_json::from_str(&common::to_string(&bytes));
21905                        let response = common::to_response(parts, bytes.into());
21906
21907                        if let common::Retry::After(d) =
21908                            dlg.http_failure(&response, error.as_ref().ok())
21909                        {
21910                            sleep(d).await;
21911                            continue;
21912                        }
21913
21914                        dlg.finished(false);
21915
21916                        return Err(match error {
21917                            Ok(value) => common::Error::BadRequest(value),
21918                            _ => common::Error::Failure(response),
21919                        });
21920                    }
21921                    let response = {
21922                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21923                        let encoded = common::to_string(&bytes);
21924                        match serde_json::from_str(&encoded) {
21925                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21926                            Err(error) => {
21927                                dlg.response_json_decode_error(&encoded, &error);
21928                                return Err(common::Error::JsonDecodeError(
21929                                    encoded.to_string(),
21930                                    error,
21931                                ));
21932                            }
21933                        }
21934                    };
21935
21936                    dlg.finished(true);
21937                    return Ok(response);
21938                }
21939            }
21940        }
21941    }
21942
21943    /// User profile ID associated with this request.
21944    ///
21945    /// Sets the *profile id* path property to the given value.
21946    ///
21947    /// Even though the property as already been set when instantiating this call,
21948    /// we provide this method for API completeness.
21949    pub fn profile_id(mut self, new_value: i64) -> AdvertiserGroupGetCall<'a, C> {
21950        self._profile_id = new_value;
21951        self
21952    }
21953    /// Advertiser group ID.
21954    ///
21955    /// Sets the *id* path property to the given value.
21956    ///
21957    /// Even though the property as already been set when instantiating this call,
21958    /// we provide this method for API completeness.
21959    pub fn id(mut self, new_value: i64) -> AdvertiserGroupGetCall<'a, C> {
21960        self._id = new_value;
21961        self
21962    }
21963    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21964    /// while executing the actual API request.
21965    ///
21966    /// ````text
21967    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21968    /// ````
21969    ///
21970    /// Sets the *delegate* property to the given value.
21971    pub fn delegate(
21972        mut self,
21973        new_value: &'a mut dyn common::Delegate,
21974    ) -> AdvertiserGroupGetCall<'a, C> {
21975        self._delegate = Some(new_value);
21976        self
21977    }
21978
21979    /// Set any additional parameter of the query string used in the request.
21980    /// It should be used to set parameters which are not yet available through their own
21981    /// setters.
21982    ///
21983    /// Please note that this method must not be used to set any of the known parameters
21984    /// which have their own setter method. If done anyway, the request will fail.
21985    ///
21986    /// # Additional Parameters
21987    ///
21988    /// * *$.xgafv* (query-string) - V1 error format.
21989    /// * *access_token* (query-string) - OAuth access token.
21990    /// * *alt* (query-string) - Data format for response.
21991    /// * *callback* (query-string) - JSONP
21992    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21993    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21994    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21995    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21996    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21997    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21998    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21999    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserGroupGetCall<'a, C>
22000    where
22001        T: AsRef<str>,
22002    {
22003        self._additional_params
22004            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22005        self
22006    }
22007
22008    /// Identifies the authorization scope for the method you are building.
22009    ///
22010    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22011    /// [`Scope::Dfatrafficking`].
22012    ///
22013    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22014    /// tokens for more than one scope.
22015    ///
22016    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22017    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22018    /// sufficient, a read-write scope will do as well.
22019    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserGroupGetCall<'a, C>
22020    where
22021        St: AsRef<str>,
22022    {
22023        self._scopes.insert(String::from(scope.as_ref()));
22024        self
22025    }
22026    /// Identifies the authorization scope(s) for the method you are building.
22027    ///
22028    /// See [`Self::add_scope()`] for details.
22029    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserGroupGetCall<'a, C>
22030    where
22031        I: IntoIterator<Item = St>,
22032        St: AsRef<str>,
22033    {
22034        self._scopes
22035            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22036        self
22037    }
22038
22039    /// Removes all scopes, and no default scope will be used either.
22040    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22041    /// for details).
22042    pub fn clear_scopes(mut self) -> AdvertiserGroupGetCall<'a, C> {
22043        self._scopes.clear();
22044        self
22045    }
22046}
22047
22048/// Inserts a new advertiser group.
22049///
22050/// A builder for the *insert* method supported by a *advertiserGroup* resource.
22051/// It is not used directly, but through a [`AdvertiserGroupMethods`] instance.
22052///
22053/// # Example
22054///
22055/// Instantiate a resource method builder
22056///
22057/// ```test_harness,no_run
22058/// # extern crate hyper;
22059/// # extern crate hyper_rustls;
22060/// # extern crate google_dfareporting3d3 as dfareporting3d3;
22061/// use dfareporting3d3::api::AdvertiserGroup;
22062/// # async fn dox() {
22063/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22064///
22065/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22066/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22067/// #     secret,
22068/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22069/// # ).build().await.unwrap();
22070///
22071/// # let client = hyper_util::client::legacy::Client::builder(
22072/// #     hyper_util::rt::TokioExecutor::new()
22073/// # )
22074/// # .build(
22075/// #     hyper_rustls::HttpsConnectorBuilder::new()
22076/// #         .with_native_roots()
22077/// #         .unwrap()
22078/// #         .https_or_http()
22079/// #         .enable_http1()
22080/// #         .build()
22081/// # );
22082/// # let mut hub = Dfareporting::new(client, auth);
22083/// // As the method needs a request, you would usually fill it with the desired information
22084/// // into the respective structure. Some of the parts shown here might not be applicable !
22085/// // Values shown here are possibly random and not representative !
22086/// let mut req = AdvertiserGroup::default();
22087///
22088/// // You can configure optional parameters by calling the respective setters at will, and
22089/// // execute the final call using `doit()`.
22090/// // Values shown here are possibly random and not representative !
22091/// let result = hub.advertiser_groups().insert(req, -6)
22092///              .doit().await;
22093/// # }
22094/// ```
22095pub struct AdvertiserGroupInsertCall<'a, C>
22096where
22097    C: 'a,
22098{
22099    hub: &'a Dfareporting<C>,
22100    _request: AdvertiserGroup,
22101    _profile_id: i64,
22102    _delegate: Option<&'a mut dyn common::Delegate>,
22103    _additional_params: HashMap<String, String>,
22104    _scopes: BTreeSet<String>,
22105}
22106
22107impl<'a, C> common::CallBuilder for AdvertiserGroupInsertCall<'a, C> {}
22108
22109impl<'a, C> AdvertiserGroupInsertCall<'a, C>
22110where
22111    C: common::Connector,
22112{
22113    /// Perform the operation you have build so far.
22114    pub async fn doit(mut self) -> common::Result<(common::Response, AdvertiserGroup)> {
22115        use std::borrow::Cow;
22116        use std::io::{Read, Seek};
22117
22118        use common::{url::Params, ToParts};
22119        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22120
22121        let mut dd = common::DefaultDelegate;
22122        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22123        dlg.begin(common::MethodInfo {
22124            id: "dfareporting.advertiserGroups.insert",
22125            http_method: hyper::Method::POST,
22126        });
22127
22128        for &field in ["alt", "profileId"].iter() {
22129            if self._additional_params.contains_key(field) {
22130                dlg.finished(false);
22131                return Err(common::Error::FieldClash(field));
22132            }
22133        }
22134
22135        let mut params = Params::with_capacity(4 + self._additional_params.len());
22136        params.push("profileId", self._profile_id.to_string());
22137
22138        params.extend(self._additional_params.iter());
22139
22140        params.push("alt", "json");
22141        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/advertiserGroups";
22142        if self._scopes.is_empty() {
22143            self._scopes
22144                .insert(Scope::Dfatrafficking.as_ref().to_string());
22145        }
22146
22147        #[allow(clippy::single_element_loop)]
22148        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
22149            url = params.uri_replacement(url, param_name, find_this, false);
22150        }
22151        {
22152            let to_remove = ["profileId"];
22153            params.remove_params(&to_remove);
22154        }
22155
22156        let url = params.parse_with_url(&url);
22157
22158        let mut json_mime_type = mime::APPLICATION_JSON;
22159        let mut request_value_reader = {
22160            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22161            common::remove_json_null_values(&mut value);
22162            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22163            serde_json::to_writer(&mut dst, &value).unwrap();
22164            dst
22165        };
22166        let request_size = request_value_reader
22167            .seek(std::io::SeekFrom::End(0))
22168            .unwrap();
22169        request_value_reader
22170            .seek(std::io::SeekFrom::Start(0))
22171            .unwrap();
22172
22173        loop {
22174            let token = match self
22175                .hub
22176                .auth
22177                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22178                .await
22179            {
22180                Ok(token) => token,
22181                Err(e) => match dlg.token(e) {
22182                    Ok(token) => token,
22183                    Err(e) => {
22184                        dlg.finished(false);
22185                        return Err(common::Error::MissingToken(e));
22186                    }
22187                },
22188            };
22189            request_value_reader
22190                .seek(std::io::SeekFrom::Start(0))
22191                .unwrap();
22192            let mut req_result = {
22193                let client = &self.hub.client;
22194                dlg.pre_request();
22195                let mut req_builder = hyper::Request::builder()
22196                    .method(hyper::Method::POST)
22197                    .uri(url.as_str())
22198                    .header(USER_AGENT, self.hub._user_agent.clone());
22199
22200                if let Some(token) = token.as_ref() {
22201                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22202                }
22203
22204                let request = req_builder
22205                    .header(CONTENT_TYPE, json_mime_type.to_string())
22206                    .header(CONTENT_LENGTH, request_size as u64)
22207                    .body(common::to_body(
22208                        request_value_reader.get_ref().clone().into(),
22209                    ));
22210
22211                client.request(request.unwrap()).await
22212            };
22213
22214            match req_result {
22215                Err(err) => {
22216                    if let common::Retry::After(d) = dlg.http_error(&err) {
22217                        sleep(d).await;
22218                        continue;
22219                    }
22220                    dlg.finished(false);
22221                    return Err(common::Error::HttpError(err));
22222                }
22223                Ok(res) => {
22224                    let (mut parts, body) = res.into_parts();
22225                    let mut body = common::Body::new(body);
22226                    if !parts.status.is_success() {
22227                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22228                        let error = serde_json::from_str(&common::to_string(&bytes));
22229                        let response = common::to_response(parts, bytes.into());
22230
22231                        if let common::Retry::After(d) =
22232                            dlg.http_failure(&response, error.as_ref().ok())
22233                        {
22234                            sleep(d).await;
22235                            continue;
22236                        }
22237
22238                        dlg.finished(false);
22239
22240                        return Err(match error {
22241                            Ok(value) => common::Error::BadRequest(value),
22242                            _ => common::Error::Failure(response),
22243                        });
22244                    }
22245                    let response = {
22246                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22247                        let encoded = common::to_string(&bytes);
22248                        match serde_json::from_str(&encoded) {
22249                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22250                            Err(error) => {
22251                                dlg.response_json_decode_error(&encoded, &error);
22252                                return Err(common::Error::JsonDecodeError(
22253                                    encoded.to_string(),
22254                                    error,
22255                                ));
22256                            }
22257                        }
22258                    };
22259
22260                    dlg.finished(true);
22261                    return Ok(response);
22262                }
22263            }
22264        }
22265    }
22266
22267    ///
22268    /// Sets the *request* property to the given value.
22269    ///
22270    /// Even though the property as already been set when instantiating this call,
22271    /// we provide this method for API completeness.
22272    pub fn request(mut self, new_value: AdvertiserGroup) -> AdvertiserGroupInsertCall<'a, C> {
22273        self._request = new_value;
22274        self
22275    }
22276    /// User profile ID associated with this request.
22277    ///
22278    /// Sets the *profile id* path property to the given value.
22279    ///
22280    /// Even though the property as already been set when instantiating this call,
22281    /// we provide this method for API completeness.
22282    pub fn profile_id(mut self, new_value: i64) -> AdvertiserGroupInsertCall<'a, C> {
22283        self._profile_id = new_value;
22284        self
22285    }
22286    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22287    /// while executing the actual API request.
22288    ///
22289    /// ````text
22290    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22291    /// ````
22292    ///
22293    /// Sets the *delegate* property to the given value.
22294    pub fn delegate(
22295        mut self,
22296        new_value: &'a mut dyn common::Delegate,
22297    ) -> AdvertiserGroupInsertCall<'a, C> {
22298        self._delegate = Some(new_value);
22299        self
22300    }
22301
22302    /// Set any additional parameter of the query string used in the request.
22303    /// It should be used to set parameters which are not yet available through their own
22304    /// setters.
22305    ///
22306    /// Please note that this method must not be used to set any of the known parameters
22307    /// which have their own setter method. If done anyway, the request will fail.
22308    ///
22309    /// # Additional Parameters
22310    ///
22311    /// * *$.xgafv* (query-string) - V1 error format.
22312    /// * *access_token* (query-string) - OAuth access token.
22313    /// * *alt* (query-string) - Data format for response.
22314    /// * *callback* (query-string) - JSONP
22315    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22316    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
22317    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22318    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22319    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
22320    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22321    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22322    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserGroupInsertCall<'a, C>
22323    where
22324        T: AsRef<str>,
22325    {
22326        self._additional_params
22327            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22328        self
22329    }
22330
22331    /// Identifies the authorization scope for the method you are building.
22332    ///
22333    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22334    /// [`Scope::Dfatrafficking`].
22335    ///
22336    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22337    /// tokens for more than one scope.
22338    ///
22339    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22340    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22341    /// sufficient, a read-write scope will do as well.
22342    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserGroupInsertCall<'a, C>
22343    where
22344        St: AsRef<str>,
22345    {
22346        self._scopes.insert(String::from(scope.as_ref()));
22347        self
22348    }
22349    /// Identifies the authorization scope(s) for the method you are building.
22350    ///
22351    /// See [`Self::add_scope()`] for details.
22352    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserGroupInsertCall<'a, C>
22353    where
22354        I: IntoIterator<Item = St>,
22355        St: AsRef<str>,
22356    {
22357        self._scopes
22358            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22359        self
22360    }
22361
22362    /// Removes all scopes, and no default scope will be used either.
22363    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22364    /// for details).
22365    pub fn clear_scopes(mut self) -> AdvertiserGroupInsertCall<'a, C> {
22366        self._scopes.clear();
22367        self
22368    }
22369}
22370
22371/// Retrieves a list of advertiser groups, possibly filtered. This method supports paging.
22372///
22373/// A builder for the *list* method supported by a *advertiserGroup* resource.
22374/// It is not used directly, but through a [`AdvertiserGroupMethods`] instance.
22375///
22376/// # Example
22377///
22378/// Instantiate a resource method builder
22379///
22380/// ```test_harness,no_run
22381/// # extern crate hyper;
22382/// # extern crate hyper_rustls;
22383/// # extern crate google_dfareporting3d3 as dfareporting3d3;
22384/// # async fn dox() {
22385/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22386///
22387/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22388/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22389/// #     secret,
22390/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22391/// # ).build().await.unwrap();
22392///
22393/// # let client = hyper_util::client::legacy::Client::builder(
22394/// #     hyper_util::rt::TokioExecutor::new()
22395/// # )
22396/// # .build(
22397/// #     hyper_rustls::HttpsConnectorBuilder::new()
22398/// #         .with_native_roots()
22399/// #         .unwrap()
22400/// #         .https_or_http()
22401/// #         .enable_http1()
22402/// #         .build()
22403/// # );
22404/// # let mut hub = Dfareporting::new(client, auth);
22405/// // You can configure optional parameters by calling the respective setters at will, and
22406/// // execute the final call using `doit()`.
22407/// // Values shown here are possibly random and not representative !
22408/// let result = hub.advertiser_groups().list(-38)
22409///              .sort_order("no")
22410///              .sort_field("est")
22411///              .search_string("At")
22412///              .page_token("sed")
22413///              .max_results(-98)
22414///              .add_ids(-35)
22415///              .doit().await;
22416/// # }
22417/// ```
22418pub struct AdvertiserGroupListCall<'a, C>
22419where
22420    C: 'a,
22421{
22422    hub: &'a Dfareporting<C>,
22423    _profile_id: i64,
22424    _sort_order: Option<String>,
22425    _sort_field: Option<String>,
22426    _search_string: Option<String>,
22427    _page_token: Option<String>,
22428    _max_results: Option<i32>,
22429    _ids: Vec<i64>,
22430    _delegate: Option<&'a mut dyn common::Delegate>,
22431    _additional_params: HashMap<String, String>,
22432    _scopes: BTreeSet<String>,
22433}
22434
22435impl<'a, C> common::CallBuilder for AdvertiserGroupListCall<'a, C> {}
22436
22437impl<'a, C> AdvertiserGroupListCall<'a, C>
22438where
22439    C: common::Connector,
22440{
22441    /// Perform the operation you have build so far.
22442    pub async fn doit(
22443        mut self,
22444    ) -> common::Result<(common::Response, AdvertiserGroupsListResponse)> {
22445        use std::borrow::Cow;
22446        use std::io::{Read, Seek};
22447
22448        use common::{url::Params, ToParts};
22449        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22450
22451        let mut dd = common::DefaultDelegate;
22452        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22453        dlg.begin(common::MethodInfo {
22454            id: "dfareporting.advertiserGroups.list",
22455            http_method: hyper::Method::GET,
22456        });
22457
22458        for &field in [
22459            "alt",
22460            "profileId",
22461            "sortOrder",
22462            "sortField",
22463            "searchString",
22464            "pageToken",
22465            "maxResults",
22466            "ids",
22467        ]
22468        .iter()
22469        {
22470            if self._additional_params.contains_key(field) {
22471                dlg.finished(false);
22472                return Err(common::Error::FieldClash(field));
22473            }
22474        }
22475
22476        let mut params = Params::with_capacity(9 + self._additional_params.len());
22477        params.push("profileId", self._profile_id.to_string());
22478        if let Some(value) = self._sort_order.as_ref() {
22479            params.push("sortOrder", value);
22480        }
22481        if let Some(value) = self._sort_field.as_ref() {
22482            params.push("sortField", value);
22483        }
22484        if let Some(value) = self._search_string.as_ref() {
22485            params.push("searchString", value);
22486        }
22487        if let Some(value) = self._page_token.as_ref() {
22488            params.push("pageToken", value);
22489        }
22490        if let Some(value) = self._max_results.as_ref() {
22491            params.push("maxResults", value.to_string());
22492        }
22493        if !self._ids.is_empty() {
22494            for f in self._ids.iter() {
22495                params.push("ids", f.to_string());
22496            }
22497        }
22498
22499        params.extend(self._additional_params.iter());
22500
22501        params.push("alt", "json");
22502        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/advertiserGroups";
22503        if self._scopes.is_empty() {
22504            self._scopes
22505                .insert(Scope::Dfatrafficking.as_ref().to_string());
22506        }
22507
22508        #[allow(clippy::single_element_loop)]
22509        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
22510            url = params.uri_replacement(url, param_name, find_this, false);
22511        }
22512        {
22513            let to_remove = ["profileId"];
22514            params.remove_params(&to_remove);
22515        }
22516
22517        let url = params.parse_with_url(&url);
22518
22519        loop {
22520            let token = match self
22521                .hub
22522                .auth
22523                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22524                .await
22525            {
22526                Ok(token) => token,
22527                Err(e) => match dlg.token(e) {
22528                    Ok(token) => token,
22529                    Err(e) => {
22530                        dlg.finished(false);
22531                        return Err(common::Error::MissingToken(e));
22532                    }
22533                },
22534            };
22535            let mut req_result = {
22536                let client = &self.hub.client;
22537                dlg.pre_request();
22538                let mut req_builder = hyper::Request::builder()
22539                    .method(hyper::Method::GET)
22540                    .uri(url.as_str())
22541                    .header(USER_AGENT, self.hub._user_agent.clone());
22542
22543                if let Some(token) = token.as_ref() {
22544                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22545                }
22546
22547                let request = req_builder
22548                    .header(CONTENT_LENGTH, 0_u64)
22549                    .body(common::to_body::<String>(None));
22550
22551                client.request(request.unwrap()).await
22552            };
22553
22554            match req_result {
22555                Err(err) => {
22556                    if let common::Retry::After(d) = dlg.http_error(&err) {
22557                        sleep(d).await;
22558                        continue;
22559                    }
22560                    dlg.finished(false);
22561                    return Err(common::Error::HttpError(err));
22562                }
22563                Ok(res) => {
22564                    let (mut parts, body) = res.into_parts();
22565                    let mut body = common::Body::new(body);
22566                    if !parts.status.is_success() {
22567                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22568                        let error = serde_json::from_str(&common::to_string(&bytes));
22569                        let response = common::to_response(parts, bytes.into());
22570
22571                        if let common::Retry::After(d) =
22572                            dlg.http_failure(&response, error.as_ref().ok())
22573                        {
22574                            sleep(d).await;
22575                            continue;
22576                        }
22577
22578                        dlg.finished(false);
22579
22580                        return Err(match error {
22581                            Ok(value) => common::Error::BadRequest(value),
22582                            _ => common::Error::Failure(response),
22583                        });
22584                    }
22585                    let response = {
22586                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22587                        let encoded = common::to_string(&bytes);
22588                        match serde_json::from_str(&encoded) {
22589                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22590                            Err(error) => {
22591                                dlg.response_json_decode_error(&encoded, &error);
22592                                return Err(common::Error::JsonDecodeError(
22593                                    encoded.to_string(),
22594                                    error,
22595                                ));
22596                            }
22597                        }
22598                    };
22599
22600                    dlg.finished(true);
22601                    return Ok(response);
22602                }
22603            }
22604        }
22605    }
22606
22607    /// User profile ID associated with this request.
22608    ///
22609    /// Sets the *profile id* path property to the given value.
22610    ///
22611    /// Even though the property as already been set when instantiating this call,
22612    /// we provide this method for API completeness.
22613    pub fn profile_id(mut self, new_value: i64) -> AdvertiserGroupListCall<'a, C> {
22614        self._profile_id = new_value;
22615        self
22616    }
22617    /// Order of sorted results.
22618    ///
22619    /// Sets the *sort order* query property to the given value.
22620    pub fn sort_order(mut self, new_value: &str) -> AdvertiserGroupListCall<'a, C> {
22621        self._sort_order = Some(new_value.to_string());
22622        self
22623    }
22624    /// Field by which to sort the list.
22625    ///
22626    /// Sets the *sort field* query property to the given value.
22627    pub fn sort_field(mut self, new_value: &str) -> AdvertiserGroupListCall<'a, C> {
22628        self._sort_field = Some(new_value.to_string());
22629        self
22630    }
22631    /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "advertiser*2015" will return objects with names like "advertiser group June 2015", "advertiser group April 2015", or simply "advertiser group 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "advertisergroup" will match objects with name "my advertisergroup", "advertisergroup 2015", or simply "advertisergroup".
22632    ///
22633    /// Sets the *search string* query property to the given value.
22634    pub fn search_string(mut self, new_value: &str) -> AdvertiserGroupListCall<'a, C> {
22635        self._search_string = Some(new_value.to_string());
22636        self
22637    }
22638    /// Value of the nextPageToken from the previous result page.
22639    ///
22640    /// Sets the *page token* query property to the given value.
22641    pub fn page_token(mut self, new_value: &str) -> AdvertiserGroupListCall<'a, C> {
22642        self._page_token = Some(new_value.to_string());
22643        self
22644    }
22645    /// Maximum number of results to return.
22646    ///
22647    /// Sets the *max results* query property to the given value.
22648    pub fn max_results(mut self, new_value: i32) -> AdvertiserGroupListCall<'a, C> {
22649        self._max_results = Some(new_value);
22650        self
22651    }
22652    /// Select only advertiser groups with these IDs.
22653    ///
22654    /// Append the given value to the *ids* query property.
22655    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
22656    pub fn add_ids(mut self, new_value: i64) -> AdvertiserGroupListCall<'a, C> {
22657        self._ids.push(new_value);
22658        self
22659    }
22660    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22661    /// while executing the actual API request.
22662    ///
22663    /// ````text
22664    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22665    /// ````
22666    ///
22667    /// Sets the *delegate* property to the given value.
22668    pub fn delegate(
22669        mut self,
22670        new_value: &'a mut dyn common::Delegate,
22671    ) -> AdvertiserGroupListCall<'a, C> {
22672        self._delegate = Some(new_value);
22673        self
22674    }
22675
22676    /// Set any additional parameter of the query string used in the request.
22677    /// It should be used to set parameters which are not yet available through their own
22678    /// setters.
22679    ///
22680    /// Please note that this method must not be used to set any of the known parameters
22681    /// which have their own setter method. If done anyway, the request will fail.
22682    ///
22683    /// # Additional Parameters
22684    ///
22685    /// * *$.xgafv* (query-string) - V1 error format.
22686    /// * *access_token* (query-string) - OAuth access token.
22687    /// * *alt* (query-string) - Data format for response.
22688    /// * *callback* (query-string) - JSONP
22689    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22690    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
22691    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22692    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22693    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
22694    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22695    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22696    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserGroupListCall<'a, C>
22697    where
22698        T: AsRef<str>,
22699    {
22700        self._additional_params
22701            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22702        self
22703    }
22704
22705    /// Identifies the authorization scope for the method you are building.
22706    ///
22707    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22708    /// [`Scope::Dfatrafficking`].
22709    ///
22710    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22711    /// tokens for more than one scope.
22712    ///
22713    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22714    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22715    /// sufficient, a read-write scope will do as well.
22716    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserGroupListCall<'a, C>
22717    where
22718        St: AsRef<str>,
22719    {
22720        self._scopes.insert(String::from(scope.as_ref()));
22721        self
22722    }
22723    /// Identifies the authorization scope(s) for the method you are building.
22724    ///
22725    /// See [`Self::add_scope()`] for details.
22726    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserGroupListCall<'a, C>
22727    where
22728        I: IntoIterator<Item = St>,
22729        St: AsRef<str>,
22730    {
22731        self._scopes
22732            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22733        self
22734    }
22735
22736    /// Removes all scopes, and no default scope will be used either.
22737    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22738    /// for details).
22739    pub fn clear_scopes(mut self) -> AdvertiserGroupListCall<'a, C> {
22740        self._scopes.clear();
22741        self
22742    }
22743}
22744
22745/// Updates an existing advertiser group. This method supports patch semantics.
22746///
22747/// A builder for the *patch* method supported by a *advertiserGroup* resource.
22748/// It is not used directly, but through a [`AdvertiserGroupMethods`] instance.
22749///
22750/// # Example
22751///
22752/// Instantiate a resource method builder
22753///
22754/// ```test_harness,no_run
22755/// # extern crate hyper;
22756/// # extern crate hyper_rustls;
22757/// # extern crate google_dfareporting3d3 as dfareporting3d3;
22758/// use dfareporting3d3::api::AdvertiserGroup;
22759/// # async fn dox() {
22760/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22761///
22762/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22763/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22764/// #     secret,
22765/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22766/// # ).build().await.unwrap();
22767///
22768/// # let client = hyper_util::client::legacy::Client::builder(
22769/// #     hyper_util::rt::TokioExecutor::new()
22770/// # )
22771/// # .build(
22772/// #     hyper_rustls::HttpsConnectorBuilder::new()
22773/// #         .with_native_roots()
22774/// #         .unwrap()
22775/// #         .https_or_http()
22776/// #         .enable_http1()
22777/// #         .build()
22778/// # );
22779/// # let mut hub = Dfareporting::new(client, auth);
22780/// // As the method needs a request, you would usually fill it with the desired information
22781/// // into the respective structure. Some of the parts shown here might not be applicable !
22782/// // Values shown here are possibly random and not representative !
22783/// let mut req = AdvertiserGroup::default();
22784///
22785/// // You can configure optional parameters by calling the respective setters at will, and
22786/// // execute the final call using `doit()`.
22787/// // Values shown here are possibly random and not representative !
22788/// let result = hub.advertiser_groups().patch(req, -39, -32)
22789///              .doit().await;
22790/// # }
22791/// ```
22792pub struct AdvertiserGroupPatchCall<'a, C>
22793where
22794    C: 'a,
22795{
22796    hub: &'a Dfareporting<C>,
22797    _request: AdvertiserGroup,
22798    _profile_id: i64,
22799    _id: i64,
22800    _delegate: Option<&'a mut dyn common::Delegate>,
22801    _additional_params: HashMap<String, String>,
22802    _scopes: BTreeSet<String>,
22803}
22804
22805impl<'a, C> common::CallBuilder for AdvertiserGroupPatchCall<'a, C> {}
22806
22807impl<'a, C> AdvertiserGroupPatchCall<'a, C>
22808where
22809    C: common::Connector,
22810{
22811    /// Perform the operation you have build so far.
22812    pub async fn doit(mut self) -> common::Result<(common::Response, AdvertiserGroup)> {
22813        use std::borrow::Cow;
22814        use std::io::{Read, Seek};
22815
22816        use common::{url::Params, ToParts};
22817        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22818
22819        let mut dd = common::DefaultDelegate;
22820        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22821        dlg.begin(common::MethodInfo {
22822            id: "dfareporting.advertiserGroups.patch",
22823            http_method: hyper::Method::PATCH,
22824        });
22825
22826        for &field in ["alt", "profileId", "id"].iter() {
22827            if self._additional_params.contains_key(field) {
22828                dlg.finished(false);
22829                return Err(common::Error::FieldClash(field));
22830            }
22831        }
22832
22833        let mut params = Params::with_capacity(5 + self._additional_params.len());
22834        params.push("profileId", self._profile_id.to_string());
22835        params.push("id", self._id.to_string());
22836
22837        params.extend(self._additional_params.iter());
22838
22839        params.push("alt", "json");
22840        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/advertiserGroups";
22841        if self._scopes.is_empty() {
22842            self._scopes
22843                .insert(Scope::Dfatrafficking.as_ref().to_string());
22844        }
22845
22846        #[allow(clippy::single_element_loop)]
22847        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
22848            url = params.uri_replacement(url, param_name, find_this, false);
22849        }
22850        {
22851            let to_remove = ["profileId"];
22852            params.remove_params(&to_remove);
22853        }
22854
22855        let url = params.parse_with_url(&url);
22856
22857        let mut json_mime_type = mime::APPLICATION_JSON;
22858        let mut request_value_reader = {
22859            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22860            common::remove_json_null_values(&mut value);
22861            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22862            serde_json::to_writer(&mut dst, &value).unwrap();
22863            dst
22864        };
22865        let request_size = request_value_reader
22866            .seek(std::io::SeekFrom::End(0))
22867            .unwrap();
22868        request_value_reader
22869            .seek(std::io::SeekFrom::Start(0))
22870            .unwrap();
22871
22872        loop {
22873            let token = match self
22874                .hub
22875                .auth
22876                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22877                .await
22878            {
22879                Ok(token) => token,
22880                Err(e) => match dlg.token(e) {
22881                    Ok(token) => token,
22882                    Err(e) => {
22883                        dlg.finished(false);
22884                        return Err(common::Error::MissingToken(e));
22885                    }
22886                },
22887            };
22888            request_value_reader
22889                .seek(std::io::SeekFrom::Start(0))
22890                .unwrap();
22891            let mut req_result = {
22892                let client = &self.hub.client;
22893                dlg.pre_request();
22894                let mut req_builder = hyper::Request::builder()
22895                    .method(hyper::Method::PATCH)
22896                    .uri(url.as_str())
22897                    .header(USER_AGENT, self.hub._user_agent.clone());
22898
22899                if let Some(token) = token.as_ref() {
22900                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22901                }
22902
22903                let request = req_builder
22904                    .header(CONTENT_TYPE, json_mime_type.to_string())
22905                    .header(CONTENT_LENGTH, request_size as u64)
22906                    .body(common::to_body(
22907                        request_value_reader.get_ref().clone().into(),
22908                    ));
22909
22910                client.request(request.unwrap()).await
22911            };
22912
22913            match req_result {
22914                Err(err) => {
22915                    if let common::Retry::After(d) = dlg.http_error(&err) {
22916                        sleep(d).await;
22917                        continue;
22918                    }
22919                    dlg.finished(false);
22920                    return Err(common::Error::HttpError(err));
22921                }
22922                Ok(res) => {
22923                    let (mut parts, body) = res.into_parts();
22924                    let mut body = common::Body::new(body);
22925                    if !parts.status.is_success() {
22926                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22927                        let error = serde_json::from_str(&common::to_string(&bytes));
22928                        let response = common::to_response(parts, bytes.into());
22929
22930                        if let common::Retry::After(d) =
22931                            dlg.http_failure(&response, error.as_ref().ok())
22932                        {
22933                            sleep(d).await;
22934                            continue;
22935                        }
22936
22937                        dlg.finished(false);
22938
22939                        return Err(match error {
22940                            Ok(value) => common::Error::BadRequest(value),
22941                            _ => common::Error::Failure(response),
22942                        });
22943                    }
22944                    let response = {
22945                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22946                        let encoded = common::to_string(&bytes);
22947                        match serde_json::from_str(&encoded) {
22948                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22949                            Err(error) => {
22950                                dlg.response_json_decode_error(&encoded, &error);
22951                                return Err(common::Error::JsonDecodeError(
22952                                    encoded.to_string(),
22953                                    error,
22954                                ));
22955                            }
22956                        }
22957                    };
22958
22959                    dlg.finished(true);
22960                    return Ok(response);
22961                }
22962            }
22963        }
22964    }
22965
22966    ///
22967    /// Sets the *request* property to the given value.
22968    ///
22969    /// Even though the property as already been set when instantiating this call,
22970    /// we provide this method for API completeness.
22971    pub fn request(mut self, new_value: AdvertiserGroup) -> AdvertiserGroupPatchCall<'a, C> {
22972        self._request = new_value;
22973        self
22974    }
22975    /// User profile ID associated with this request.
22976    ///
22977    /// Sets the *profile id* path property to the given value.
22978    ///
22979    /// Even though the property as already been set when instantiating this call,
22980    /// we provide this method for API completeness.
22981    pub fn profile_id(mut self, new_value: i64) -> AdvertiserGroupPatchCall<'a, C> {
22982        self._profile_id = new_value;
22983        self
22984    }
22985    /// AdvertiserGroup ID.
22986    ///
22987    /// Sets the *id* query property to the given value.
22988    ///
22989    /// Even though the property as already been set when instantiating this call,
22990    /// we provide this method for API completeness.
22991    pub fn id(mut self, new_value: i64) -> AdvertiserGroupPatchCall<'a, C> {
22992        self._id = new_value;
22993        self
22994    }
22995    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22996    /// while executing the actual API request.
22997    ///
22998    /// ````text
22999    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23000    /// ````
23001    ///
23002    /// Sets the *delegate* property to the given value.
23003    pub fn delegate(
23004        mut self,
23005        new_value: &'a mut dyn common::Delegate,
23006    ) -> AdvertiserGroupPatchCall<'a, C> {
23007        self._delegate = Some(new_value);
23008        self
23009    }
23010
23011    /// Set any additional parameter of the query string used in the request.
23012    /// It should be used to set parameters which are not yet available through their own
23013    /// setters.
23014    ///
23015    /// Please note that this method must not be used to set any of the known parameters
23016    /// which have their own setter method. If done anyway, the request will fail.
23017    ///
23018    /// # Additional Parameters
23019    ///
23020    /// * *$.xgafv* (query-string) - V1 error format.
23021    /// * *access_token* (query-string) - OAuth access token.
23022    /// * *alt* (query-string) - Data format for response.
23023    /// * *callback* (query-string) - JSONP
23024    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23025    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
23026    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23027    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23028    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
23029    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23030    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23031    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserGroupPatchCall<'a, C>
23032    where
23033        T: AsRef<str>,
23034    {
23035        self._additional_params
23036            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23037        self
23038    }
23039
23040    /// Identifies the authorization scope for the method you are building.
23041    ///
23042    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23043    /// [`Scope::Dfatrafficking`].
23044    ///
23045    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23046    /// tokens for more than one scope.
23047    ///
23048    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23049    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23050    /// sufficient, a read-write scope will do as well.
23051    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserGroupPatchCall<'a, C>
23052    where
23053        St: AsRef<str>,
23054    {
23055        self._scopes.insert(String::from(scope.as_ref()));
23056        self
23057    }
23058    /// Identifies the authorization scope(s) for the method you are building.
23059    ///
23060    /// See [`Self::add_scope()`] for details.
23061    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserGroupPatchCall<'a, C>
23062    where
23063        I: IntoIterator<Item = St>,
23064        St: AsRef<str>,
23065    {
23066        self._scopes
23067            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23068        self
23069    }
23070
23071    /// Removes all scopes, and no default scope will be used either.
23072    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23073    /// for details).
23074    pub fn clear_scopes(mut self) -> AdvertiserGroupPatchCall<'a, C> {
23075        self._scopes.clear();
23076        self
23077    }
23078}
23079
23080/// Updates an existing advertiser group.
23081///
23082/// A builder for the *update* method supported by a *advertiserGroup* resource.
23083/// It is not used directly, but through a [`AdvertiserGroupMethods`] instance.
23084///
23085/// # Example
23086///
23087/// Instantiate a resource method builder
23088///
23089/// ```test_harness,no_run
23090/// # extern crate hyper;
23091/// # extern crate hyper_rustls;
23092/// # extern crate google_dfareporting3d3 as dfareporting3d3;
23093/// use dfareporting3d3::api::AdvertiserGroup;
23094/// # async fn dox() {
23095/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23096///
23097/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23098/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
23099/// #     secret,
23100/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23101/// # ).build().await.unwrap();
23102///
23103/// # let client = hyper_util::client::legacy::Client::builder(
23104/// #     hyper_util::rt::TokioExecutor::new()
23105/// # )
23106/// # .build(
23107/// #     hyper_rustls::HttpsConnectorBuilder::new()
23108/// #         .with_native_roots()
23109/// #         .unwrap()
23110/// #         .https_or_http()
23111/// #         .enable_http1()
23112/// #         .build()
23113/// # );
23114/// # let mut hub = Dfareporting::new(client, auth);
23115/// // As the method needs a request, you would usually fill it with the desired information
23116/// // into the respective structure. Some of the parts shown here might not be applicable !
23117/// // Values shown here are possibly random and not representative !
23118/// let mut req = AdvertiserGroup::default();
23119///
23120/// // You can configure optional parameters by calling the respective setters at will, and
23121/// // execute the final call using `doit()`.
23122/// // Values shown here are possibly random and not representative !
23123/// let result = hub.advertiser_groups().update(req, -5)
23124///              .doit().await;
23125/// # }
23126/// ```
23127pub struct AdvertiserGroupUpdateCall<'a, C>
23128where
23129    C: 'a,
23130{
23131    hub: &'a Dfareporting<C>,
23132    _request: AdvertiserGroup,
23133    _profile_id: i64,
23134    _delegate: Option<&'a mut dyn common::Delegate>,
23135    _additional_params: HashMap<String, String>,
23136    _scopes: BTreeSet<String>,
23137}
23138
23139impl<'a, C> common::CallBuilder for AdvertiserGroupUpdateCall<'a, C> {}
23140
23141impl<'a, C> AdvertiserGroupUpdateCall<'a, C>
23142where
23143    C: common::Connector,
23144{
23145    /// Perform the operation you have build so far.
23146    pub async fn doit(mut self) -> common::Result<(common::Response, AdvertiserGroup)> {
23147        use std::borrow::Cow;
23148        use std::io::{Read, Seek};
23149
23150        use common::{url::Params, ToParts};
23151        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23152
23153        let mut dd = common::DefaultDelegate;
23154        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23155        dlg.begin(common::MethodInfo {
23156            id: "dfareporting.advertiserGroups.update",
23157            http_method: hyper::Method::PUT,
23158        });
23159
23160        for &field in ["alt", "profileId"].iter() {
23161            if self._additional_params.contains_key(field) {
23162                dlg.finished(false);
23163                return Err(common::Error::FieldClash(field));
23164            }
23165        }
23166
23167        let mut params = Params::with_capacity(4 + self._additional_params.len());
23168        params.push("profileId", self._profile_id.to_string());
23169
23170        params.extend(self._additional_params.iter());
23171
23172        params.push("alt", "json");
23173        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/advertiserGroups";
23174        if self._scopes.is_empty() {
23175            self._scopes
23176                .insert(Scope::Dfatrafficking.as_ref().to_string());
23177        }
23178
23179        #[allow(clippy::single_element_loop)]
23180        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
23181            url = params.uri_replacement(url, param_name, find_this, false);
23182        }
23183        {
23184            let to_remove = ["profileId"];
23185            params.remove_params(&to_remove);
23186        }
23187
23188        let url = params.parse_with_url(&url);
23189
23190        let mut json_mime_type = mime::APPLICATION_JSON;
23191        let mut request_value_reader = {
23192            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23193            common::remove_json_null_values(&mut value);
23194            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23195            serde_json::to_writer(&mut dst, &value).unwrap();
23196            dst
23197        };
23198        let request_size = request_value_reader
23199            .seek(std::io::SeekFrom::End(0))
23200            .unwrap();
23201        request_value_reader
23202            .seek(std::io::SeekFrom::Start(0))
23203            .unwrap();
23204
23205        loop {
23206            let token = match self
23207                .hub
23208                .auth
23209                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23210                .await
23211            {
23212                Ok(token) => token,
23213                Err(e) => match dlg.token(e) {
23214                    Ok(token) => token,
23215                    Err(e) => {
23216                        dlg.finished(false);
23217                        return Err(common::Error::MissingToken(e));
23218                    }
23219                },
23220            };
23221            request_value_reader
23222                .seek(std::io::SeekFrom::Start(0))
23223                .unwrap();
23224            let mut req_result = {
23225                let client = &self.hub.client;
23226                dlg.pre_request();
23227                let mut req_builder = hyper::Request::builder()
23228                    .method(hyper::Method::PUT)
23229                    .uri(url.as_str())
23230                    .header(USER_AGENT, self.hub._user_agent.clone());
23231
23232                if let Some(token) = token.as_ref() {
23233                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23234                }
23235
23236                let request = req_builder
23237                    .header(CONTENT_TYPE, json_mime_type.to_string())
23238                    .header(CONTENT_LENGTH, request_size as u64)
23239                    .body(common::to_body(
23240                        request_value_reader.get_ref().clone().into(),
23241                    ));
23242
23243                client.request(request.unwrap()).await
23244            };
23245
23246            match req_result {
23247                Err(err) => {
23248                    if let common::Retry::After(d) = dlg.http_error(&err) {
23249                        sleep(d).await;
23250                        continue;
23251                    }
23252                    dlg.finished(false);
23253                    return Err(common::Error::HttpError(err));
23254                }
23255                Ok(res) => {
23256                    let (mut parts, body) = res.into_parts();
23257                    let mut body = common::Body::new(body);
23258                    if !parts.status.is_success() {
23259                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23260                        let error = serde_json::from_str(&common::to_string(&bytes));
23261                        let response = common::to_response(parts, bytes.into());
23262
23263                        if let common::Retry::After(d) =
23264                            dlg.http_failure(&response, error.as_ref().ok())
23265                        {
23266                            sleep(d).await;
23267                            continue;
23268                        }
23269
23270                        dlg.finished(false);
23271
23272                        return Err(match error {
23273                            Ok(value) => common::Error::BadRequest(value),
23274                            _ => common::Error::Failure(response),
23275                        });
23276                    }
23277                    let response = {
23278                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23279                        let encoded = common::to_string(&bytes);
23280                        match serde_json::from_str(&encoded) {
23281                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23282                            Err(error) => {
23283                                dlg.response_json_decode_error(&encoded, &error);
23284                                return Err(common::Error::JsonDecodeError(
23285                                    encoded.to_string(),
23286                                    error,
23287                                ));
23288                            }
23289                        }
23290                    };
23291
23292                    dlg.finished(true);
23293                    return Ok(response);
23294                }
23295            }
23296        }
23297    }
23298
23299    ///
23300    /// Sets the *request* property to the given value.
23301    ///
23302    /// Even though the property as already been set when instantiating this call,
23303    /// we provide this method for API completeness.
23304    pub fn request(mut self, new_value: AdvertiserGroup) -> AdvertiserGroupUpdateCall<'a, C> {
23305        self._request = new_value;
23306        self
23307    }
23308    /// User profile ID associated with this request.
23309    ///
23310    /// Sets the *profile id* path property to the given value.
23311    ///
23312    /// Even though the property as already been set when instantiating this call,
23313    /// we provide this method for API completeness.
23314    pub fn profile_id(mut self, new_value: i64) -> AdvertiserGroupUpdateCall<'a, C> {
23315        self._profile_id = new_value;
23316        self
23317    }
23318    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23319    /// while executing the actual API request.
23320    ///
23321    /// ````text
23322    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23323    /// ````
23324    ///
23325    /// Sets the *delegate* property to the given value.
23326    pub fn delegate(
23327        mut self,
23328        new_value: &'a mut dyn common::Delegate,
23329    ) -> AdvertiserGroupUpdateCall<'a, C> {
23330        self._delegate = Some(new_value);
23331        self
23332    }
23333
23334    /// Set any additional parameter of the query string used in the request.
23335    /// It should be used to set parameters which are not yet available through their own
23336    /// setters.
23337    ///
23338    /// Please note that this method must not be used to set any of the known parameters
23339    /// which have their own setter method. If done anyway, the request will fail.
23340    ///
23341    /// # Additional Parameters
23342    ///
23343    /// * *$.xgafv* (query-string) - V1 error format.
23344    /// * *access_token* (query-string) - OAuth access token.
23345    /// * *alt* (query-string) - Data format for response.
23346    /// * *callback* (query-string) - JSONP
23347    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23348    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
23349    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23350    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23351    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
23352    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23353    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23354    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserGroupUpdateCall<'a, C>
23355    where
23356        T: AsRef<str>,
23357    {
23358        self._additional_params
23359            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23360        self
23361    }
23362
23363    /// Identifies the authorization scope for the method you are building.
23364    ///
23365    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23366    /// [`Scope::Dfatrafficking`].
23367    ///
23368    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23369    /// tokens for more than one scope.
23370    ///
23371    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23372    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23373    /// sufficient, a read-write scope will do as well.
23374    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserGroupUpdateCall<'a, C>
23375    where
23376        St: AsRef<str>,
23377    {
23378        self._scopes.insert(String::from(scope.as_ref()));
23379        self
23380    }
23381    /// Identifies the authorization scope(s) for the method you are building.
23382    ///
23383    /// See [`Self::add_scope()`] for details.
23384    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserGroupUpdateCall<'a, C>
23385    where
23386        I: IntoIterator<Item = St>,
23387        St: AsRef<str>,
23388    {
23389        self._scopes
23390            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23391        self
23392    }
23393
23394    /// Removes all scopes, and no default scope will be used either.
23395    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23396    /// for details).
23397    pub fn clear_scopes(mut self) -> AdvertiserGroupUpdateCall<'a, C> {
23398        self._scopes.clear();
23399        self
23400    }
23401}
23402
23403/// Gets one landing page by ID.
23404///
23405/// A builder for the *get* method supported by a *advertiserLandingPage* resource.
23406/// It is not used directly, but through a [`AdvertiserLandingPageMethods`] instance.
23407///
23408/// # Example
23409///
23410/// Instantiate a resource method builder
23411///
23412/// ```test_harness,no_run
23413/// # extern crate hyper;
23414/// # extern crate hyper_rustls;
23415/// # extern crate google_dfareporting3d3 as dfareporting3d3;
23416/// # async fn dox() {
23417/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23418///
23419/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23420/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
23421/// #     secret,
23422/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23423/// # ).build().await.unwrap();
23424///
23425/// # let client = hyper_util::client::legacy::Client::builder(
23426/// #     hyper_util::rt::TokioExecutor::new()
23427/// # )
23428/// # .build(
23429/// #     hyper_rustls::HttpsConnectorBuilder::new()
23430/// #         .with_native_roots()
23431/// #         .unwrap()
23432/// #         .https_or_http()
23433/// #         .enable_http1()
23434/// #         .build()
23435/// # );
23436/// # let mut hub = Dfareporting::new(client, auth);
23437/// // You can configure optional parameters by calling the respective setters at will, and
23438/// // execute the final call using `doit()`.
23439/// // Values shown here are possibly random and not representative !
23440/// let result = hub.advertiser_landing_pages().get(-18, -8)
23441///              .doit().await;
23442/// # }
23443/// ```
23444pub struct AdvertiserLandingPageGetCall<'a, C>
23445where
23446    C: 'a,
23447{
23448    hub: &'a Dfareporting<C>,
23449    _profile_id: i64,
23450    _id: i64,
23451    _delegate: Option<&'a mut dyn common::Delegate>,
23452    _additional_params: HashMap<String, String>,
23453    _scopes: BTreeSet<String>,
23454}
23455
23456impl<'a, C> common::CallBuilder for AdvertiserLandingPageGetCall<'a, C> {}
23457
23458impl<'a, C> AdvertiserLandingPageGetCall<'a, C>
23459where
23460    C: common::Connector,
23461{
23462    /// Perform the operation you have build so far.
23463    pub async fn doit(mut self) -> common::Result<(common::Response, LandingPage)> {
23464        use std::borrow::Cow;
23465        use std::io::{Read, Seek};
23466
23467        use common::{url::Params, ToParts};
23468        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23469
23470        let mut dd = common::DefaultDelegate;
23471        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23472        dlg.begin(common::MethodInfo {
23473            id: "dfareporting.advertiserLandingPages.get",
23474            http_method: hyper::Method::GET,
23475        });
23476
23477        for &field in ["alt", "profileId", "id"].iter() {
23478            if self._additional_params.contains_key(field) {
23479                dlg.finished(false);
23480                return Err(common::Error::FieldClash(field));
23481            }
23482        }
23483
23484        let mut params = Params::with_capacity(4 + self._additional_params.len());
23485        params.push("profileId", self._profile_id.to_string());
23486        params.push("id", self._id.to_string());
23487
23488        params.extend(self._additional_params.iter());
23489
23490        params.push("alt", "json");
23491        let mut url =
23492            self.hub._base_url.clone() + "userprofiles/{profileId}/advertiserLandingPages/{id}";
23493        if self._scopes.is_empty() {
23494            self._scopes
23495                .insert(Scope::Dfatrafficking.as_ref().to_string());
23496        }
23497
23498        #[allow(clippy::single_element_loop)]
23499        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
23500            url = params.uri_replacement(url, param_name, find_this, false);
23501        }
23502        {
23503            let to_remove = ["id", "profileId"];
23504            params.remove_params(&to_remove);
23505        }
23506
23507        let url = params.parse_with_url(&url);
23508
23509        loop {
23510            let token = match self
23511                .hub
23512                .auth
23513                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23514                .await
23515            {
23516                Ok(token) => token,
23517                Err(e) => match dlg.token(e) {
23518                    Ok(token) => token,
23519                    Err(e) => {
23520                        dlg.finished(false);
23521                        return Err(common::Error::MissingToken(e));
23522                    }
23523                },
23524            };
23525            let mut req_result = {
23526                let client = &self.hub.client;
23527                dlg.pre_request();
23528                let mut req_builder = hyper::Request::builder()
23529                    .method(hyper::Method::GET)
23530                    .uri(url.as_str())
23531                    .header(USER_AGENT, self.hub._user_agent.clone());
23532
23533                if let Some(token) = token.as_ref() {
23534                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23535                }
23536
23537                let request = req_builder
23538                    .header(CONTENT_LENGTH, 0_u64)
23539                    .body(common::to_body::<String>(None));
23540
23541                client.request(request.unwrap()).await
23542            };
23543
23544            match req_result {
23545                Err(err) => {
23546                    if let common::Retry::After(d) = dlg.http_error(&err) {
23547                        sleep(d).await;
23548                        continue;
23549                    }
23550                    dlg.finished(false);
23551                    return Err(common::Error::HttpError(err));
23552                }
23553                Ok(res) => {
23554                    let (mut parts, body) = res.into_parts();
23555                    let mut body = common::Body::new(body);
23556                    if !parts.status.is_success() {
23557                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23558                        let error = serde_json::from_str(&common::to_string(&bytes));
23559                        let response = common::to_response(parts, bytes.into());
23560
23561                        if let common::Retry::After(d) =
23562                            dlg.http_failure(&response, error.as_ref().ok())
23563                        {
23564                            sleep(d).await;
23565                            continue;
23566                        }
23567
23568                        dlg.finished(false);
23569
23570                        return Err(match error {
23571                            Ok(value) => common::Error::BadRequest(value),
23572                            _ => common::Error::Failure(response),
23573                        });
23574                    }
23575                    let response = {
23576                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23577                        let encoded = common::to_string(&bytes);
23578                        match serde_json::from_str(&encoded) {
23579                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23580                            Err(error) => {
23581                                dlg.response_json_decode_error(&encoded, &error);
23582                                return Err(common::Error::JsonDecodeError(
23583                                    encoded.to_string(),
23584                                    error,
23585                                ));
23586                            }
23587                        }
23588                    };
23589
23590                    dlg.finished(true);
23591                    return Ok(response);
23592                }
23593            }
23594        }
23595    }
23596
23597    /// User profile ID associated with this request.
23598    ///
23599    /// Sets the *profile id* path property to the given value.
23600    ///
23601    /// Even though the property as already been set when instantiating this call,
23602    /// we provide this method for API completeness.
23603    pub fn profile_id(mut self, new_value: i64) -> AdvertiserLandingPageGetCall<'a, C> {
23604        self._profile_id = new_value;
23605        self
23606    }
23607    /// Landing page ID.
23608    ///
23609    /// Sets the *id* path property to the given value.
23610    ///
23611    /// Even though the property as already been set when instantiating this call,
23612    /// we provide this method for API completeness.
23613    pub fn id(mut self, new_value: i64) -> AdvertiserLandingPageGetCall<'a, C> {
23614        self._id = new_value;
23615        self
23616    }
23617    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23618    /// while executing the actual API request.
23619    ///
23620    /// ````text
23621    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23622    /// ````
23623    ///
23624    /// Sets the *delegate* property to the given value.
23625    pub fn delegate(
23626        mut self,
23627        new_value: &'a mut dyn common::Delegate,
23628    ) -> AdvertiserLandingPageGetCall<'a, C> {
23629        self._delegate = Some(new_value);
23630        self
23631    }
23632
23633    /// Set any additional parameter of the query string used in the request.
23634    /// It should be used to set parameters which are not yet available through their own
23635    /// setters.
23636    ///
23637    /// Please note that this method must not be used to set any of the known parameters
23638    /// which have their own setter method. If done anyway, the request will fail.
23639    ///
23640    /// # Additional Parameters
23641    ///
23642    /// * *$.xgafv* (query-string) - V1 error format.
23643    /// * *access_token* (query-string) - OAuth access token.
23644    /// * *alt* (query-string) - Data format for response.
23645    /// * *callback* (query-string) - JSONP
23646    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23647    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
23648    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23649    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23650    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
23651    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23652    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23653    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserLandingPageGetCall<'a, C>
23654    where
23655        T: AsRef<str>,
23656    {
23657        self._additional_params
23658            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23659        self
23660    }
23661
23662    /// Identifies the authorization scope for the method you are building.
23663    ///
23664    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23665    /// [`Scope::Dfatrafficking`].
23666    ///
23667    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23668    /// tokens for more than one scope.
23669    ///
23670    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23671    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23672    /// sufficient, a read-write scope will do as well.
23673    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserLandingPageGetCall<'a, C>
23674    where
23675        St: AsRef<str>,
23676    {
23677        self._scopes.insert(String::from(scope.as_ref()));
23678        self
23679    }
23680    /// Identifies the authorization scope(s) for the method you are building.
23681    ///
23682    /// See [`Self::add_scope()`] for details.
23683    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserLandingPageGetCall<'a, C>
23684    where
23685        I: IntoIterator<Item = St>,
23686        St: AsRef<str>,
23687    {
23688        self._scopes
23689            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23690        self
23691    }
23692
23693    /// Removes all scopes, and no default scope will be used either.
23694    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23695    /// for details).
23696    pub fn clear_scopes(mut self) -> AdvertiserLandingPageGetCall<'a, C> {
23697        self._scopes.clear();
23698        self
23699    }
23700}
23701
23702/// Inserts a new landing page.
23703///
23704/// A builder for the *insert* method supported by a *advertiserLandingPage* resource.
23705/// It is not used directly, but through a [`AdvertiserLandingPageMethods`] instance.
23706///
23707/// # Example
23708///
23709/// Instantiate a resource method builder
23710///
23711/// ```test_harness,no_run
23712/// # extern crate hyper;
23713/// # extern crate hyper_rustls;
23714/// # extern crate google_dfareporting3d3 as dfareporting3d3;
23715/// use dfareporting3d3::api::LandingPage;
23716/// # async fn dox() {
23717/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23718///
23719/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23720/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
23721/// #     secret,
23722/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23723/// # ).build().await.unwrap();
23724///
23725/// # let client = hyper_util::client::legacy::Client::builder(
23726/// #     hyper_util::rt::TokioExecutor::new()
23727/// # )
23728/// # .build(
23729/// #     hyper_rustls::HttpsConnectorBuilder::new()
23730/// #         .with_native_roots()
23731/// #         .unwrap()
23732/// #         .https_or_http()
23733/// #         .enable_http1()
23734/// #         .build()
23735/// # );
23736/// # let mut hub = Dfareporting::new(client, auth);
23737/// // As the method needs a request, you would usually fill it with the desired information
23738/// // into the respective structure. Some of the parts shown here might not be applicable !
23739/// // Values shown here are possibly random and not representative !
23740/// let mut req = LandingPage::default();
23741///
23742/// // You can configure optional parameters by calling the respective setters at will, and
23743/// // execute the final call using `doit()`.
23744/// // Values shown here are possibly random and not representative !
23745/// let result = hub.advertiser_landing_pages().insert(req, -56)
23746///              .doit().await;
23747/// # }
23748/// ```
23749pub struct AdvertiserLandingPageInsertCall<'a, C>
23750where
23751    C: 'a,
23752{
23753    hub: &'a Dfareporting<C>,
23754    _request: LandingPage,
23755    _profile_id: i64,
23756    _delegate: Option<&'a mut dyn common::Delegate>,
23757    _additional_params: HashMap<String, String>,
23758    _scopes: BTreeSet<String>,
23759}
23760
23761impl<'a, C> common::CallBuilder for AdvertiserLandingPageInsertCall<'a, C> {}
23762
23763impl<'a, C> AdvertiserLandingPageInsertCall<'a, C>
23764where
23765    C: common::Connector,
23766{
23767    /// Perform the operation you have build so far.
23768    pub async fn doit(mut self) -> common::Result<(common::Response, LandingPage)> {
23769        use std::borrow::Cow;
23770        use std::io::{Read, Seek};
23771
23772        use common::{url::Params, ToParts};
23773        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23774
23775        let mut dd = common::DefaultDelegate;
23776        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23777        dlg.begin(common::MethodInfo {
23778            id: "dfareporting.advertiserLandingPages.insert",
23779            http_method: hyper::Method::POST,
23780        });
23781
23782        for &field in ["alt", "profileId"].iter() {
23783            if self._additional_params.contains_key(field) {
23784                dlg.finished(false);
23785                return Err(common::Error::FieldClash(field));
23786            }
23787        }
23788
23789        let mut params = Params::with_capacity(4 + self._additional_params.len());
23790        params.push("profileId", self._profile_id.to_string());
23791
23792        params.extend(self._additional_params.iter());
23793
23794        params.push("alt", "json");
23795        let mut url =
23796            self.hub._base_url.clone() + "userprofiles/{profileId}/advertiserLandingPages";
23797        if self._scopes.is_empty() {
23798            self._scopes
23799                .insert(Scope::Dfatrafficking.as_ref().to_string());
23800        }
23801
23802        #[allow(clippy::single_element_loop)]
23803        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
23804            url = params.uri_replacement(url, param_name, find_this, false);
23805        }
23806        {
23807            let to_remove = ["profileId"];
23808            params.remove_params(&to_remove);
23809        }
23810
23811        let url = params.parse_with_url(&url);
23812
23813        let mut json_mime_type = mime::APPLICATION_JSON;
23814        let mut request_value_reader = {
23815            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23816            common::remove_json_null_values(&mut value);
23817            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23818            serde_json::to_writer(&mut dst, &value).unwrap();
23819            dst
23820        };
23821        let request_size = request_value_reader
23822            .seek(std::io::SeekFrom::End(0))
23823            .unwrap();
23824        request_value_reader
23825            .seek(std::io::SeekFrom::Start(0))
23826            .unwrap();
23827
23828        loop {
23829            let token = match self
23830                .hub
23831                .auth
23832                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23833                .await
23834            {
23835                Ok(token) => token,
23836                Err(e) => match dlg.token(e) {
23837                    Ok(token) => token,
23838                    Err(e) => {
23839                        dlg.finished(false);
23840                        return Err(common::Error::MissingToken(e));
23841                    }
23842                },
23843            };
23844            request_value_reader
23845                .seek(std::io::SeekFrom::Start(0))
23846                .unwrap();
23847            let mut req_result = {
23848                let client = &self.hub.client;
23849                dlg.pre_request();
23850                let mut req_builder = hyper::Request::builder()
23851                    .method(hyper::Method::POST)
23852                    .uri(url.as_str())
23853                    .header(USER_AGENT, self.hub._user_agent.clone());
23854
23855                if let Some(token) = token.as_ref() {
23856                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23857                }
23858
23859                let request = req_builder
23860                    .header(CONTENT_TYPE, json_mime_type.to_string())
23861                    .header(CONTENT_LENGTH, request_size as u64)
23862                    .body(common::to_body(
23863                        request_value_reader.get_ref().clone().into(),
23864                    ));
23865
23866                client.request(request.unwrap()).await
23867            };
23868
23869            match req_result {
23870                Err(err) => {
23871                    if let common::Retry::After(d) = dlg.http_error(&err) {
23872                        sleep(d).await;
23873                        continue;
23874                    }
23875                    dlg.finished(false);
23876                    return Err(common::Error::HttpError(err));
23877                }
23878                Ok(res) => {
23879                    let (mut parts, body) = res.into_parts();
23880                    let mut body = common::Body::new(body);
23881                    if !parts.status.is_success() {
23882                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23883                        let error = serde_json::from_str(&common::to_string(&bytes));
23884                        let response = common::to_response(parts, bytes.into());
23885
23886                        if let common::Retry::After(d) =
23887                            dlg.http_failure(&response, error.as_ref().ok())
23888                        {
23889                            sleep(d).await;
23890                            continue;
23891                        }
23892
23893                        dlg.finished(false);
23894
23895                        return Err(match error {
23896                            Ok(value) => common::Error::BadRequest(value),
23897                            _ => common::Error::Failure(response),
23898                        });
23899                    }
23900                    let response = {
23901                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23902                        let encoded = common::to_string(&bytes);
23903                        match serde_json::from_str(&encoded) {
23904                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23905                            Err(error) => {
23906                                dlg.response_json_decode_error(&encoded, &error);
23907                                return Err(common::Error::JsonDecodeError(
23908                                    encoded.to_string(),
23909                                    error,
23910                                ));
23911                            }
23912                        }
23913                    };
23914
23915                    dlg.finished(true);
23916                    return Ok(response);
23917                }
23918            }
23919        }
23920    }
23921
23922    ///
23923    /// Sets the *request* property to the given value.
23924    ///
23925    /// Even though the property as already been set when instantiating this call,
23926    /// we provide this method for API completeness.
23927    pub fn request(mut self, new_value: LandingPage) -> AdvertiserLandingPageInsertCall<'a, C> {
23928        self._request = new_value;
23929        self
23930    }
23931    /// User profile ID associated with this request.
23932    ///
23933    /// Sets the *profile id* path property to the given value.
23934    ///
23935    /// Even though the property as already been set when instantiating this call,
23936    /// we provide this method for API completeness.
23937    pub fn profile_id(mut self, new_value: i64) -> AdvertiserLandingPageInsertCall<'a, C> {
23938        self._profile_id = new_value;
23939        self
23940    }
23941    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23942    /// while executing the actual API request.
23943    ///
23944    /// ````text
23945    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23946    /// ````
23947    ///
23948    /// Sets the *delegate* property to the given value.
23949    pub fn delegate(
23950        mut self,
23951        new_value: &'a mut dyn common::Delegate,
23952    ) -> AdvertiserLandingPageInsertCall<'a, C> {
23953        self._delegate = Some(new_value);
23954        self
23955    }
23956
23957    /// Set any additional parameter of the query string used in the request.
23958    /// It should be used to set parameters which are not yet available through their own
23959    /// setters.
23960    ///
23961    /// Please note that this method must not be used to set any of the known parameters
23962    /// which have their own setter method. If done anyway, the request will fail.
23963    ///
23964    /// # Additional Parameters
23965    ///
23966    /// * *$.xgafv* (query-string) - V1 error format.
23967    /// * *access_token* (query-string) - OAuth access token.
23968    /// * *alt* (query-string) - Data format for response.
23969    /// * *callback* (query-string) - JSONP
23970    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23971    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
23972    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23973    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23974    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
23975    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23976    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23977    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserLandingPageInsertCall<'a, C>
23978    where
23979        T: AsRef<str>,
23980    {
23981        self._additional_params
23982            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23983        self
23984    }
23985
23986    /// Identifies the authorization scope for the method you are building.
23987    ///
23988    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23989    /// [`Scope::Dfatrafficking`].
23990    ///
23991    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23992    /// tokens for more than one scope.
23993    ///
23994    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23995    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23996    /// sufficient, a read-write scope will do as well.
23997    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserLandingPageInsertCall<'a, C>
23998    where
23999        St: AsRef<str>,
24000    {
24001        self._scopes.insert(String::from(scope.as_ref()));
24002        self
24003    }
24004    /// Identifies the authorization scope(s) for the method you are building.
24005    ///
24006    /// See [`Self::add_scope()`] for details.
24007    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserLandingPageInsertCall<'a, C>
24008    where
24009        I: IntoIterator<Item = St>,
24010        St: AsRef<str>,
24011    {
24012        self._scopes
24013            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24014        self
24015    }
24016
24017    /// Removes all scopes, and no default scope will be used either.
24018    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24019    /// for details).
24020    pub fn clear_scopes(mut self) -> AdvertiserLandingPageInsertCall<'a, C> {
24021        self._scopes.clear();
24022        self
24023    }
24024}
24025
24026/// Retrieves a list of landing pages.
24027///
24028/// A builder for the *list* method supported by a *advertiserLandingPage* resource.
24029/// It is not used directly, but through a [`AdvertiserLandingPageMethods`] instance.
24030///
24031/// # Example
24032///
24033/// Instantiate a resource method builder
24034///
24035/// ```test_harness,no_run
24036/// # extern crate hyper;
24037/// # extern crate hyper_rustls;
24038/// # extern crate google_dfareporting3d3 as dfareporting3d3;
24039/// # async fn dox() {
24040/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24041///
24042/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24043/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
24044/// #     secret,
24045/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24046/// # ).build().await.unwrap();
24047///
24048/// # let client = hyper_util::client::legacy::Client::builder(
24049/// #     hyper_util::rt::TokioExecutor::new()
24050/// # )
24051/// # .build(
24052/// #     hyper_rustls::HttpsConnectorBuilder::new()
24053/// #         .with_native_roots()
24054/// #         .unwrap()
24055/// #         .https_or_http()
24056/// #         .enable_http1()
24057/// #         .build()
24058/// # );
24059/// # let mut hub = Dfareporting::new(client, auth);
24060/// // You can configure optional parameters by calling the respective setters at will, and
24061/// // execute the final call using `doit()`.
24062/// // Values shown here are possibly random and not representative !
24063/// let result = hub.advertiser_landing_pages().list(-7)
24064///              .subaccount_id(-30)
24065///              .sort_order("diam")
24066///              .sort_field("dolores")
24067///              .search_string("dolores")
24068///              .page_token("et")
24069///              .max_results(-93)
24070///              .add_ids(-11)
24071///              .add_campaign_ids(-85)
24072///              .archived(false)
24073///              .add_advertiser_ids(-80)
24074///              .doit().await;
24075/// # }
24076/// ```
24077pub struct AdvertiserLandingPageListCall<'a, C>
24078where
24079    C: 'a,
24080{
24081    hub: &'a Dfareporting<C>,
24082    _profile_id: i64,
24083    _subaccount_id: Option<i64>,
24084    _sort_order: Option<String>,
24085    _sort_field: Option<String>,
24086    _search_string: Option<String>,
24087    _page_token: Option<String>,
24088    _max_results: Option<i32>,
24089    _ids: Vec<i64>,
24090    _campaign_ids: Vec<i64>,
24091    _archived: Option<bool>,
24092    _advertiser_ids: Vec<i64>,
24093    _delegate: Option<&'a mut dyn common::Delegate>,
24094    _additional_params: HashMap<String, String>,
24095    _scopes: BTreeSet<String>,
24096}
24097
24098impl<'a, C> common::CallBuilder for AdvertiserLandingPageListCall<'a, C> {}
24099
24100impl<'a, C> AdvertiserLandingPageListCall<'a, C>
24101where
24102    C: common::Connector,
24103{
24104    /// Perform the operation you have build so far.
24105    pub async fn doit(
24106        mut self,
24107    ) -> common::Result<(common::Response, AdvertiserLandingPagesListResponse)> {
24108        use std::borrow::Cow;
24109        use std::io::{Read, Seek};
24110
24111        use common::{url::Params, ToParts};
24112        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24113
24114        let mut dd = common::DefaultDelegate;
24115        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24116        dlg.begin(common::MethodInfo {
24117            id: "dfareporting.advertiserLandingPages.list",
24118            http_method: hyper::Method::GET,
24119        });
24120
24121        for &field in [
24122            "alt",
24123            "profileId",
24124            "subaccountId",
24125            "sortOrder",
24126            "sortField",
24127            "searchString",
24128            "pageToken",
24129            "maxResults",
24130            "ids",
24131            "campaignIds",
24132            "archived",
24133            "advertiserIds",
24134        ]
24135        .iter()
24136        {
24137            if self._additional_params.contains_key(field) {
24138                dlg.finished(false);
24139                return Err(common::Error::FieldClash(field));
24140            }
24141        }
24142
24143        let mut params = Params::with_capacity(13 + self._additional_params.len());
24144        params.push("profileId", self._profile_id.to_string());
24145        if let Some(value) = self._subaccount_id.as_ref() {
24146            params.push("subaccountId", value.to_string());
24147        }
24148        if let Some(value) = self._sort_order.as_ref() {
24149            params.push("sortOrder", value);
24150        }
24151        if let Some(value) = self._sort_field.as_ref() {
24152            params.push("sortField", value);
24153        }
24154        if let Some(value) = self._search_string.as_ref() {
24155            params.push("searchString", value);
24156        }
24157        if let Some(value) = self._page_token.as_ref() {
24158            params.push("pageToken", value);
24159        }
24160        if let Some(value) = self._max_results.as_ref() {
24161            params.push("maxResults", value.to_string());
24162        }
24163        if !self._ids.is_empty() {
24164            for f in self._ids.iter() {
24165                params.push("ids", f.to_string());
24166            }
24167        }
24168        if !self._campaign_ids.is_empty() {
24169            for f in self._campaign_ids.iter() {
24170                params.push("campaignIds", f.to_string());
24171            }
24172        }
24173        if let Some(value) = self._archived.as_ref() {
24174            params.push("archived", value.to_string());
24175        }
24176        if !self._advertiser_ids.is_empty() {
24177            for f in self._advertiser_ids.iter() {
24178                params.push("advertiserIds", f.to_string());
24179            }
24180        }
24181
24182        params.extend(self._additional_params.iter());
24183
24184        params.push("alt", "json");
24185        let mut url =
24186            self.hub._base_url.clone() + "userprofiles/{profileId}/advertiserLandingPages";
24187        if self._scopes.is_empty() {
24188            self._scopes
24189                .insert(Scope::Dfatrafficking.as_ref().to_string());
24190        }
24191
24192        #[allow(clippy::single_element_loop)]
24193        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
24194            url = params.uri_replacement(url, param_name, find_this, false);
24195        }
24196        {
24197            let to_remove = ["profileId"];
24198            params.remove_params(&to_remove);
24199        }
24200
24201        let url = params.parse_with_url(&url);
24202
24203        loop {
24204            let token = match self
24205                .hub
24206                .auth
24207                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24208                .await
24209            {
24210                Ok(token) => token,
24211                Err(e) => match dlg.token(e) {
24212                    Ok(token) => token,
24213                    Err(e) => {
24214                        dlg.finished(false);
24215                        return Err(common::Error::MissingToken(e));
24216                    }
24217                },
24218            };
24219            let mut req_result = {
24220                let client = &self.hub.client;
24221                dlg.pre_request();
24222                let mut req_builder = hyper::Request::builder()
24223                    .method(hyper::Method::GET)
24224                    .uri(url.as_str())
24225                    .header(USER_AGENT, self.hub._user_agent.clone());
24226
24227                if let Some(token) = token.as_ref() {
24228                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24229                }
24230
24231                let request = req_builder
24232                    .header(CONTENT_LENGTH, 0_u64)
24233                    .body(common::to_body::<String>(None));
24234
24235                client.request(request.unwrap()).await
24236            };
24237
24238            match req_result {
24239                Err(err) => {
24240                    if let common::Retry::After(d) = dlg.http_error(&err) {
24241                        sleep(d).await;
24242                        continue;
24243                    }
24244                    dlg.finished(false);
24245                    return Err(common::Error::HttpError(err));
24246                }
24247                Ok(res) => {
24248                    let (mut parts, body) = res.into_parts();
24249                    let mut body = common::Body::new(body);
24250                    if !parts.status.is_success() {
24251                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24252                        let error = serde_json::from_str(&common::to_string(&bytes));
24253                        let response = common::to_response(parts, bytes.into());
24254
24255                        if let common::Retry::After(d) =
24256                            dlg.http_failure(&response, error.as_ref().ok())
24257                        {
24258                            sleep(d).await;
24259                            continue;
24260                        }
24261
24262                        dlg.finished(false);
24263
24264                        return Err(match error {
24265                            Ok(value) => common::Error::BadRequest(value),
24266                            _ => common::Error::Failure(response),
24267                        });
24268                    }
24269                    let response = {
24270                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24271                        let encoded = common::to_string(&bytes);
24272                        match serde_json::from_str(&encoded) {
24273                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24274                            Err(error) => {
24275                                dlg.response_json_decode_error(&encoded, &error);
24276                                return Err(common::Error::JsonDecodeError(
24277                                    encoded.to_string(),
24278                                    error,
24279                                ));
24280                            }
24281                        }
24282                    };
24283
24284                    dlg.finished(true);
24285                    return Ok(response);
24286                }
24287            }
24288        }
24289    }
24290
24291    /// User profile ID associated with this request.
24292    ///
24293    /// Sets the *profile id* path property to the given value.
24294    ///
24295    /// Even though the property as already been set when instantiating this call,
24296    /// we provide this method for API completeness.
24297    pub fn profile_id(mut self, new_value: i64) -> AdvertiserLandingPageListCall<'a, C> {
24298        self._profile_id = new_value;
24299        self
24300    }
24301    /// Select only landing pages that belong to this subaccount.
24302    ///
24303    /// Sets the *subaccount id* query property to the given value.
24304    pub fn subaccount_id(mut self, new_value: i64) -> AdvertiserLandingPageListCall<'a, C> {
24305        self._subaccount_id = Some(new_value);
24306        self
24307    }
24308    /// Order of sorted results.
24309    ///
24310    /// Sets the *sort order* query property to the given value.
24311    pub fn sort_order(mut self, new_value: &str) -> AdvertiserLandingPageListCall<'a, C> {
24312        self._sort_order = Some(new_value.to_string());
24313        self
24314    }
24315    /// Field by which to sort the list.
24316    ///
24317    /// Sets the *sort field* query property to the given value.
24318    pub fn sort_field(mut self, new_value: &str) -> AdvertiserLandingPageListCall<'a, C> {
24319        self._sort_field = Some(new_value.to_string());
24320        self
24321    }
24322    /// Allows searching for landing pages by name or ID. Wildcards (*) are allowed. For example, "landingpage*2017" will return landing pages with names like "landingpage July 2017", "landingpage March 2017", or simply "landingpage 2017". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "landingpage" will match campaigns with name "my landingpage", "landingpage 2015", or simply "landingpage".
24323    ///
24324    /// Sets the *search string* query property to the given value.
24325    pub fn search_string(mut self, new_value: &str) -> AdvertiserLandingPageListCall<'a, C> {
24326        self._search_string = Some(new_value.to_string());
24327        self
24328    }
24329    /// Value of the nextPageToken from the previous result page.
24330    ///
24331    /// Sets the *page token* query property to the given value.
24332    pub fn page_token(mut self, new_value: &str) -> AdvertiserLandingPageListCall<'a, C> {
24333        self._page_token = Some(new_value.to_string());
24334        self
24335    }
24336    /// Maximum number of results to return.
24337    ///
24338    /// Sets the *max results* query property to the given value.
24339    pub fn max_results(mut self, new_value: i32) -> AdvertiserLandingPageListCall<'a, C> {
24340        self._max_results = Some(new_value);
24341        self
24342    }
24343    /// Select only landing pages with these IDs.
24344    ///
24345    /// Append the given value to the *ids* query property.
24346    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
24347    pub fn add_ids(mut self, new_value: i64) -> AdvertiserLandingPageListCall<'a, C> {
24348        self._ids.push(new_value);
24349        self
24350    }
24351    /// Select only landing pages that are associated with these campaigns.
24352    ///
24353    /// Append the given value to the *campaign ids* query property.
24354    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
24355    pub fn add_campaign_ids(mut self, new_value: i64) -> AdvertiserLandingPageListCall<'a, C> {
24356        self._campaign_ids.push(new_value);
24357        self
24358    }
24359    /// Select only archived landing pages. Don't set this field to select both archived and non-archived landing pages.
24360    ///
24361    /// Sets the *archived* query property to the given value.
24362    pub fn archived(mut self, new_value: bool) -> AdvertiserLandingPageListCall<'a, C> {
24363        self._archived = Some(new_value);
24364        self
24365    }
24366    /// Select only landing pages that belong to these advertisers.
24367    ///
24368    /// Append the given value to the *advertiser ids* query property.
24369    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
24370    pub fn add_advertiser_ids(mut self, new_value: i64) -> AdvertiserLandingPageListCall<'a, C> {
24371        self._advertiser_ids.push(new_value);
24372        self
24373    }
24374    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24375    /// while executing the actual API request.
24376    ///
24377    /// ````text
24378    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24379    /// ````
24380    ///
24381    /// Sets the *delegate* property to the given value.
24382    pub fn delegate(
24383        mut self,
24384        new_value: &'a mut dyn common::Delegate,
24385    ) -> AdvertiserLandingPageListCall<'a, C> {
24386        self._delegate = Some(new_value);
24387        self
24388    }
24389
24390    /// Set any additional parameter of the query string used in the request.
24391    /// It should be used to set parameters which are not yet available through their own
24392    /// setters.
24393    ///
24394    /// Please note that this method must not be used to set any of the known parameters
24395    /// which have their own setter method. If done anyway, the request will fail.
24396    ///
24397    /// # Additional Parameters
24398    ///
24399    /// * *$.xgafv* (query-string) - V1 error format.
24400    /// * *access_token* (query-string) - OAuth access token.
24401    /// * *alt* (query-string) - Data format for response.
24402    /// * *callback* (query-string) - JSONP
24403    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24404    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
24405    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24406    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24407    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
24408    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24409    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24410    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserLandingPageListCall<'a, C>
24411    where
24412        T: AsRef<str>,
24413    {
24414        self._additional_params
24415            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24416        self
24417    }
24418
24419    /// Identifies the authorization scope for the method you are building.
24420    ///
24421    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24422    /// [`Scope::Dfatrafficking`].
24423    ///
24424    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24425    /// tokens for more than one scope.
24426    ///
24427    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24428    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24429    /// sufficient, a read-write scope will do as well.
24430    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserLandingPageListCall<'a, C>
24431    where
24432        St: AsRef<str>,
24433    {
24434        self._scopes.insert(String::from(scope.as_ref()));
24435        self
24436    }
24437    /// Identifies the authorization scope(s) for the method you are building.
24438    ///
24439    /// See [`Self::add_scope()`] for details.
24440    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserLandingPageListCall<'a, C>
24441    where
24442        I: IntoIterator<Item = St>,
24443        St: AsRef<str>,
24444    {
24445        self._scopes
24446            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24447        self
24448    }
24449
24450    /// Removes all scopes, and no default scope will be used either.
24451    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24452    /// for details).
24453    pub fn clear_scopes(mut self) -> AdvertiserLandingPageListCall<'a, C> {
24454        self._scopes.clear();
24455        self
24456    }
24457}
24458
24459/// Updates an existing advertiser landing page. This method supports patch semantics.
24460///
24461/// A builder for the *patch* method supported by a *advertiserLandingPage* resource.
24462/// It is not used directly, but through a [`AdvertiserLandingPageMethods`] instance.
24463///
24464/// # Example
24465///
24466/// Instantiate a resource method builder
24467///
24468/// ```test_harness,no_run
24469/// # extern crate hyper;
24470/// # extern crate hyper_rustls;
24471/// # extern crate google_dfareporting3d3 as dfareporting3d3;
24472/// use dfareporting3d3::api::LandingPage;
24473/// # async fn dox() {
24474/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24475///
24476/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24477/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
24478/// #     secret,
24479/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24480/// # ).build().await.unwrap();
24481///
24482/// # let client = hyper_util::client::legacy::Client::builder(
24483/// #     hyper_util::rt::TokioExecutor::new()
24484/// # )
24485/// # .build(
24486/// #     hyper_rustls::HttpsConnectorBuilder::new()
24487/// #         .with_native_roots()
24488/// #         .unwrap()
24489/// #         .https_or_http()
24490/// #         .enable_http1()
24491/// #         .build()
24492/// # );
24493/// # let mut hub = Dfareporting::new(client, auth);
24494/// // As the method needs a request, you would usually fill it with the desired information
24495/// // into the respective structure. Some of the parts shown here might not be applicable !
24496/// // Values shown here are possibly random and not representative !
24497/// let mut req = LandingPage::default();
24498///
24499/// // You can configure optional parameters by calling the respective setters at will, and
24500/// // execute the final call using `doit()`.
24501/// // Values shown here are possibly random and not representative !
24502/// let result = hub.advertiser_landing_pages().patch(req, -61, -91)
24503///              .doit().await;
24504/// # }
24505/// ```
24506pub struct AdvertiserLandingPagePatchCall<'a, C>
24507where
24508    C: 'a,
24509{
24510    hub: &'a Dfareporting<C>,
24511    _request: LandingPage,
24512    _profile_id: i64,
24513    _id: i64,
24514    _delegate: Option<&'a mut dyn common::Delegate>,
24515    _additional_params: HashMap<String, String>,
24516    _scopes: BTreeSet<String>,
24517}
24518
24519impl<'a, C> common::CallBuilder for AdvertiserLandingPagePatchCall<'a, C> {}
24520
24521impl<'a, C> AdvertiserLandingPagePatchCall<'a, C>
24522where
24523    C: common::Connector,
24524{
24525    /// Perform the operation you have build so far.
24526    pub async fn doit(mut self) -> common::Result<(common::Response, LandingPage)> {
24527        use std::borrow::Cow;
24528        use std::io::{Read, Seek};
24529
24530        use common::{url::Params, ToParts};
24531        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24532
24533        let mut dd = common::DefaultDelegate;
24534        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24535        dlg.begin(common::MethodInfo {
24536            id: "dfareporting.advertiserLandingPages.patch",
24537            http_method: hyper::Method::PATCH,
24538        });
24539
24540        for &field in ["alt", "profileId", "id"].iter() {
24541            if self._additional_params.contains_key(field) {
24542                dlg.finished(false);
24543                return Err(common::Error::FieldClash(field));
24544            }
24545        }
24546
24547        let mut params = Params::with_capacity(5 + self._additional_params.len());
24548        params.push("profileId", self._profile_id.to_string());
24549        params.push("id", self._id.to_string());
24550
24551        params.extend(self._additional_params.iter());
24552
24553        params.push("alt", "json");
24554        let mut url =
24555            self.hub._base_url.clone() + "userprofiles/{profileId}/advertiserLandingPages";
24556        if self._scopes.is_empty() {
24557            self._scopes
24558                .insert(Scope::Dfatrafficking.as_ref().to_string());
24559        }
24560
24561        #[allow(clippy::single_element_loop)]
24562        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
24563            url = params.uri_replacement(url, param_name, find_this, false);
24564        }
24565        {
24566            let to_remove = ["profileId"];
24567            params.remove_params(&to_remove);
24568        }
24569
24570        let url = params.parse_with_url(&url);
24571
24572        let mut json_mime_type = mime::APPLICATION_JSON;
24573        let mut request_value_reader = {
24574            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24575            common::remove_json_null_values(&mut value);
24576            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24577            serde_json::to_writer(&mut dst, &value).unwrap();
24578            dst
24579        };
24580        let request_size = request_value_reader
24581            .seek(std::io::SeekFrom::End(0))
24582            .unwrap();
24583        request_value_reader
24584            .seek(std::io::SeekFrom::Start(0))
24585            .unwrap();
24586
24587        loop {
24588            let token = match self
24589                .hub
24590                .auth
24591                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24592                .await
24593            {
24594                Ok(token) => token,
24595                Err(e) => match dlg.token(e) {
24596                    Ok(token) => token,
24597                    Err(e) => {
24598                        dlg.finished(false);
24599                        return Err(common::Error::MissingToken(e));
24600                    }
24601                },
24602            };
24603            request_value_reader
24604                .seek(std::io::SeekFrom::Start(0))
24605                .unwrap();
24606            let mut req_result = {
24607                let client = &self.hub.client;
24608                dlg.pre_request();
24609                let mut req_builder = hyper::Request::builder()
24610                    .method(hyper::Method::PATCH)
24611                    .uri(url.as_str())
24612                    .header(USER_AGENT, self.hub._user_agent.clone());
24613
24614                if let Some(token) = token.as_ref() {
24615                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24616                }
24617
24618                let request = req_builder
24619                    .header(CONTENT_TYPE, json_mime_type.to_string())
24620                    .header(CONTENT_LENGTH, request_size as u64)
24621                    .body(common::to_body(
24622                        request_value_reader.get_ref().clone().into(),
24623                    ));
24624
24625                client.request(request.unwrap()).await
24626            };
24627
24628            match req_result {
24629                Err(err) => {
24630                    if let common::Retry::After(d) = dlg.http_error(&err) {
24631                        sleep(d).await;
24632                        continue;
24633                    }
24634                    dlg.finished(false);
24635                    return Err(common::Error::HttpError(err));
24636                }
24637                Ok(res) => {
24638                    let (mut parts, body) = res.into_parts();
24639                    let mut body = common::Body::new(body);
24640                    if !parts.status.is_success() {
24641                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24642                        let error = serde_json::from_str(&common::to_string(&bytes));
24643                        let response = common::to_response(parts, bytes.into());
24644
24645                        if let common::Retry::After(d) =
24646                            dlg.http_failure(&response, error.as_ref().ok())
24647                        {
24648                            sleep(d).await;
24649                            continue;
24650                        }
24651
24652                        dlg.finished(false);
24653
24654                        return Err(match error {
24655                            Ok(value) => common::Error::BadRequest(value),
24656                            _ => common::Error::Failure(response),
24657                        });
24658                    }
24659                    let response = {
24660                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24661                        let encoded = common::to_string(&bytes);
24662                        match serde_json::from_str(&encoded) {
24663                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24664                            Err(error) => {
24665                                dlg.response_json_decode_error(&encoded, &error);
24666                                return Err(common::Error::JsonDecodeError(
24667                                    encoded.to_string(),
24668                                    error,
24669                                ));
24670                            }
24671                        }
24672                    };
24673
24674                    dlg.finished(true);
24675                    return Ok(response);
24676                }
24677            }
24678        }
24679    }
24680
24681    ///
24682    /// Sets the *request* property to the given value.
24683    ///
24684    /// Even though the property as already been set when instantiating this call,
24685    /// we provide this method for API completeness.
24686    pub fn request(mut self, new_value: LandingPage) -> AdvertiserLandingPagePatchCall<'a, C> {
24687        self._request = new_value;
24688        self
24689    }
24690    /// User profile ID associated with this request.
24691    ///
24692    /// Sets the *profile id* path property to the given value.
24693    ///
24694    /// Even though the property as already been set when instantiating this call,
24695    /// we provide this method for API completeness.
24696    pub fn profile_id(mut self, new_value: i64) -> AdvertiserLandingPagePatchCall<'a, C> {
24697        self._profile_id = new_value;
24698        self
24699    }
24700    /// LandingPage ID.
24701    ///
24702    /// Sets the *id* query property to the given value.
24703    ///
24704    /// Even though the property as already been set when instantiating this call,
24705    /// we provide this method for API completeness.
24706    pub fn id(mut self, new_value: i64) -> AdvertiserLandingPagePatchCall<'a, C> {
24707        self._id = new_value;
24708        self
24709    }
24710    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24711    /// while executing the actual API request.
24712    ///
24713    /// ````text
24714    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24715    /// ````
24716    ///
24717    /// Sets the *delegate* property to the given value.
24718    pub fn delegate(
24719        mut self,
24720        new_value: &'a mut dyn common::Delegate,
24721    ) -> AdvertiserLandingPagePatchCall<'a, C> {
24722        self._delegate = Some(new_value);
24723        self
24724    }
24725
24726    /// Set any additional parameter of the query string used in the request.
24727    /// It should be used to set parameters which are not yet available through their own
24728    /// setters.
24729    ///
24730    /// Please note that this method must not be used to set any of the known parameters
24731    /// which have their own setter method. If done anyway, the request will fail.
24732    ///
24733    /// # Additional Parameters
24734    ///
24735    /// * *$.xgafv* (query-string) - V1 error format.
24736    /// * *access_token* (query-string) - OAuth access token.
24737    /// * *alt* (query-string) - Data format for response.
24738    /// * *callback* (query-string) - JSONP
24739    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24740    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
24741    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24742    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24743    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
24744    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24745    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24746    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserLandingPagePatchCall<'a, C>
24747    where
24748        T: AsRef<str>,
24749    {
24750        self._additional_params
24751            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24752        self
24753    }
24754
24755    /// Identifies the authorization scope for the method you are building.
24756    ///
24757    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24758    /// [`Scope::Dfatrafficking`].
24759    ///
24760    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24761    /// tokens for more than one scope.
24762    ///
24763    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24764    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24765    /// sufficient, a read-write scope will do as well.
24766    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserLandingPagePatchCall<'a, C>
24767    where
24768        St: AsRef<str>,
24769    {
24770        self._scopes.insert(String::from(scope.as_ref()));
24771        self
24772    }
24773    /// Identifies the authorization scope(s) for the method you are building.
24774    ///
24775    /// See [`Self::add_scope()`] for details.
24776    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserLandingPagePatchCall<'a, C>
24777    where
24778        I: IntoIterator<Item = St>,
24779        St: AsRef<str>,
24780    {
24781        self._scopes
24782            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24783        self
24784    }
24785
24786    /// Removes all scopes, and no default scope will be used either.
24787    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24788    /// for details).
24789    pub fn clear_scopes(mut self) -> AdvertiserLandingPagePatchCall<'a, C> {
24790        self._scopes.clear();
24791        self
24792    }
24793}
24794
24795/// Updates an existing landing page.
24796///
24797/// A builder for the *update* method supported by a *advertiserLandingPage* resource.
24798/// It is not used directly, but through a [`AdvertiserLandingPageMethods`] instance.
24799///
24800/// # Example
24801///
24802/// Instantiate a resource method builder
24803///
24804/// ```test_harness,no_run
24805/// # extern crate hyper;
24806/// # extern crate hyper_rustls;
24807/// # extern crate google_dfareporting3d3 as dfareporting3d3;
24808/// use dfareporting3d3::api::LandingPage;
24809/// # async fn dox() {
24810/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24811///
24812/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24813/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
24814/// #     secret,
24815/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24816/// # ).build().await.unwrap();
24817///
24818/// # let client = hyper_util::client::legacy::Client::builder(
24819/// #     hyper_util::rt::TokioExecutor::new()
24820/// # )
24821/// # .build(
24822/// #     hyper_rustls::HttpsConnectorBuilder::new()
24823/// #         .with_native_roots()
24824/// #         .unwrap()
24825/// #         .https_or_http()
24826/// #         .enable_http1()
24827/// #         .build()
24828/// # );
24829/// # let mut hub = Dfareporting::new(client, auth);
24830/// // As the method needs a request, you would usually fill it with the desired information
24831/// // into the respective structure. Some of the parts shown here might not be applicable !
24832/// // Values shown here are possibly random and not representative !
24833/// let mut req = LandingPage::default();
24834///
24835/// // You can configure optional parameters by calling the respective setters at will, and
24836/// // execute the final call using `doit()`.
24837/// // Values shown here are possibly random and not representative !
24838/// let result = hub.advertiser_landing_pages().update(req, -77)
24839///              .doit().await;
24840/// # }
24841/// ```
24842pub struct AdvertiserLandingPageUpdateCall<'a, C>
24843where
24844    C: 'a,
24845{
24846    hub: &'a Dfareporting<C>,
24847    _request: LandingPage,
24848    _profile_id: i64,
24849    _delegate: Option<&'a mut dyn common::Delegate>,
24850    _additional_params: HashMap<String, String>,
24851    _scopes: BTreeSet<String>,
24852}
24853
24854impl<'a, C> common::CallBuilder for AdvertiserLandingPageUpdateCall<'a, C> {}
24855
24856impl<'a, C> AdvertiserLandingPageUpdateCall<'a, C>
24857where
24858    C: common::Connector,
24859{
24860    /// Perform the operation you have build so far.
24861    pub async fn doit(mut self) -> common::Result<(common::Response, LandingPage)> {
24862        use std::borrow::Cow;
24863        use std::io::{Read, Seek};
24864
24865        use common::{url::Params, ToParts};
24866        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24867
24868        let mut dd = common::DefaultDelegate;
24869        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24870        dlg.begin(common::MethodInfo {
24871            id: "dfareporting.advertiserLandingPages.update",
24872            http_method: hyper::Method::PUT,
24873        });
24874
24875        for &field in ["alt", "profileId"].iter() {
24876            if self._additional_params.contains_key(field) {
24877                dlg.finished(false);
24878                return Err(common::Error::FieldClash(field));
24879            }
24880        }
24881
24882        let mut params = Params::with_capacity(4 + self._additional_params.len());
24883        params.push("profileId", self._profile_id.to_string());
24884
24885        params.extend(self._additional_params.iter());
24886
24887        params.push("alt", "json");
24888        let mut url =
24889            self.hub._base_url.clone() + "userprofiles/{profileId}/advertiserLandingPages";
24890        if self._scopes.is_empty() {
24891            self._scopes
24892                .insert(Scope::Dfatrafficking.as_ref().to_string());
24893        }
24894
24895        #[allow(clippy::single_element_loop)]
24896        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
24897            url = params.uri_replacement(url, param_name, find_this, false);
24898        }
24899        {
24900            let to_remove = ["profileId"];
24901            params.remove_params(&to_remove);
24902        }
24903
24904        let url = params.parse_with_url(&url);
24905
24906        let mut json_mime_type = mime::APPLICATION_JSON;
24907        let mut request_value_reader = {
24908            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24909            common::remove_json_null_values(&mut value);
24910            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24911            serde_json::to_writer(&mut dst, &value).unwrap();
24912            dst
24913        };
24914        let request_size = request_value_reader
24915            .seek(std::io::SeekFrom::End(0))
24916            .unwrap();
24917        request_value_reader
24918            .seek(std::io::SeekFrom::Start(0))
24919            .unwrap();
24920
24921        loop {
24922            let token = match self
24923                .hub
24924                .auth
24925                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24926                .await
24927            {
24928                Ok(token) => token,
24929                Err(e) => match dlg.token(e) {
24930                    Ok(token) => token,
24931                    Err(e) => {
24932                        dlg.finished(false);
24933                        return Err(common::Error::MissingToken(e));
24934                    }
24935                },
24936            };
24937            request_value_reader
24938                .seek(std::io::SeekFrom::Start(0))
24939                .unwrap();
24940            let mut req_result = {
24941                let client = &self.hub.client;
24942                dlg.pre_request();
24943                let mut req_builder = hyper::Request::builder()
24944                    .method(hyper::Method::PUT)
24945                    .uri(url.as_str())
24946                    .header(USER_AGENT, self.hub._user_agent.clone());
24947
24948                if let Some(token) = token.as_ref() {
24949                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24950                }
24951
24952                let request = req_builder
24953                    .header(CONTENT_TYPE, json_mime_type.to_string())
24954                    .header(CONTENT_LENGTH, request_size as u64)
24955                    .body(common::to_body(
24956                        request_value_reader.get_ref().clone().into(),
24957                    ));
24958
24959                client.request(request.unwrap()).await
24960            };
24961
24962            match req_result {
24963                Err(err) => {
24964                    if let common::Retry::After(d) = dlg.http_error(&err) {
24965                        sleep(d).await;
24966                        continue;
24967                    }
24968                    dlg.finished(false);
24969                    return Err(common::Error::HttpError(err));
24970                }
24971                Ok(res) => {
24972                    let (mut parts, body) = res.into_parts();
24973                    let mut body = common::Body::new(body);
24974                    if !parts.status.is_success() {
24975                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24976                        let error = serde_json::from_str(&common::to_string(&bytes));
24977                        let response = common::to_response(parts, bytes.into());
24978
24979                        if let common::Retry::After(d) =
24980                            dlg.http_failure(&response, error.as_ref().ok())
24981                        {
24982                            sleep(d).await;
24983                            continue;
24984                        }
24985
24986                        dlg.finished(false);
24987
24988                        return Err(match error {
24989                            Ok(value) => common::Error::BadRequest(value),
24990                            _ => common::Error::Failure(response),
24991                        });
24992                    }
24993                    let response = {
24994                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24995                        let encoded = common::to_string(&bytes);
24996                        match serde_json::from_str(&encoded) {
24997                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24998                            Err(error) => {
24999                                dlg.response_json_decode_error(&encoded, &error);
25000                                return Err(common::Error::JsonDecodeError(
25001                                    encoded.to_string(),
25002                                    error,
25003                                ));
25004                            }
25005                        }
25006                    };
25007
25008                    dlg.finished(true);
25009                    return Ok(response);
25010                }
25011            }
25012        }
25013    }
25014
25015    ///
25016    /// Sets the *request* property to the given value.
25017    ///
25018    /// Even though the property as already been set when instantiating this call,
25019    /// we provide this method for API completeness.
25020    pub fn request(mut self, new_value: LandingPage) -> AdvertiserLandingPageUpdateCall<'a, C> {
25021        self._request = new_value;
25022        self
25023    }
25024    /// User profile ID associated with this request.
25025    ///
25026    /// Sets the *profile id* path property to the given value.
25027    ///
25028    /// Even though the property as already been set when instantiating this call,
25029    /// we provide this method for API completeness.
25030    pub fn profile_id(mut self, new_value: i64) -> AdvertiserLandingPageUpdateCall<'a, C> {
25031        self._profile_id = new_value;
25032        self
25033    }
25034    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25035    /// while executing the actual API request.
25036    ///
25037    /// ````text
25038    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
25039    /// ````
25040    ///
25041    /// Sets the *delegate* property to the given value.
25042    pub fn delegate(
25043        mut self,
25044        new_value: &'a mut dyn common::Delegate,
25045    ) -> AdvertiserLandingPageUpdateCall<'a, C> {
25046        self._delegate = Some(new_value);
25047        self
25048    }
25049
25050    /// Set any additional parameter of the query string used in the request.
25051    /// It should be used to set parameters which are not yet available through their own
25052    /// setters.
25053    ///
25054    /// Please note that this method must not be used to set any of the known parameters
25055    /// which have their own setter method. If done anyway, the request will fail.
25056    ///
25057    /// # Additional Parameters
25058    ///
25059    /// * *$.xgafv* (query-string) - V1 error format.
25060    /// * *access_token* (query-string) - OAuth access token.
25061    /// * *alt* (query-string) - Data format for response.
25062    /// * *callback* (query-string) - JSONP
25063    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25064    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
25065    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25066    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25067    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
25068    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25069    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25070    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserLandingPageUpdateCall<'a, C>
25071    where
25072        T: AsRef<str>,
25073    {
25074        self._additional_params
25075            .insert(name.as_ref().to_string(), value.as_ref().to_string());
25076        self
25077    }
25078
25079    /// Identifies the authorization scope for the method you are building.
25080    ///
25081    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25082    /// [`Scope::Dfatrafficking`].
25083    ///
25084    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25085    /// tokens for more than one scope.
25086    ///
25087    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25088    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25089    /// sufficient, a read-write scope will do as well.
25090    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserLandingPageUpdateCall<'a, C>
25091    where
25092        St: AsRef<str>,
25093    {
25094        self._scopes.insert(String::from(scope.as_ref()));
25095        self
25096    }
25097    /// Identifies the authorization scope(s) for the method you are building.
25098    ///
25099    /// See [`Self::add_scope()`] for details.
25100    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserLandingPageUpdateCall<'a, C>
25101    where
25102        I: IntoIterator<Item = St>,
25103        St: AsRef<str>,
25104    {
25105        self._scopes
25106            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25107        self
25108    }
25109
25110    /// Removes all scopes, and no default scope will be used either.
25111    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25112    /// for details).
25113    pub fn clear_scopes(mut self) -> AdvertiserLandingPageUpdateCall<'a, C> {
25114        self._scopes.clear();
25115        self
25116    }
25117}
25118
25119/// Gets one advertiser by ID.
25120///
25121/// A builder for the *get* method supported by a *advertiser* resource.
25122/// It is not used directly, but through a [`AdvertiserMethods`] instance.
25123///
25124/// # Example
25125///
25126/// Instantiate a resource method builder
25127///
25128/// ```test_harness,no_run
25129/// # extern crate hyper;
25130/// # extern crate hyper_rustls;
25131/// # extern crate google_dfareporting3d3 as dfareporting3d3;
25132/// # async fn dox() {
25133/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25134///
25135/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25136/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
25137/// #     secret,
25138/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25139/// # ).build().await.unwrap();
25140///
25141/// # let client = hyper_util::client::legacy::Client::builder(
25142/// #     hyper_util::rt::TokioExecutor::new()
25143/// # )
25144/// # .build(
25145/// #     hyper_rustls::HttpsConnectorBuilder::new()
25146/// #         .with_native_roots()
25147/// #         .unwrap()
25148/// #         .https_or_http()
25149/// #         .enable_http1()
25150/// #         .build()
25151/// # );
25152/// # let mut hub = Dfareporting::new(client, auth);
25153/// // You can configure optional parameters by calling the respective setters at will, and
25154/// // execute the final call using `doit()`.
25155/// // Values shown here are possibly random and not representative !
25156/// let result = hub.advertisers().get(-45, -32)
25157///              .doit().await;
25158/// # }
25159/// ```
25160pub struct AdvertiserGetCall<'a, C>
25161where
25162    C: 'a,
25163{
25164    hub: &'a Dfareporting<C>,
25165    _profile_id: i64,
25166    _id: i64,
25167    _delegate: Option<&'a mut dyn common::Delegate>,
25168    _additional_params: HashMap<String, String>,
25169    _scopes: BTreeSet<String>,
25170}
25171
25172impl<'a, C> common::CallBuilder for AdvertiserGetCall<'a, C> {}
25173
25174impl<'a, C> AdvertiserGetCall<'a, C>
25175where
25176    C: common::Connector,
25177{
25178    /// Perform the operation you have build so far.
25179    pub async fn doit(mut self) -> common::Result<(common::Response, Advertiser)> {
25180        use std::borrow::Cow;
25181        use std::io::{Read, Seek};
25182
25183        use common::{url::Params, ToParts};
25184        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25185
25186        let mut dd = common::DefaultDelegate;
25187        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25188        dlg.begin(common::MethodInfo {
25189            id: "dfareporting.advertisers.get",
25190            http_method: hyper::Method::GET,
25191        });
25192
25193        for &field in ["alt", "profileId", "id"].iter() {
25194            if self._additional_params.contains_key(field) {
25195                dlg.finished(false);
25196                return Err(common::Error::FieldClash(field));
25197            }
25198        }
25199
25200        let mut params = Params::with_capacity(4 + self._additional_params.len());
25201        params.push("profileId", self._profile_id.to_string());
25202        params.push("id", self._id.to_string());
25203
25204        params.extend(self._additional_params.iter());
25205
25206        params.push("alt", "json");
25207        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/advertisers/{id}";
25208        if self._scopes.is_empty() {
25209            self._scopes
25210                .insert(Scope::Dfatrafficking.as_ref().to_string());
25211        }
25212
25213        #[allow(clippy::single_element_loop)]
25214        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
25215            url = params.uri_replacement(url, param_name, find_this, false);
25216        }
25217        {
25218            let to_remove = ["id", "profileId"];
25219            params.remove_params(&to_remove);
25220        }
25221
25222        let url = params.parse_with_url(&url);
25223
25224        loop {
25225            let token = match self
25226                .hub
25227                .auth
25228                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25229                .await
25230            {
25231                Ok(token) => token,
25232                Err(e) => match dlg.token(e) {
25233                    Ok(token) => token,
25234                    Err(e) => {
25235                        dlg.finished(false);
25236                        return Err(common::Error::MissingToken(e));
25237                    }
25238                },
25239            };
25240            let mut req_result = {
25241                let client = &self.hub.client;
25242                dlg.pre_request();
25243                let mut req_builder = hyper::Request::builder()
25244                    .method(hyper::Method::GET)
25245                    .uri(url.as_str())
25246                    .header(USER_AGENT, self.hub._user_agent.clone());
25247
25248                if let Some(token) = token.as_ref() {
25249                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25250                }
25251
25252                let request = req_builder
25253                    .header(CONTENT_LENGTH, 0_u64)
25254                    .body(common::to_body::<String>(None));
25255
25256                client.request(request.unwrap()).await
25257            };
25258
25259            match req_result {
25260                Err(err) => {
25261                    if let common::Retry::After(d) = dlg.http_error(&err) {
25262                        sleep(d).await;
25263                        continue;
25264                    }
25265                    dlg.finished(false);
25266                    return Err(common::Error::HttpError(err));
25267                }
25268                Ok(res) => {
25269                    let (mut parts, body) = res.into_parts();
25270                    let mut body = common::Body::new(body);
25271                    if !parts.status.is_success() {
25272                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25273                        let error = serde_json::from_str(&common::to_string(&bytes));
25274                        let response = common::to_response(parts, bytes.into());
25275
25276                        if let common::Retry::After(d) =
25277                            dlg.http_failure(&response, error.as_ref().ok())
25278                        {
25279                            sleep(d).await;
25280                            continue;
25281                        }
25282
25283                        dlg.finished(false);
25284
25285                        return Err(match error {
25286                            Ok(value) => common::Error::BadRequest(value),
25287                            _ => common::Error::Failure(response),
25288                        });
25289                    }
25290                    let response = {
25291                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25292                        let encoded = common::to_string(&bytes);
25293                        match serde_json::from_str(&encoded) {
25294                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25295                            Err(error) => {
25296                                dlg.response_json_decode_error(&encoded, &error);
25297                                return Err(common::Error::JsonDecodeError(
25298                                    encoded.to_string(),
25299                                    error,
25300                                ));
25301                            }
25302                        }
25303                    };
25304
25305                    dlg.finished(true);
25306                    return Ok(response);
25307                }
25308            }
25309        }
25310    }
25311
25312    /// User profile ID associated with this request.
25313    ///
25314    /// Sets the *profile id* path property to the given value.
25315    ///
25316    /// Even though the property as already been set when instantiating this call,
25317    /// we provide this method for API completeness.
25318    pub fn profile_id(mut self, new_value: i64) -> AdvertiserGetCall<'a, C> {
25319        self._profile_id = new_value;
25320        self
25321    }
25322    /// Advertiser ID.
25323    ///
25324    /// Sets the *id* path property to the given value.
25325    ///
25326    /// Even though the property as already been set when instantiating this call,
25327    /// we provide this method for API completeness.
25328    pub fn id(mut self, new_value: i64) -> AdvertiserGetCall<'a, C> {
25329        self._id = new_value;
25330        self
25331    }
25332    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25333    /// while executing the actual API request.
25334    ///
25335    /// ````text
25336    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
25337    /// ````
25338    ///
25339    /// Sets the *delegate* property to the given value.
25340    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AdvertiserGetCall<'a, C> {
25341        self._delegate = Some(new_value);
25342        self
25343    }
25344
25345    /// Set any additional parameter of the query string used in the request.
25346    /// It should be used to set parameters which are not yet available through their own
25347    /// setters.
25348    ///
25349    /// Please note that this method must not be used to set any of the known parameters
25350    /// which have their own setter method. If done anyway, the request will fail.
25351    ///
25352    /// # Additional Parameters
25353    ///
25354    /// * *$.xgafv* (query-string) - V1 error format.
25355    /// * *access_token* (query-string) - OAuth access token.
25356    /// * *alt* (query-string) - Data format for response.
25357    /// * *callback* (query-string) - JSONP
25358    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25359    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
25360    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25361    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25362    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
25363    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25364    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25365    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserGetCall<'a, C>
25366    where
25367        T: AsRef<str>,
25368    {
25369        self._additional_params
25370            .insert(name.as_ref().to_string(), value.as_ref().to_string());
25371        self
25372    }
25373
25374    /// Identifies the authorization scope for the method you are building.
25375    ///
25376    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25377    /// [`Scope::Dfatrafficking`].
25378    ///
25379    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25380    /// tokens for more than one scope.
25381    ///
25382    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25383    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25384    /// sufficient, a read-write scope will do as well.
25385    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserGetCall<'a, C>
25386    where
25387        St: AsRef<str>,
25388    {
25389        self._scopes.insert(String::from(scope.as_ref()));
25390        self
25391    }
25392    /// Identifies the authorization scope(s) for the method you are building.
25393    ///
25394    /// See [`Self::add_scope()`] for details.
25395    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserGetCall<'a, C>
25396    where
25397        I: IntoIterator<Item = St>,
25398        St: AsRef<str>,
25399    {
25400        self._scopes
25401            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25402        self
25403    }
25404
25405    /// Removes all scopes, and no default scope will be used either.
25406    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25407    /// for details).
25408    pub fn clear_scopes(mut self) -> AdvertiserGetCall<'a, C> {
25409        self._scopes.clear();
25410        self
25411    }
25412}
25413
25414/// Inserts a new advertiser.
25415///
25416/// A builder for the *insert* method supported by a *advertiser* resource.
25417/// It is not used directly, but through a [`AdvertiserMethods`] instance.
25418///
25419/// # Example
25420///
25421/// Instantiate a resource method builder
25422///
25423/// ```test_harness,no_run
25424/// # extern crate hyper;
25425/// # extern crate hyper_rustls;
25426/// # extern crate google_dfareporting3d3 as dfareporting3d3;
25427/// use dfareporting3d3::api::Advertiser;
25428/// # async fn dox() {
25429/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25430///
25431/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25432/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
25433/// #     secret,
25434/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25435/// # ).build().await.unwrap();
25436///
25437/// # let client = hyper_util::client::legacy::Client::builder(
25438/// #     hyper_util::rt::TokioExecutor::new()
25439/// # )
25440/// # .build(
25441/// #     hyper_rustls::HttpsConnectorBuilder::new()
25442/// #         .with_native_roots()
25443/// #         .unwrap()
25444/// #         .https_or_http()
25445/// #         .enable_http1()
25446/// #         .build()
25447/// # );
25448/// # let mut hub = Dfareporting::new(client, auth);
25449/// // As the method needs a request, you would usually fill it with the desired information
25450/// // into the respective structure. Some of the parts shown here might not be applicable !
25451/// // Values shown here are possibly random and not representative !
25452/// let mut req = Advertiser::default();
25453///
25454/// // You can configure optional parameters by calling the respective setters at will, and
25455/// // execute the final call using `doit()`.
25456/// // Values shown here are possibly random and not representative !
25457/// let result = hub.advertisers().insert(req, -69)
25458///              .doit().await;
25459/// # }
25460/// ```
25461pub struct AdvertiserInsertCall<'a, C>
25462where
25463    C: 'a,
25464{
25465    hub: &'a Dfareporting<C>,
25466    _request: Advertiser,
25467    _profile_id: i64,
25468    _delegate: Option<&'a mut dyn common::Delegate>,
25469    _additional_params: HashMap<String, String>,
25470    _scopes: BTreeSet<String>,
25471}
25472
25473impl<'a, C> common::CallBuilder for AdvertiserInsertCall<'a, C> {}
25474
25475impl<'a, C> AdvertiserInsertCall<'a, C>
25476where
25477    C: common::Connector,
25478{
25479    /// Perform the operation you have build so far.
25480    pub async fn doit(mut self) -> common::Result<(common::Response, Advertiser)> {
25481        use std::borrow::Cow;
25482        use std::io::{Read, Seek};
25483
25484        use common::{url::Params, ToParts};
25485        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25486
25487        let mut dd = common::DefaultDelegate;
25488        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25489        dlg.begin(common::MethodInfo {
25490            id: "dfareporting.advertisers.insert",
25491            http_method: hyper::Method::POST,
25492        });
25493
25494        for &field in ["alt", "profileId"].iter() {
25495            if self._additional_params.contains_key(field) {
25496                dlg.finished(false);
25497                return Err(common::Error::FieldClash(field));
25498            }
25499        }
25500
25501        let mut params = Params::with_capacity(4 + self._additional_params.len());
25502        params.push("profileId", self._profile_id.to_string());
25503
25504        params.extend(self._additional_params.iter());
25505
25506        params.push("alt", "json");
25507        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/advertisers";
25508        if self._scopes.is_empty() {
25509            self._scopes
25510                .insert(Scope::Dfatrafficking.as_ref().to_string());
25511        }
25512
25513        #[allow(clippy::single_element_loop)]
25514        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
25515            url = params.uri_replacement(url, param_name, find_this, false);
25516        }
25517        {
25518            let to_remove = ["profileId"];
25519            params.remove_params(&to_remove);
25520        }
25521
25522        let url = params.parse_with_url(&url);
25523
25524        let mut json_mime_type = mime::APPLICATION_JSON;
25525        let mut request_value_reader = {
25526            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
25527            common::remove_json_null_values(&mut value);
25528            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
25529            serde_json::to_writer(&mut dst, &value).unwrap();
25530            dst
25531        };
25532        let request_size = request_value_reader
25533            .seek(std::io::SeekFrom::End(0))
25534            .unwrap();
25535        request_value_reader
25536            .seek(std::io::SeekFrom::Start(0))
25537            .unwrap();
25538
25539        loop {
25540            let token = match self
25541                .hub
25542                .auth
25543                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25544                .await
25545            {
25546                Ok(token) => token,
25547                Err(e) => match dlg.token(e) {
25548                    Ok(token) => token,
25549                    Err(e) => {
25550                        dlg.finished(false);
25551                        return Err(common::Error::MissingToken(e));
25552                    }
25553                },
25554            };
25555            request_value_reader
25556                .seek(std::io::SeekFrom::Start(0))
25557                .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::POST)
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                let request = req_builder
25571                    .header(CONTENT_TYPE, json_mime_type.to_string())
25572                    .header(CONTENT_LENGTH, request_size as u64)
25573                    .body(common::to_body(
25574                        request_value_reader.get_ref().clone().into(),
25575                    ));
25576
25577                client.request(request.unwrap()).await
25578            };
25579
25580            match req_result {
25581                Err(err) => {
25582                    if let common::Retry::After(d) = dlg.http_error(&err) {
25583                        sleep(d).await;
25584                        continue;
25585                    }
25586                    dlg.finished(false);
25587                    return Err(common::Error::HttpError(err));
25588                }
25589                Ok(res) => {
25590                    let (mut parts, body) = res.into_parts();
25591                    let mut body = common::Body::new(body);
25592                    if !parts.status.is_success() {
25593                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25594                        let error = serde_json::from_str(&common::to_string(&bytes));
25595                        let response = common::to_response(parts, bytes.into());
25596
25597                        if let common::Retry::After(d) =
25598                            dlg.http_failure(&response, error.as_ref().ok())
25599                        {
25600                            sleep(d).await;
25601                            continue;
25602                        }
25603
25604                        dlg.finished(false);
25605
25606                        return Err(match error {
25607                            Ok(value) => common::Error::BadRequest(value),
25608                            _ => common::Error::Failure(response),
25609                        });
25610                    }
25611                    let response = {
25612                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25613                        let encoded = common::to_string(&bytes);
25614                        match serde_json::from_str(&encoded) {
25615                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25616                            Err(error) => {
25617                                dlg.response_json_decode_error(&encoded, &error);
25618                                return Err(common::Error::JsonDecodeError(
25619                                    encoded.to_string(),
25620                                    error,
25621                                ));
25622                            }
25623                        }
25624                    };
25625
25626                    dlg.finished(true);
25627                    return Ok(response);
25628                }
25629            }
25630        }
25631    }
25632
25633    ///
25634    /// Sets the *request* property to the given value.
25635    ///
25636    /// Even though the property as already been set when instantiating this call,
25637    /// we provide this method for API completeness.
25638    pub fn request(mut self, new_value: Advertiser) -> AdvertiserInsertCall<'a, C> {
25639        self._request = new_value;
25640        self
25641    }
25642    /// User profile ID associated with this request.
25643    ///
25644    /// Sets the *profile id* path property to the given value.
25645    ///
25646    /// Even though the property as already been set when instantiating this call,
25647    /// we provide this method for API completeness.
25648    pub fn profile_id(mut self, new_value: i64) -> AdvertiserInsertCall<'a, C> {
25649        self._profile_id = new_value;
25650        self
25651    }
25652    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25653    /// while executing the actual API request.
25654    ///
25655    /// ````text
25656    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
25657    /// ````
25658    ///
25659    /// Sets the *delegate* property to the given value.
25660    pub fn delegate(
25661        mut self,
25662        new_value: &'a mut dyn common::Delegate,
25663    ) -> AdvertiserInsertCall<'a, C> {
25664        self._delegate = Some(new_value);
25665        self
25666    }
25667
25668    /// Set any additional parameter of the query string used in the request.
25669    /// It should be used to set parameters which are not yet available through their own
25670    /// setters.
25671    ///
25672    /// Please note that this method must not be used to set any of the known parameters
25673    /// which have their own setter method. If done anyway, the request will fail.
25674    ///
25675    /// # Additional Parameters
25676    ///
25677    /// * *$.xgafv* (query-string) - V1 error format.
25678    /// * *access_token* (query-string) - OAuth access token.
25679    /// * *alt* (query-string) - Data format for response.
25680    /// * *callback* (query-string) - JSONP
25681    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25682    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
25683    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25684    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25685    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
25686    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25687    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25688    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserInsertCall<'a, C>
25689    where
25690        T: AsRef<str>,
25691    {
25692        self._additional_params
25693            .insert(name.as_ref().to_string(), value.as_ref().to_string());
25694        self
25695    }
25696
25697    /// Identifies the authorization scope for the method you are building.
25698    ///
25699    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25700    /// [`Scope::Dfatrafficking`].
25701    ///
25702    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25703    /// tokens for more than one scope.
25704    ///
25705    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25706    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25707    /// sufficient, a read-write scope will do as well.
25708    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserInsertCall<'a, C>
25709    where
25710        St: AsRef<str>,
25711    {
25712        self._scopes.insert(String::from(scope.as_ref()));
25713        self
25714    }
25715    /// Identifies the authorization scope(s) for the method you are building.
25716    ///
25717    /// See [`Self::add_scope()`] for details.
25718    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserInsertCall<'a, C>
25719    where
25720        I: IntoIterator<Item = St>,
25721        St: AsRef<str>,
25722    {
25723        self._scopes
25724            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25725        self
25726    }
25727
25728    /// Removes all scopes, and no default scope will be used either.
25729    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25730    /// for details).
25731    pub fn clear_scopes(mut self) -> AdvertiserInsertCall<'a, C> {
25732        self._scopes.clear();
25733        self
25734    }
25735}
25736
25737/// Retrieves a list of advertisers, possibly filtered. This method supports paging.
25738///
25739/// A builder for the *list* method supported by a *advertiser* resource.
25740/// It is not used directly, but through a [`AdvertiserMethods`] instance.
25741///
25742/// # Example
25743///
25744/// Instantiate a resource method builder
25745///
25746/// ```test_harness,no_run
25747/// # extern crate hyper;
25748/// # extern crate hyper_rustls;
25749/// # extern crate google_dfareporting3d3 as dfareporting3d3;
25750/// # async fn dox() {
25751/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25752///
25753/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25754/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
25755/// #     secret,
25756/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25757/// # ).build().await.unwrap();
25758///
25759/// # let client = hyper_util::client::legacy::Client::builder(
25760/// #     hyper_util::rt::TokioExecutor::new()
25761/// # )
25762/// # .build(
25763/// #     hyper_rustls::HttpsConnectorBuilder::new()
25764/// #         .with_native_roots()
25765/// #         .unwrap()
25766/// #         .https_or_http()
25767/// #         .enable_http1()
25768/// #         .build()
25769/// # );
25770/// # let mut hub = Dfareporting::new(client, auth);
25771/// // You can configure optional parameters by calling the respective setters at will, and
25772/// // execute the final call using `doit()`.
25773/// // Values shown here are possibly random and not representative !
25774/// let result = hub.advertisers().list(-95)
25775///              .subaccount_id(-31)
25776///              .status("aliquyam")
25777///              .sort_order("amet")
25778///              .sort_field("est")
25779///              .search_string("et")
25780///              .page_token("sea")
25781///              .only_parent(false)
25782///              .max_results(-46)
25783///              .include_advertisers_without_groups_only(true)
25784///              .add_ids(-7)
25785///              .add_floodlight_configuration_ids(-82)
25786///              .add_advertiser_group_ids(-94)
25787///              .doit().await;
25788/// # }
25789/// ```
25790pub struct AdvertiserListCall<'a, C>
25791where
25792    C: 'a,
25793{
25794    hub: &'a Dfareporting<C>,
25795    _profile_id: i64,
25796    _subaccount_id: Option<i64>,
25797    _status: Option<String>,
25798    _sort_order: Option<String>,
25799    _sort_field: Option<String>,
25800    _search_string: Option<String>,
25801    _page_token: Option<String>,
25802    _only_parent: Option<bool>,
25803    _max_results: Option<i32>,
25804    _include_advertisers_without_groups_only: Option<bool>,
25805    _ids: Vec<i64>,
25806    _floodlight_configuration_ids: Vec<i64>,
25807    _advertiser_group_ids: Vec<i64>,
25808    _delegate: Option<&'a mut dyn common::Delegate>,
25809    _additional_params: HashMap<String, String>,
25810    _scopes: BTreeSet<String>,
25811}
25812
25813impl<'a, C> common::CallBuilder for AdvertiserListCall<'a, C> {}
25814
25815impl<'a, C> AdvertiserListCall<'a, C>
25816where
25817    C: common::Connector,
25818{
25819    /// Perform the operation you have build so far.
25820    pub async fn doit(mut self) -> common::Result<(common::Response, AdvertisersListResponse)> {
25821        use std::borrow::Cow;
25822        use std::io::{Read, Seek};
25823
25824        use common::{url::Params, ToParts};
25825        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25826
25827        let mut dd = common::DefaultDelegate;
25828        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25829        dlg.begin(common::MethodInfo {
25830            id: "dfareporting.advertisers.list",
25831            http_method: hyper::Method::GET,
25832        });
25833
25834        for &field in [
25835            "alt",
25836            "profileId",
25837            "subaccountId",
25838            "status",
25839            "sortOrder",
25840            "sortField",
25841            "searchString",
25842            "pageToken",
25843            "onlyParent",
25844            "maxResults",
25845            "includeAdvertisersWithoutGroupsOnly",
25846            "ids",
25847            "floodlightConfigurationIds",
25848            "advertiserGroupIds",
25849        ]
25850        .iter()
25851        {
25852            if self._additional_params.contains_key(field) {
25853                dlg.finished(false);
25854                return Err(common::Error::FieldClash(field));
25855            }
25856        }
25857
25858        let mut params = Params::with_capacity(15 + self._additional_params.len());
25859        params.push("profileId", self._profile_id.to_string());
25860        if let Some(value) = self._subaccount_id.as_ref() {
25861            params.push("subaccountId", value.to_string());
25862        }
25863        if let Some(value) = self._status.as_ref() {
25864            params.push("status", value);
25865        }
25866        if let Some(value) = self._sort_order.as_ref() {
25867            params.push("sortOrder", value);
25868        }
25869        if let Some(value) = self._sort_field.as_ref() {
25870            params.push("sortField", value);
25871        }
25872        if let Some(value) = self._search_string.as_ref() {
25873            params.push("searchString", value);
25874        }
25875        if let Some(value) = self._page_token.as_ref() {
25876            params.push("pageToken", value);
25877        }
25878        if let Some(value) = self._only_parent.as_ref() {
25879            params.push("onlyParent", value.to_string());
25880        }
25881        if let Some(value) = self._max_results.as_ref() {
25882            params.push("maxResults", value.to_string());
25883        }
25884        if let Some(value) = self._include_advertisers_without_groups_only.as_ref() {
25885            params.push("includeAdvertisersWithoutGroupsOnly", value.to_string());
25886        }
25887        if !self._ids.is_empty() {
25888            for f in self._ids.iter() {
25889                params.push("ids", f.to_string());
25890            }
25891        }
25892        if !self._floodlight_configuration_ids.is_empty() {
25893            for f in self._floodlight_configuration_ids.iter() {
25894                params.push("floodlightConfigurationIds", f.to_string());
25895            }
25896        }
25897        if !self._advertiser_group_ids.is_empty() {
25898            for f in self._advertiser_group_ids.iter() {
25899                params.push("advertiserGroupIds", f.to_string());
25900            }
25901        }
25902
25903        params.extend(self._additional_params.iter());
25904
25905        params.push("alt", "json");
25906        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/advertisers";
25907        if self._scopes.is_empty() {
25908            self._scopes
25909                .insert(Scope::Dfatrafficking.as_ref().to_string());
25910        }
25911
25912        #[allow(clippy::single_element_loop)]
25913        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
25914            url = params.uri_replacement(url, param_name, find_this, false);
25915        }
25916        {
25917            let to_remove = ["profileId"];
25918            params.remove_params(&to_remove);
25919        }
25920
25921        let url = params.parse_with_url(&url);
25922
25923        loop {
25924            let token = match self
25925                .hub
25926                .auth
25927                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25928                .await
25929            {
25930                Ok(token) => token,
25931                Err(e) => match dlg.token(e) {
25932                    Ok(token) => token,
25933                    Err(e) => {
25934                        dlg.finished(false);
25935                        return Err(common::Error::MissingToken(e));
25936                    }
25937                },
25938            };
25939            let mut req_result = {
25940                let client = &self.hub.client;
25941                dlg.pre_request();
25942                let mut req_builder = hyper::Request::builder()
25943                    .method(hyper::Method::GET)
25944                    .uri(url.as_str())
25945                    .header(USER_AGENT, self.hub._user_agent.clone());
25946
25947                if let Some(token) = token.as_ref() {
25948                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25949                }
25950
25951                let request = req_builder
25952                    .header(CONTENT_LENGTH, 0_u64)
25953                    .body(common::to_body::<String>(None));
25954
25955                client.request(request.unwrap()).await
25956            };
25957
25958            match req_result {
25959                Err(err) => {
25960                    if let common::Retry::After(d) = dlg.http_error(&err) {
25961                        sleep(d).await;
25962                        continue;
25963                    }
25964                    dlg.finished(false);
25965                    return Err(common::Error::HttpError(err));
25966                }
25967                Ok(res) => {
25968                    let (mut parts, body) = res.into_parts();
25969                    let mut body = common::Body::new(body);
25970                    if !parts.status.is_success() {
25971                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25972                        let error = serde_json::from_str(&common::to_string(&bytes));
25973                        let response = common::to_response(parts, bytes.into());
25974
25975                        if let common::Retry::After(d) =
25976                            dlg.http_failure(&response, error.as_ref().ok())
25977                        {
25978                            sleep(d).await;
25979                            continue;
25980                        }
25981
25982                        dlg.finished(false);
25983
25984                        return Err(match error {
25985                            Ok(value) => common::Error::BadRequest(value),
25986                            _ => common::Error::Failure(response),
25987                        });
25988                    }
25989                    let response = {
25990                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25991                        let encoded = common::to_string(&bytes);
25992                        match serde_json::from_str(&encoded) {
25993                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25994                            Err(error) => {
25995                                dlg.response_json_decode_error(&encoded, &error);
25996                                return Err(common::Error::JsonDecodeError(
25997                                    encoded.to_string(),
25998                                    error,
25999                                ));
26000                            }
26001                        }
26002                    };
26003
26004                    dlg.finished(true);
26005                    return Ok(response);
26006                }
26007            }
26008        }
26009    }
26010
26011    /// User profile ID associated with this request.
26012    ///
26013    /// Sets the *profile id* path property to the given value.
26014    ///
26015    /// Even though the property as already been set when instantiating this call,
26016    /// we provide this method for API completeness.
26017    pub fn profile_id(mut self, new_value: i64) -> AdvertiserListCall<'a, C> {
26018        self._profile_id = new_value;
26019        self
26020    }
26021    /// Select only advertisers with these subaccount IDs.
26022    ///
26023    /// Sets the *subaccount id* query property to the given value.
26024    pub fn subaccount_id(mut self, new_value: i64) -> AdvertiserListCall<'a, C> {
26025        self._subaccount_id = Some(new_value);
26026        self
26027    }
26028    /// Select only advertisers with the specified status.
26029    ///
26030    /// Sets the *status* query property to the given value.
26031    pub fn status(mut self, new_value: &str) -> AdvertiserListCall<'a, C> {
26032        self._status = Some(new_value.to_string());
26033        self
26034    }
26035    /// Order of sorted results.
26036    ///
26037    /// Sets the *sort order* query property to the given value.
26038    pub fn sort_order(mut self, new_value: &str) -> AdvertiserListCall<'a, C> {
26039        self._sort_order = Some(new_value.to_string());
26040        self
26041    }
26042    /// Field by which to sort the list.
26043    ///
26044    /// Sets the *sort field* query property to the given value.
26045    pub fn sort_field(mut self, new_value: &str) -> AdvertiserListCall<'a, C> {
26046        self._sort_field = Some(new_value.to_string());
26047        self
26048    }
26049    /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "advertiser*2015" will return objects with names like "advertiser June 2015", "advertiser April 2015", or simply "advertiser 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "advertiser" will match objects with name "my advertiser", "advertiser 2015", or simply "advertiser" .
26050    ///
26051    /// Sets the *search string* query property to the given value.
26052    pub fn search_string(mut self, new_value: &str) -> AdvertiserListCall<'a, C> {
26053        self._search_string = Some(new_value.to_string());
26054        self
26055    }
26056    /// Value of the nextPageToken from the previous result page.
26057    ///
26058    /// Sets the *page token* query property to the given value.
26059    pub fn page_token(mut self, new_value: &str) -> AdvertiserListCall<'a, C> {
26060        self._page_token = Some(new_value.to_string());
26061        self
26062    }
26063    /// Select only advertisers which use another advertiser's floodlight configuration.
26064    ///
26065    /// Sets the *only parent* query property to the given value.
26066    pub fn only_parent(mut self, new_value: bool) -> AdvertiserListCall<'a, C> {
26067        self._only_parent = Some(new_value);
26068        self
26069    }
26070    /// Maximum number of results to return.
26071    ///
26072    /// Sets the *max results* query property to the given value.
26073    pub fn max_results(mut self, new_value: i32) -> AdvertiserListCall<'a, C> {
26074        self._max_results = Some(new_value);
26075        self
26076    }
26077    /// Select only advertisers which do not belong to any advertiser group.
26078    ///
26079    /// Sets the *include advertisers without groups only* query property to the given value.
26080    pub fn include_advertisers_without_groups_only(
26081        mut self,
26082        new_value: bool,
26083    ) -> AdvertiserListCall<'a, C> {
26084        self._include_advertisers_without_groups_only = Some(new_value);
26085        self
26086    }
26087    /// Select only advertisers with these IDs.
26088    ///
26089    /// Append the given value to the *ids* query property.
26090    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
26091    pub fn add_ids(mut self, new_value: i64) -> AdvertiserListCall<'a, C> {
26092        self._ids.push(new_value);
26093        self
26094    }
26095    /// Select only advertisers with these floodlight configuration IDs.
26096    ///
26097    /// Append the given value to the *floodlight configuration ids* query property.
26098    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
26099    pub fn add_floodlight_configuration_ids(mut self, new_value: i64) -> AdvertiserListCall<'a, C> {
26100        self._floodlight_configuration_ids.push(new_value);
26101        self
26102    }
26103    /// Select only advertisers with these advertiser group IDs.
26104    ///
26105    /// Append the given value to the *advertiser group ids* query property.
26106    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
26107    pub fn add_advertiser_group_ids(mut self, new_value: i64) -> AdvertiserListCall<'a, C> {
26108        self._advertiser_group_ids.push(new_value);
26109        self
26110    }
26111    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26112    /// while executing the actual API request.
26113    ///
26114    /// ````text
26115    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
26116    /// ````
26117    ///
26118    /// Sets the *delegate* property to the given value.
26119    pub fn delegate(
26120        mut self,
26121        new_value: &'a mut dyn common::Delegate,
26122    ) -> AdvertiserListCall<'a, C> {
26123        self._delegate = Some(new_value);
26124        self
26125    }
26126
26127    /// Set any additional parameter of the query string used in the request.
26128    /// It should be used to set parameters which are not yet available through their own
26129    /// setters.
26130    ///
26131    /// Please note that this method must not be used to set any of the known parameters
26132    /// which have their own setter method. If done anyway, the request will fail.
26133    ///
26134    /// # Additional Parameters
26135    ///
26136    /// * *$.xgafv* (query-string) - V1 error format.
26137    /// * *access_token* (query-string) - OAuth access token.
26138    /// * *alt* (query-string) - Data format for response.
26139    /// * *callback* (query-string) - JSONP
26140    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26141    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
26142    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26143    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26144    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
26145    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26146    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26147    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserListCall<'a, C>
26148    where
26149        T: AsRef<str>,
26150    {
26151        self._additional_params
26152            .insert(name.as_ref().to_string(), value.as_ref().to_string());
26153        self
26154    }
26155
26156    /// Identifies the authorization scope for the method you are building.
26157    ///
26158    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26159    /// [`Scope::Dfatrafficking`].
26160    ///
26161    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26162    /// tokens for more than one scope.
26163    ///
26164    /// Usually there is more than one suitable scope to authorize an operation, some of which may
26165    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26166    /// sufficient, a read-write scope will do as well.
26167    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserListCall<'a, C>
26168    where
26169        St: AsRef<str>,
26170    {
26171        self._scopes.insert(String::from(scope.as_ref()));
26172        self
26173    }
26174    /// Identifies the authorization scope(s) for the method you are building.
26175    ///
26176    /// See [`Self::add_scope()`] for details.
26177    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserListCall<'a, C>
26178    where
26179        I: IntoIterator<Item = St>,
26180        St: AsRef<str>,
26181    {
26182        self._scopes
26183            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26184        self
26185    }
26186
26187    /// Removes all scopes, and no default scope will be used either.
26188    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26189    /// for details).
26190    pub fn clear_scopes(mut self) -> AdvertiserListCall<'a, C> {
26191        self._scopes.clear();
26192        self
26193    }
26194}
26195
26196/// Updates an existing advertiser. This method supports patch semantics.
26197///
26198/// A builder for the *patch* method supported by a *advertiser* resource.
26199/// It is not used directly, but through a [`AdvertiserMethods`] instance.
26200///
26201/// # Example
26202///
26203/// Instantiate a resource method builder
26204///
26205/// ```test_harness,no_run
26206/// # extern crate hyper;
26207/// # extern crate hyper_rustls;
26208/// # extern crate google_dfareporting3d3 as dfareporting3d3;
26209/// use dfareporting3d3::api::Advertiser;
26210/// # async fn dox() {
26211/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26212///
26213/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26214/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
26215/// #     secret,
26216/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26217/// # ).build().await.unwrap();
26218///
26219/// # let client = hyper_util::client::legacy::Client::builder(
26220/// #     hyper_util::rt::TokioExecutor::new()
26221/// # )
26222/// # .build(
26223/// #     hyper_rustls::HttpsConnectorBuilder::new()
26224/// #         .with_native_roots()
26225/// #         .unwrap()
26226/// #         .https_or_http()
26227/// #         .enable_http1()
26228/// #         .build()
26229/// # );
26230/// # let mut hub = Dfareporting::new(client, auth);
26231/// // As the method needs a request, you would usually fill it with the desired information
26232/// // into the respective structure. Some of the parts shown here might not be applicable !
26233/// // Values shown here are possibly random and not representative !
26234/// let mut req = Advertiser::default();
26235///
26236/// // You can configure optional parameters by calling the respective setters at will, and
26237/// // execute the final call using `doit()`.
26238/// // Values shown here are possibly random and not representative !
26239/// let result = hub.advertisers().patch(req, -20, -42)
26240///              .doit().await;
26241/// # }
26242/// ```
26243pub struct AdvertiserPatchCall<'a, C>
26244where
26245    C: 'a,
26246{
26247    hub: &'a Dfareporting<C>,
26248    _request: Advertiser,
26249    _profile_id: i64,
26250    _id: i64,
26251    _delegate: Option<&'a mut dyn common::Delegate>,
26252    _additional_params: HashMap<String, String>,
26253    _scopes: BTreeSet<String>,
26254}
26255
26256impl<'a, C> common::CallBuilder for AdvertiserPatchCall<'a, C> {}
26257
26258impl<'a, C> AdvertiserPatchCall<'a, C>
26259where
26260    C: common::Connector,
26261{
26262    /// Perform the operation you have build so far.
26263    pub async fn doit(mut self) -> common::Result<(common::Response, Advertiser)> {
26264        use std::borrow::Cow;
26265        use std::io::{Read, Seek};
26266
26267        use common::{url::Params, ToParts};
26268        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26269
26270        let mut dd = common::DefaultDelegate;
26271        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26272        dlg.begin(common::MethodInfo {
26273            id: "dfareporting.advertisers.patch",
26274            http_method: hyper::Method::PATCH,
26275        });
26276
26277        for &field in ["alt", "profileId", "id"].iter() {
26278            if self._additional_params.contains_key(field) {
26279                dlg.finished(false);
26280                return Err(common::Error::FieldClash(field));
26281            }
26282        }
26283
26284        let mut params = Params::with_capacity(5 + self._additional_params.len());
26285        params.push("profileId", self._profile_id.to_string());
26286        params.push("id", self._id.to_string());
26287
26288        params.extend(self._additional_params.iter());
26289
26290        params.push("alt", "json");
26291        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/advertisers";
26292        if self._scopes.is_empty() {
26293            self._scopes
26294                .insert(Scope::Dfatrafficking.as_ref().to_string());
26295        }
26296
26297        #[allow(clippy::single_element_loop)]
26298        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
26299            url = params.uri_replacement(url, param_name, find_this, false);
26300        }
26301        {
26302            let to_remove = ["profileId"];
26303            params.remove_params(&to_remove);
26304        }
26305
26306        let url = params.parse_with_url(&url);
26307
26308        let mut json_mime_type = mime::APPLICATION_JSON;
26309        let mut request_value_reader = {
26310            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
26311            common::remove_json_null_values(&mut value);
26312            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
26313            serde_json::to_writer(&mut dst, &value).unwrap();
26314            dst
26315        };
26316        let request_size = request_value_reader
26317            .seek(std::io::SeekFrom::End(0))
26318            .unwrap();
26319        request_value_reader
26320            .seek(std::io::SeekFrom::Start(0))
26321            .unwrap();
26322
26323        loop {
26324            let token = match self
26325                .hub
26326                .auth
26327                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26328                .await
26329            {
26330                Ok(token) => token,
26331                Err(e) => match dlg.token(e) {
26332                    Ok(token) => token,
26333                    Err(e) => {
26334                        dlg.finished(false);
26335                        return Err(common::Error::MissingToken(e));
26336                    }
26337                },
26338            };
26339            request_value_reader
26340                .seek(std::io::SeekFrom::Start(0))
26341                .unwrap();
26342            let mut req_result = {
26343                let client = &self.hub.client;
26344                dlg.pre_request();
26345                let mut req_builder = hyper::Request::builder()
26346                    .method(hyper::Method::PATCH)
26347                    .uri(url.as_str())
26348                    .header(USER_AGENT, self.hub._user_agent.clone());
26349
26350                if let Some(token) = token.as_ref() {
26351                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26352                }
26353
26354                let request = req_builder
26355                    .header(CONTENT_TYPE, json_mime_type.to_string())
26356                    .header(CONTENT_LENGTH, request_size as u64)
26357                    .body(common::to_body(
26358                        request_value_reader.get_ref().clone().into(),
26359                    ));
26360
26361                client.request(request.unwrap()).await
26362            };
26363
26364            match req_result {
26365                Err(err) => {
26366                    if let common::Retry::After(d) = dlg.http_error(&err) {
26367                        sleep(d).await;
26368                        continue;
26369                    }
26370                    dlg.finished(false);
26371                    return Err(common::Error::HttpError(err));
26372                }
26373                Ok(res) => {
26374                    let (mut parts, body) = res.into_parts();
26375                    let mut body = common::Body::new(body);
26376                    if !parts.status.is_success() {
26377                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26378                        let error = serde_json::from_str(&common::to_string(&bytes));
26379                        let response = common::to_response(parts, bytes.into());
26380
26381                        if let common::Retry::After(d) =
26382                            dlg.http_failure(&response, error.as_ref().ok())
26383                        {
26384                            sleep(d).await;
26385                            continue;
26386                        }
26387
26388                        dlg.finished(false);
26389
26390                        return Err(match error {
26391                            Ok(value) => common::Error::BadRequest(value),
26392                            _ => common::Error::Failure(response),
26393                        });
26394                    }
26395                    let response = {
26396                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26397                        let encoded = common::to_string(&bytes);
26398                        match serde_json::from_str(&encoded) {
26399                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26400                            Err(error) => {
26401                                dlg.response_json_decode_error(&encoded, &error);
26402                                return Err(common::Error::JsonDecodeError(
26403                                    encoded.to_string(),
26404                                    error,
26405                                ));
26406                            }
26407                        }
26408                    };
26409
26410                    dlg.finished(true);
26411                    return Ok(response);
26412                }
26413            }
26414        }
26415    }
26416
26417    ///
26418    /// Sets the *request* property to the given value.
26419    ///
26420    /// Even though the property as already been set when instantiating this call,
26421    /// we provide this method for API completeness.
26422    pub fn request(mut self, new_value: Advertiser) -> AdvertiserPatchCall<'a, C> {
26423        self._request = new_value;
26424        self
26425    }
26426    /// User profile ID associated with this request.
26427    ///
26428    /// Sets the *profile id* path property to the given value.
26429    ///
26430    /// Even though the property as already been set when instantiating this call,
26431    /// we provide this method for API completeness.
26432    pub fn profile_id(mut self, new_value: i64) -> AdvertiserPatchCall<'a, C> {
26433        self._profile_id = new_value;
26434        self
26435    }
26436    /// Advertiser ID.
26437    ///
26438    /// Sets the *id* query property to the given value.
26439    ///
26440    /// Even though the property as already been set when instantiating this call,
26441    /// we provide this method for API completeness.
26442    pub fn id(mut self, new_value: i64) -> AdvertiserPatchCall<'a, C> {
26443        self._id = new_value;
26444        self
26445    }
26446    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26447    /// while executing the actual API request.
26448    ///
26449    /// ````text
26450    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
26451    /// ````
26452    ///
26453    /// Sets the *delegate* property to the given value.
26454    pub fn delegate(
26455        mut self,
26456        new_value: &'a mut dyn common::Delegate,
26457    ) -> AdvertiserPatchCall<'a, C> {
26458        self._delegate = Some(new_value);
26459        self
26460    }
26461
26462    /// Set any additional parameter of the query string used in the request.
26463    /// It should be used to set parameters which are not yet available through their own
26464    /// setters.
26465    ///
26466    /// Please note that this method must not be used to set any of the known parameters
26467    /// which have their own setter method. If done anyway, the request will fail.
26468    ///
26469    /// # Additional Parameters
26470    ///
26471    /// * *$.xgafv* (query-string) - V1 error format.
26472    /// * *access_token* (query-string) - OAuth access token.
26473    /// * *alt* (query-string) - Data format for response.
26474    /// * *callback* (query-string) - JSONP
26475    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26476    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
26477    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26478    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26479    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
26480    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26481    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26482    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserPatchCall<'a, C>
26483    where
26484        T: AsRef<str>,
26485    {
26486        self._additional_params
26487            .insert(name.as_ref().to_string(), value.as_ref().to_string());
26488        self
26489    }
26490
26491    /// Identifies the authorization scope for the method you are building.
26492    ///
26493    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26494    /// [`Scope::Dfatrafficking`].
26495    ///
26496    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26497    /// tokens for more than one scope.
26498    ///
26499    /// Usually there is more than one suitable scope to authorize an operation, some of which may
26500    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26501    /// sufficient, a read-write scope will do as well.
26502    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserPatchCall<'a, C>
26503    where
26504        St: AsRef<str>,
26505    {
26506        self._scopes.insert(String::from(scope.as_ref()));
26507        self
26508    }
26509    /// Identifies the authorization scope(s) for the method you are building.
26510    ///
26511    /// See [`Self::add_scope()`] for details.
26512    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserPatchCall<'a, C>
26513    where
26514        I: IntoIterator<Item = St>,
26515        St: AsRef<str>,
26516    {
26517        self._scopes
26518            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26519        self
26520    }
26521
26522    /// Removes all scopes, and no default scope will be used either.
26523    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26524    /// for details).
26525    pub fn clear_scopes(mut self) -> AdvertiserPatchCall<'a, C> {
26526        self._scopes.clear();
26527        self
26528    }
26529}
26530
26531/// Updates an existing advertiser.
26532///
26533/// A builder for the *update* method supported by a *advertiser* resource.
26534/// It is not used directly, but through a [`AdvertiserMethods`] instance.
26535///
26536/// # Example
26537///
26538/// Instantiate a resource method builder
26539///
26540/// ```test_harness,no_run
26541/// # extern crate hyper;
26542/// # extern crate hyper_rustls;
26543/// # extern crate google_dfareporting3d3 as dfareporting3d3;
26544/// use dfareporting3d3::api::Advertiser;
26545/// # async fn dox() {
26546/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26547///
26548/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26549/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
26550/// #     secret,
26551/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26552/// # ).build().await.unwrap();
26553///
26554/// # let client = hyper_util::client::legacy::Client::builder(
26555/// #     hyper_util::rt::TokioExecutor::new()
26556/// # )
26557/// # .build(
26558/// #     hyper_rustls::HttpsConnectorBuilder::new()
26559/// #         .with_native_roots()
26560/// #         .unwrap()
26561/// #         .https_or_http()
26562/// #         .enable_http1()
26563/// #         .build()
26564/// # );
26565/// # let mut hub = Dfareporting::new(client, auth);
26566/// // As the method needs a request, you would usually fill it with the desired information
26567/// // into the respective structure. Some of the parts shown here might not be applicable !
26568/// // Values shown here are possibly random and not representative !
26569/// let mut req = Advertiser::default();
26570///
26571/// // You can configure optional parameters by calling the respective setters at will, and
26572/// // execute the final call using `doit()`.
26573/// // Values shown here are possibly random and not representative !
26574/// let result = hub.advertisers().update(req, -57)
26575///              .doit().await;
26576/// # }
26577/// ```
26578pub struct AdvertiserUpdateCall<'a, C>
26579where
26580    C: 'a,
26581{
26582    hub: &'a Dfareporting<C>,
26583    _request: Advertiser,
26584    _profile_id: i64,
26585    _delegate: Option<&'a mut dyn common::Delegate>,
26586    _additional_params: HashMap<String, String>,
26587    _scopes: BTreeSet<String>,
26588}
26589
26590impl<'a, C> common::CallBuilder for AdvertiserUpdateCall<'a, C> {}
26591
26592impl<'a, C> AdvertiserUpdateCall<'a, C>
26593where
26594    C: common::Connector,
26595{
26596    /// Perform the operation you have build so far.
26597    pub async fn doit(mut self) -> common::Result<(common::Response, Advertiser)> {
26598        use std::borrow::Cow;
26599        use std::io::{Read, Seek};
26600
26601        use common::{url::Params, ToParts};
26602        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26603
26604        let mut dd = common::DefaultDelegate;
26605        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26606        dlg.begin(common::MethodInfo {
26607            id: "dfareporting.advertisers.update",
26608            http_method: hyper::Method::PUT,
26609        });
26610
26611        for &field in ["alt", "profileId"].iter() {
26612            if self._additional_params.contains_key(field) {
26613                dlg.finished(false);
26614                return Err(common::Error::FieldClash(field));
26615            }
26616        }
26617
26618        let mut params = Params::with_capacity(4 + self._additional_params.len());
26619        params.push("profileId", self._profile_id.to_string());
26620
26621        params.extend(self._additional_params.iter());
26622
26623        params.push("alt", "json");
26624        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/advertisers";
26625        if self._scopes.is_empty() {
26626            self._scopes
26627                .insert(Scope::Dfatrafficking.as_ref().to_string());
26628        }
26629
26630        #[allow(clippy::single_element_loop)]
26631        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
26632            url = params.uri_replacement(url, param_name, find_this, false);
26633        }
26634        {
26635            let to_remove = ["profileId"];
26636            params.remove_params(&to_remove);
26637        }
26638
26639        let url = params.parse_with_url(&url);
26640
26641        let mut json_mime_type = mime::APPLICATION_JSON;
26642        let mut request_value_reader = {
26643            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
26644            common::remove_json_null_values(&mut value);
26645            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
26646            serde_json::to_writer(&mut dst, &value).unwrap();
26647            dst
26648        };
26649        let request_size = request_value_reader
26650            .seek(std::io::SeekFrom::End(0))
26651            .unwrap();
26652        request_value_reader
26653            .seek(std::io::SeekFrom::Start(0))
26654            .unwrap();
26655
26656        loop {
26657            let token = match self
26658                .hub
26659                .auth
26660                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26661                .await
26662            {
26663                Ok(token) => token,
26664                Err(e) => match dlg.token(e) {
26665                    Ok(token) => token,
26666                    Err(e) => {
26667                        dlg.finished(false);
26668                        return Err(common::Error::MissingToken(e));
26669                    }
26670                },
26671            };
26672            request_value_reader
26673                .seek(std::io::SeekFrom::Start(0))
26674                .unwrap();
26675            let mut req_result = {
26676                let client = &self.hub.client;
26677                dlg.pre_request();
26678                let mut req_builder = hyper::Request::builder()
26679                    .method(hyper::Method::PUT)
26680                    .uri(url.as_str())
26681                    .header(USER_AGENT, self.hub._user_agent.clone());
26682
26683                if let Some(token) = token.as_ref() {
26684                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26685                }
26686
26687                let request = req_builder
26688                    .header(CONTENT_TYPE, json_mime_type.to_string())
26689                    .header(CONTENT_LENGTH, request_size as u64)
26690                    .body(common::to_body(
26691                        request_value_reader.get_ref().clone().into(),
26692                    ));
26693
26694                client.request(request.unwrap()).await
26695            };
26696
26697            match req_result {
26698                Err(err) => {
26699                    if let common::Retry::After(d) = dlg.http_error(&err) {
26700                        sleep(d).await;
26701                        continue;
26702                    }
26703                    dlg.finished(false);
26704                    return Err(common::Error::HttpError(err));
26705                }
26706                Ok(res) => {
26707                    let (mut parts, body) = res.into_parts();
26708                    let mut body = common::Body::new(body);
26709                    if !parts.status.is_success() {
26710                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26711                        let error = serde_json::from_str(&common::to_string(&bytes));
26712                        let response = common::to_response(parts, bytes.into());
26713
26714                        if let common::Retry::After(d) =
26715                            dlg.http_failure(&response, error.as_ref().ok())
26716                        {
26717                            sleep(d).await;
26718                            continue;
26719                        }
26720
26721                        dlg.finished(false);
26722
26723                        return Err(match error {
26724                            Ok(value) => common::Error::BadRequest(value),
26725                            _ => common::Error::Failure(response),
26726                        });
26727                    }
26728                    let response = {
26729                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26730                        let encoded = common::to_string(&bytes);
26731                        match serde_json::from_str(&encoded) {
26732                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26733                            Err(error) => {
26734                                dlg.response_json_decode_error(&encoded, &error);
26735                                return Err(common::Error::JsonDecodeError(
26736                                    encoded.to_string(),
26737                                    error,
26738                                ));
26739                            }
26740                        }
26741                    };
26742
26743                    dlg.finished(true);
26744                    return Ok(response);
26745                }
26746            }
26747        }
26748    }
26749
26750    ///
26751    /// Sets the *request* property to the given value.
26752    ///
26753    /// Even though the property as already been set when instantiating this call,
26754    /// we provide this method for API completeness.
26755    pub fn request(mut self, new_value: Advertiser) -> AdvertiserUpdateCall<'a, C> {
26756        self._request = new_value;
26757        self
26758    }
26759    /// User profile ID associated with this request.
26760    ///
26761    /// Sets the *profile id* path property to the given value.
26762    ///
26763    /// Even though the property as already been set when instantiating this call,
26764    /// we provide this method for API completeness.
26765    pub fn profile_id(mut self, new_value: i64) -> AdvertiserUpdateCall<'a, C> {
26766        self._profile_id = new_value;
26767        self
26768    }
26769    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26770    /// while executing the actual API request.
26771    ///
26772    /// ````text
26773    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
26774    /// ````
26775    ///
26776    /// Sets the *delegate* property to the given value.
26777    pub fn delegate(
26778        mut self,
26779        new_value: &'a mut dyn common::Delegate,
26780    ) -> AdvertiserUpdateCall<'a, C> {
26781        self._delegate = Some(new_value);
26782        self
26783    }
26784
26785    /// Set any additional parameter of the query string used in the request.
26786    /// It should be used to set parameters which are not yet available through their own
26787    /// setters.
26788    ///
26789    /// Please note that this method must not be used to set any of the known parameters
26790    /// which have their own setter method. If done anyway, the request will fail.
26791    ///
26792    /// # Additional Parameters
26793    ///
26794    /// * *$.xgafv* (query-string) - V1 error format.
26795    /// * *access_token* (query-string) - OAuth access token.
26796    /// * *alt* (query-string) - Data format for response.
26797    /// * *callback* (query-string) - JSONP
26798    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26799    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
26800    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26801    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26802    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
26803    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26804    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26805    pub fn param<T>(mut self, name: T, value: T) -> AdvertiserUpdateCall<'a, C>
26806    where
26807        T: AsRef<str>,
26808    {
26809        self._additional_params
26810            .insert(name.as_ref().to_string(), value.as_ref().to_string());
26811        self
26812    }
26813
26814    /// Identifies the authorization scope for the method you are building.
26815    ///
26816    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26817    /// [`Scope::Dfatrafficking`].
26818    ///
26819    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26820    /// tokens for more than one scope.
26821    ///
26822    /// Usually there is more than one suitable scope to authorize an operation, some of which may
26823    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26824    /// sufficient, a read-write scope will do as well.
26825    pub fn add_scope<St>(mut self, scope: St) -> AdvertiserUpdateCall<'a, C>
26826    where
26827        St: AsRef<str>,
26828    {
26829        self._scopes.insert(String::from(scope.as_ref()));
26830        self
26831    }
26832    /// Identifies the authorization scope(s) for the method you are building.
26833    ///
26834    /// See [`Self::add_scope()`] for details.
26835    pub fn add_scopes<I, St>(mut self, scopes: I) -> AdvertiserUpdateCall<'a, C>
26836    where
26837        I: IntoIterator<Item = St>,
26838        St: AsRef<str>,
26839    {
26840        self._scopes
26841            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26842        self
26843    }
26844
26845    /// Removes all scopes, and no default scope will be used either.
26846    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26847    /// for details).
26848    pub fn clear_scopes(mut self) -> AdvertiserUpdateCall<'a, C> {
26849        self._scopes.clear();
26850        self
26851    }
26852}
26853
26854/// Retrieves a list of browsers.
26855///
26856/// A builder for the *list* method supported by a *browser* resource.
26857/// It is not used directly, but through a [`BrowserMethods`] instance.
26858///
26859/// # Example
26860///
26861/// Instantiate a resource method builder
26862///
26863/// ```test_harness,no_run
26864/// # extern crate hyper;
26865/// # extern crate hyper_rustls;
26866/// # extern crate google_dfareporting3d3 as dfareporting3d3;
26867/// # async fn dox() {
26868/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26869///
26870/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26871/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
26872/// #     secret,
26873/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26874/// # ).build().await.unwrap();
26875///
26876/// # let client = hyper_util::client::legacy::Client::builder(
26877/// #     hyper_util::rt::TokioExecutor::new()
26878/// # )
26879/// # .build(
26880/// #     hyper_rustls::HttpsConnectorBuilder::new()
26881/// #         .with_native_roots()
26882/// #         .unwrap()
26883/// #         .https_or_http()
26884/// #         .enable_http1()
26885/// #         .build()
26886/// # );
26887/// # let mut hub = Dfareporting::new(client, auth);
26888/// // You can configure optional parameters by calling the respective setters at will, and
26889/// // execute the final call using `doit()`.
26890/// // Values shown here are possibly random and not representative !
26891/// let result = hub.browsers().list(-53)
26892///              .doit().await;
26893/// # }
26894/// ```
26895pub struct BrowserListCall<'a, C>
26896where
26897    C: 'a,
26898{
26899    hub: &'a Dfareporting<C>,
26900    _profile_id: i64,
26901    _delegate: Option<&'a mut dyn common::Delegate>,
26902    _additional_params: HashMap<String, String>,
26903    _scopes: BTreeSet<String>,
26904}
26905
26906impl<'a, C> common::CallBuilder for BrowserListCall<'a, C> {}
26907
26908impl<'a, C> BrowserListCall<'a, C>
26909where
26910    C: common::Connector,
26911{
26912    /// Perform the operation you have build so far.
26913    pub async fn doit(mut self) -> common::Result<(common::Response, BrowsersListResponse)> {
26914        use std::borrow::Cow;
26915        use std::io::{Read, Seek};
26916
26917        use common::{url::Params, ToParts};
26918        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26919
26920        let mut dd = common::DefaultDelegate;
26921        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26922        dlg.begin(common::MethodInfo {
26923            id: "dfareporting.browsers.list",
26924            http_method: hyper::Method::GET,
26925        });
26926
26927        for &field in ["alt", "profileId"].iter() {
26928            if self._additional_params.contains_key(field) {
26929                dlg.finished(false);
26930                return Err(common::Error::FieldClash(field));
26931            }
26932        }
26933
26934        let mut params = Params::with_capacity(3 + self._additional_params.len());
26935        params.push("profileId", self._profile_id.to_string());
26936
26937        params.extend(self._additional_params.iter());
26938
26939        params.push("alt", "json");
26940        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/browsers";
26941        if self._scopes.is_empty() {
26942            self._scopes
26943                .insert(Scope::Dfatrafficking.as_ref().to_string());
26944        }
26945
26946        #[allow(clippy::single_element_loop)]
26947        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
26948            url = params.uri_replacement(url, param_name, find_this, false);
26949        }
26950        {
26951            let to_remove = ["profileId"];
26952            params.remove_params(&to_remove);
26953        }
26954
26955        let url = params.parse_with_url(&url);
26956
26957        loop {
26958            let token = match self
26959                .hub
26960                .auth
26961                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26962                .await
26963            {
26964                Ok(token) => token,
26965                Err(e) => match dlg.token(e) {
26966                    Ok(token) => token,
26967                    Err(e) => {
26968                        dlg.finished(false);
26969                        return Err(common::Error::MissingToken(e));
26970                    }
26971                },
26972            };
26973            let mut req_result = {
26974                let client = &self.hub.client;
26975                dlg.pre_request();
26976                let mut req_builder = hyper::Request::builder()
26977                    .method(hyper::Method::GET)
26978                    .uri(url.as_str())
26979                    .header(USER_AGENT, self.hub._user_agent.clone());
26980
26981                if let Some(token) = token.as_ref() {
26982                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26983                }
26984
26985                let request = req_builder
26986                    .header(CONTENT_LENGTH, 0_u64)
26987                    .body(common::to_body::<String>(None));
26988
26989                client.request(request.unwrap()).await
26990            };
26991
26992            match req_result {
26993                Err(err) => {
26994                    if let common::Retry::After(d) = dlg.http_error(&err) {
26995                        sleep(d).await;
26996                        continue;
26997                    }
26998                    dlg.finished(false);
26999                    return Err(common::Error::HttpError(err));
27000                }
27001                Ok(res) => {
27002                    let (mut parts, body) = res.into_parts();
27003                    let mut body = common::Body::new(body);
27004                    if !parts.status.is_success() {
27005                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27006                        let error = serde_json::from_str(&common::to_string(&bytes));
27007                        let response = common::to_response(parts, bytes.into());
27008
27009                        if let common::Retry::After(d) =
27010                            dlg.http_failure(&response, error.as_ref().ok())
27011                        {
27012                            sleep(d).await;
27013                            continue;
27014                        }
27015
27016                        dlg.finished(false);
27017
27018                        return Err(match error {
27019                            Ok(value) => common::Error::BadRequest(value),
27020                            _ => common::Error::Failure(response),
27021                        });
27022                    }
27023                    let response = {
27024                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27025                        let encoded = common::to_string(&bytes);
27026                        match serde_json::from_str(&encoded) {
27027                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27028                            Err(error) => {
27029                                dlg.response_json_decode_error(&encoded, &error);
27030                                return Err(common::Error::JsonDecodeError(
27031                                    encoded.to_string(),
27032                                    error,
27033                                ));
27034                            }
27035                        }
27036                    };
27037
27038                    dlg.finished(true);
27039                    return Ok(response);
27040                }
27041            }
27042        }
27043    }
27044
27045    /// User profile ID associated with this request.
27046    ///
27047    /// Sets the *profile id* path property to the given value.
27048    ///
27049    /// Even though the property as already been set when instantiating this call,
27050    /// we provide this method for API completeness.
27051    pub fn profile_id(mut self, new_value: i64) -> BrowserListCall<'a, C> {
27052        self._profile_id = new_value;
27053        self
27054    }
27055    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27056    /// while executing the actual API request.
27057    ///
27058    /// ````text
27059    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
27060    /// ````
27061    ///
27062    /// Sets the *delegate* property to the given value.
27063    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> BrowserListCall<'a, C> {
27064        self._delegate = Some(new_value);
27065        self
27066    }
27067
27068    /// Set any additional parameter of the query string used in the request.
27069    /// It should be used to set parameters which are not yet available through their own
27070    /// setters.
27071    ///
27072    /// Please note that this method must not be used to set any of the known parameters
27073    /// which have their own setter method. If done anyway, the request will fail.
27074    ///
27075    /// # Additional Parameters
27076    ///
27077    /// * *$.xgafv* (query-string) - V1 error format.
27078    /// * *access_token* (query-string) - OAuth access token.
27079    /// * *alt* (query-string) - Data format for response.
27080    /// * *callback* (query-string) - JSONP
27081    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27082    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
27083    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27084    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27085    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
27086    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27087    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27088    pub fn param<T>(mut self, name: T, value: T) -> BrowserListCall<'a, C>
27089    where
27090        T: AsRef<str>,
27091    {
27092        self._additional_params
27093            .insert(name.as_ref().to_string(), value.as_ref().to_string());
27094        self
27095    }
27096
27097    /// Identifies the authorization scope for the method you are building.
27098    ///
27099    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27100    /// [`Scope::Dfatrafficking`].
27101    ///
27102    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27103    /// tokens for more than one scope.
27104    ///
27105    /// Usually there is more than one suitable scope to authorize an operation, some of which may
27106    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27107    /// sufficient, a read-write scope will do as well.
27108    pub fn add_scope<St>(mut self, scope: St) -> BrowserListCall<'a, C>
27109    where
27110        St: AsRef<str>,
27111    {
27112        self._scopes.insert(String::from(scope.as_ref()));
27113        self
27114    }
27115    /// Identifies the authorization scope(s) for the method you are building.
27116    ///
27117    /// See [`Self::add_scope()`] for details.
27118    pub fn add_scopes<I, St>(mut self, scopes: I) -> BrowserListCall<'a, C>
27119    where
27120        I: IntoIterator<Item = St>,
27121        St: AsRef<str>,
27122    {
27123        self._scopes
27124            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27125        self
27126    }
27127
27128    /// Removes all scopes, and no default scope will be used either.
27129    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27130    /// for details).
27131    pub fn clear_scopes(mut self) -> BrowserListCall<'a, C> {
27132        self._scopes.clear();
27133        self
27134    }
27135}
27136
27137/// Associates a creative with the specified campaign. This method creates a default ad with dimensions matching the creative in the campaign if such a default ad does not exist already.
27138///
27139/// A builder for the *insert* method supported by a *campaignCreativeAssociation* resource.
27140/// It is not used directly, but through a [`CampaignCreativeAssociationMethods`] instance.
27141///
27142/// # Example
27143///
27144/// Instantiate a resource method builder
27145///
27146/// ```test_harness,no_run
27147/// # extern crate hyper;
27148/// # extern crate hyper_rustls;
27149/// # extern crate google_dfareporting3d3 as dfareporting3d3;
27150/// use dfareporting3d3::api::CampaignCreativeAssociation;
27151/// # async fn dox() {
27152/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27153///
27154/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27155/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
27156/// #     secret,
27157/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27158/// # ).build().await.unwrap();
27159///
27160/// # let client = hyper_util::client::legacy::Client::builder(
27161/// #     hyper_util::rt::TokioExecutor::new()
27162/// # )
27163/// # .build(
27164/// #     hyper_rustls::HttpsConnectorBuilder::new()
27165/// #         .with_native_roots()
27166/// #         .unwrap()
27167/// #         .https_or_http()
27168/// #         .enable_http1()
27169/// #         .build()
27170/// # );
27171/// # let mut hub = Dfareporting::new(client, auth);
27172/// // As the method needs a request, you would usually fill it with the desired information
27173/// // into the respective structure. Some of the parts shown here might not be applicable !
27174/// // Values shown here are possibly random and not representative !
27175/// let mut req = CampaignCreativeAssociation::default();
27176///
27177/// // You can configure optional parameters by calling the respective setters at will, and
27178/// // execute the final call using `doit()`.
27179/// // Values shown here are possibly random and not representative !
27180/// let result = hub.campaign_creative_associations().insert(req, -93, -75)
27181///              .doit().await;
27182/// # }
27183/// ```
27184pub struct CampaignCreativeAssociationInsertCall<'a, C>
27185where
27186    C: 'a,
27187{
27188    hub: &'a Dfareporting<C>,
27189    _request: CampaignCreativeAssociation,
27190    _profile_id: i64,
27191    _campaign_id: i64,
27192    _delegate: Option<&'a mut dyn common::Delegate>,
27193    _additional_params: HashMap<String, String>,
27194    _scopes: BTreeSet<String>,
27195}
27196
27197impl<'a, C> common::CallBuilder for CampaignCreativeAssociationInsertCall<'a, C> {}
27198
27199impl<'a, C> CampaignCreativeAssociationInsertCall<'a, C>
27200where
27201    C: common::Connector,
27202{
27203    /// Perform the operation you have build so far.
27204    pub async fn doit(mut self) -> common::Result<(common::Response, CampaignCreativeAssociation)> {
27205        use std::borrow::Cow;
27206        use std::io::{Read, Seek};
27207
27208        use common::{url::Params, ToParts};
27209        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27210
27211        let mut dd = common::DefaultDelegate;
27212        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27213        dlg.begin(common::MethodInfo {
27214            id: "dfareporting.campaignCreativeAssociations.insert",
27215            http_method: hyper::Method::POST,
27216        });
27217
27218        for &field in ["alt", "profileId", "campaignId"].iter() {
27219            if self._additional_params.contains_key(field) {
27220                dlg.finished(false);
27221                return Err(common::Error::FieldClash(field));
27222            }
27223        }
27224
27225        let mut params = Params::with_capacity(5 + self._additional_params.len());
27226        params.push("profileId", self._profile_id.to_string());
27227        params.push("campaignId", self._campaign_id.to_string());
27228
27229        params.extend(self._additional_params.iter());
27230
27231        params.push("alt", "json");
27232        let mut url = self.hub._base_url.clone()
27233            + "userprofiles/{profileId}/campaigns/{campaignId}/campaignCreativeAssociations";
27234        if self._scopes.is_empty() {
27235            self._scopes
27236                .insert(Scope::Dfatrafficking.as_ref().to_string());
27237        }
27238
27239        #[allow(clippy::single_element_loop)]
27240        for &(find_this, param_name) in
27241            [("{profileId}", "profileId"), ("{campaignId}", "campaignId")].iter()
27242        {
27243            url = params.uri_replacement(url, param_name, find_this, false);
27244        }
27245        {
27246            let to_remove = ["campaignId", "profileId"];
27247            params.remove_params(&to_remove);
27248        }
27249
27250        let url = params.parse_with_url(&url);
27251
27252        let mut json_mime_type = mime::APPLICATION_JSON;
27253        let mut request_value_reader = {
27254            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
27255            common::remove_json_null_values(&mut value);
27256            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
27257            serde_json::to_writer(&mut dst, &value).unwrap();
27258            dst
27259        };
27260        let request_size = request_value_reader
27261            .seek(std::io::SeekFrom::End(0))
27262            .unwrap();
27263        request_value_reader
27264            .seek(std::io::SeekFrom::Start(0))
27265            .unwrap();
27266
27267        loop {
27268            let token = match self
27269                .hub
27270                .auth
27271                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27272                .await
27273            {
27274                Ok(token) => token,
27275                Err(e) => match dlg.token(e) {
27276                    Ok(token) => token,
27277                    Err(e) => {
27278                        dlg.finished(false);
27279                        return Err(common::Error::MissingToken(e));
27280                    }
27281                },
27282            };
27283            request_value_reader
27284                .seek(std::io::SeekFrom::Start(0))
27285                .unwrap();
27286            let mut req_result = {
27287                let client = &self.hub.client;
27288                dlg.pre_request();
27289                let mut req_builder = hyper::Request::builder()
27290                    .method(hyper::Method::POST)
27291                    .uri(url.as_str())
27292                    .header(USER_AGENT, self.hub._user_agent.clone());
27293
27294                if let Some(token) = token.as_ref() {
27295                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27296                }
27297
27298                let request = req_builder
27299                    .header(CONTENT_TYPE, json_mime_type.to_string())
27300                    .header(CONTENT_LENGTH, request_size as u64)
27301                    .body(common::to_body(
27302                        request_value_reader.get_ref().clone().into(),
27303                    ));
27304
27305                client.request(request.unwrap()).await
27306            };
27307
27308            match req_result {
27309                Err(err) => {
27310                    if let common::Retry::After(d) = dlg.http_error(&err) {
27311                        sleep(d).await;
27312                        continue;
27313                    }
27314                    dlg.finished(false);
27315                    return Err(common::Error::HttpError(err));
27316                }
27317                Ok(res) => {
27318                    let (mut parts, body) = res.into_parts();
27319                    let mut body = common::Body::new(body);
27320                    if !parts.status.is_success() {
27321                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27322                        let error = serde_json::from_str(&common::to_string(&bytes));
27323                        let response = common::to_response(parts, bytes.into());
27324
27325                        if let common::Retry::After(d) =
27326                            dlg.http_failure(&response, error.as_ref().ok())
27327                        {
27328                            sleep(d).await;
27329                            continue;
27330                        }
27331
27332                        dlg.finished(false);
27333
27334                        return Err(match error {
27335                            Ok(value) => common::Error::BadRequest(value),
27336                            _ => common::Error::Failure(response),
27337                        });
27338                    }
27339                    let response = {
27340                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27341                        let encoded = common::to_string(&bytes);
27342                        match serde_json::from_str(&encoded) {
27343                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27344                            Err(error) => {
27345                                dlg.response_json_decode_error(&encoded, &error);
27346                                return Err(common::Error::JsonDecodeError(
27347                                    encoded.to_string(),
27348                                    error,
27349                                ));
27350                            }
27351                        }
27352                    };
27353
27354                    dlg.finished(true);
27355                    return Ok(response);
27356                }
27357            }
27358        }
27359    }
27360
27361    ///
27362    /// Sets the *request* property to the given value.
27363    ///
27364    /// Even though the property as already been set when instantiating this call,
27365    /// we provide this method for API completeness.
27366    pub fn request(
27367        mut self,
27368        new_value: CampaignCreativeAssociation,
27369    ) -> CampaignCreativeAssociationInsertCall<'a, C> {
27370        self._request = new_value;
27371        self
27372    }
27373    /// User profile ID associated with this request.
27374    ///
27375    /// Sets the *profile id* path property to the given value.
27376    ///
27377    /// Even though the property as already been set when instantiating this call,
27378    /// we provide this method for API completeness.
27379    pub fn profile_id(mut self, new_value: i64) -> CampaignCreativeAssociationInsertCall<'a, C> {
27380        self._profile_id = new_value;
27381        self
27382    }
27383    /// Campaign ID in this association.
27384    ///
27385    /// Sets the *campaign id* path property to the given value.
27386    ///
27387    /// Even though the property as already been set when instantiating this call,
27388    /// we provide this method for API completeness.
27389    pub fn campaign_id(mut self, new_value: i64) -> CampaignCreativeAssociationInsertCall<'a, C> {
27390        self._campaign_id = new_value;
27391        self
27392    }
27393    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27394    /// while executing the actual API request.
27395    ///
27396    /// ````text
27397    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
27398    /// ````
27399    ///
27400    /// Sets the *delegate* property to the given value.
27401    pub fn delegate(
27402        mut self,
27403        new_value: &'a mut dyn common::Delegate,
27404    ) -> CampaignCreativeAssociationInsertCall<'a, C> {
27405        self._delegate = Some(new_value);
27406        self
27407    }
27408
27409    /// Set any additional parameter of the query string used in the request.
27410    /// It should be used to set parameters which are not yet available through their own
27411    /// setters.
27412    ///
27413    /// Please note that this method must not be used to set any of the known parameters
27414    /// which have their own setter method. If done anyway, the request will fail.
27415    ///
27416    /// # Additional Parameters
27417    ///
27418    /// * *$.xgafv* (query-string) - V1 error format.
27419    /// * *access_token* (query-string) - OAuth access token.
27420    /// * *alt* (query-string) - Data format for response.
27421    /// * *callback* (query-string) - JSONP
27422    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27423    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
27424    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27425    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27426    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
27427    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27428    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27429    pub fn param<T>(mut self, name: T, value: T) -> CampaignCreativeAssociationInsertCall<'a, C>
27430    where
27431        T: AsRef<str>,
27432    {
27433        self._additional_params
27434            .insert(name.as_ref().to_string(), value.as_ref().to_string());
27435        self
27436    }
27437
27438    /// Identifies the authorization scope for the method you are building.
27439    ///
27440    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27441    /// [`Scope::Dfatrafficking`].
27442    ///
27443    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27444    /// tokens for more than one scope.
27445    ///
27446    /// Usually there is more than one suitable scope to authorize an operation, some of which may
27447    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27448    /// sufficient, a read-write scope will do as well.
27449    pub fn add_scope<St>(mut self, scope: St) -> CampaignCreativeAssociationInsertCall<'a, C>
27450    where
27451        St: AsRef<str>,
27452    {
27453        self._scopes.insert(String::from(scope.as_ref()));
27454        self
27455    }
27456    /// Identifies the authorization scope(s) for the method you are building.
27457    ///
27458    /// See [`Self::add_scope()`] for details.
27459    pub fn add_scopes<I, St>(mut self, scopes: I) -> CampaignCreativeAssociationInsertCall<'a, C>
27460    where
27461        I: IntoIterator<Item = St>,
27462        St: AsRef<str>,
27463    {
27464        self._scopes
27465            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27466        self
27467    }
27468
27469    /// Removes all scopes, and no default scope will be used either.
27470    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27471    /// for details).
27472    pub fn clear_scopes(mut self) -> CampaignCreativeAssociationInsertCall<'a, C> {
27473        self._scopes.clear();
27474        self
27475    }
27476}
27477
27478/// Retrieves the list of creative IDs associated with the specified campaign. This method supports paging.
27479///
27480/// A builder for the *list* method supported by a *campaignCreativeAssociation* resource.
27481/// It is not used directly, but through a [`CampaignCreativeAssociationMethods`] instance.
27482///
27483/// # Example
27484///
27485/// Instantiate a resource method builder
27486///
27487/// ```test_harness,no_run
27488/// # extern crate hyper;
27489/// # extern crate hyper_rustls;
27490/// # extern crate google_dfareporting3d3 as dfareporting3d3;
27491/// # async fn dox() {
27492/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27493///
27494/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27495/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
27496/// #     secret,
27497/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27498/// # ).build().await.unwrap();
27499///
27500/// # let client = hyper_util::client::legacy::Client::builder(
27501/// #     hyper_util::rt::TokioExecutor::new()
27502/// # )
27503/// # .build(
27504/// #     hyper_rustls::HttpsConnectorBuilder::new()
27505/// #         .with_native_roots()
27506/// #         .unwrap()
27507/// #         .https_or_http()
27508/// #         .enable_http1()
27509/// #         .build()
27510/// # );
27511/// # let mut hub = Dfareporting::new(client, auth);
27512/// // You can configure optional parameters by calling the respective setters at will, and
27513/// // execute the final call using `doit()`.
27514/// // Values shown here are possibly random and not representative !
27515/// let result = hub.campaign_creative_associations().list(-56, -17)
27516///              .sort_order("Stet")
27517///              .page_token("dolores")
27518///              .max_results(-25)
27519///              .doit().await;
27520/// # }
27521/// ```
27522pub struct CampaignCreativeAssociationListCall<'a, C>
27523where
27524    C: 'a,
27525{
27526    hub: &'a Dfareporting<C>,
27527    _profile_id: i64,
27528    _campaign_id: i64,
27529    _sort_order: Option<String>,
27530    _page_token: Option<String>,
27531    _max_results: Option<i32>,
27532    _delegate: Option<&'a mut dyn common::Delegate>,
27533    _additional_params: HashMap<String, String>,
27534    _scopes: BTreeSet<String>,
27535}
27536
27537impl<'a, C> common::CallBuilder for CampaignCreativeAssociationListCall<'a, C> {}
27538
27539impl<'a, C> CampaignCreativeAssociationListCall<'a, C>
27540where
27541    C: common::Connector,
27542{
27543    /// Perform the operation you have build so far.
27544    pub async fn doit(
27545        mut self,
27546    ) -> common::Result<(common::Response, CampaignCreativeAssociationsListResponse)> {
27547        use std::borrow::Cow;
27548        use std::io::{Read, Seek};
27549
27550        use common::{url::Params, ToParts};
27551        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27552
27553        let mut dd = common::DefaultDelegate;
27554        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27555        dlg.begin(common::MethodInfo {
27556            id: "dfareporting.campaignCreativeAssociations.list",
27557            http_method: hyper::Method::GET,
27558        });
27559
27560        for &field in [
27561            "alt",
27562            "profileId",
27563            "campaignId",
27564            "sortOrder",
27565            "pageToken",
27566            "maxResults",
27567        ]
27568        .iter()
27569        {
27570            if self._additional_params.contains_key(field) {
27571                dlg.finished(false);
27572                return Err(common::Error::FieldClash(field));
27573            }
27574        }
27575
27576        let mut params = Params::with_capacity(7 + self._additional_params.len());
27577        params.push("profileId", self._profile_id.to_string());
27578        params.push("campaignId", self._campaign_id.to_string());
27579        if let Some(value) = self._sort_order.as_ref() {
27580            params.push("sortOrder", value);
27581        }
27582        if let Some(value) = self._page_token.as_ref() {
27583            params.push("pageToken", value);
27584        }
27585        if let Some(value) = self._max_results.as_ref() {
27586            params.push("maxResults", value.to_string());
27587        }
27588
27589        params.extend(self._additional_params.iter());
27590
27591        params.push("alt", "json");
27592        let mut url = self.hub._base_url.clone()
27593            + "userprofiles/{profileId}/campaigns/{campaignId}/campaignCreativeAssociations";
27594        if self._scopes.is_empty() {
27595            self._scopes
27596                .insert(Scope::Dfatrafficking.as_ref().to_string());
27597        }
27598
27599        #[allow(clippy::single_element_loop)]
27600        for &(find_this, param_name) in
27601            [("{profileId}", "profileId"), ("{campaignId}", "campaignId")].iter()
27602        {
27603            url = params.uri_replacement(url, param_name, find_this, false);
27604        }
27605        {
27606            let to_remove = ["campaignId", "profileId"];
27607            params.remove_params(&to_remove);
27608        }
27609
27610        let url = params.parse_with_url(&url);
27611
27612        loop {
27613            let token = match self
27614                .hub
27615                .auth
27616                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27617                .await
27618            {
27619                Ok(token) => token,
27620                Err(e) => match dlg.token(e) {
27621                    Ok(token) => token,
27622                    Err(e) => {
27623                        dlg.finished(false);
27624                        return Err(common::Error::MissingToken(e));
27625                    }
27626                },
27627            };
27628            let mut req_result = {
27629                let client = &self.hub.client;
27630                dlg.pre_request();
27631                let mut req_builder = hyper::Request::builder()
27632                    .method(hyper::Method::GET)
27633                    .uri(url.as_str())
27634                    .header(USER_AGENT, self.hub._user_agent.clone());
27635
27636                if let Some(token) = token.as_ref() {
27637                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27638                }
27639
27640                let request = req_builder
27641                    .header(CONTENT_LENGTH, 0_u64)
27642                    .body(common::to_body::<String>(None));
27643
27644                client.request(request.unwrap()).await
27645            };
27646
27647            match req_result {
27648                Err(err) => {
27649                    if let common::Retry::After(d) = dlg.http_error(&err) {
27650                        sleep(d).await;
27651                        continue;
27652                    }
27653                    dlg.finished(false);
27654                    return Err(common::Error::HttpError(err));
27655                }
27656                Ok(res) => {
27657                    let (mut parts, body) = res.into_parts();
27658                    let mut body = common::Body::new(body);
27659                    if !parts.status.is_success() {
27660                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27661                        let error = serde_json::from_str(&common::to_string(&bytes));
27662                        let response = common::to_response(parts, bytes.into());
27663
27664                        if let common::Retry::After(d) =
27665                            dlg.http_failure(&response, error.as_ref().ok())
27666                        {
27667                            sleep(d).await;
27668                            continue;
27669                        }
27670
27671                        dlg.finished(false);
27672
27673                        return Err(match error {
27674                            Ok(value) => common::Error::BadRequest(value),
27675                            _ => common::Error::Failure(response),
27676                        });
27677                    }
27678                    let response = {
27679                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27680                        let encoded = common::to_string(&bytes);
27681                        match serde_json::from_str(&encoded) {
27682                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27683                            Err(error) => {
27684                                dlg.response_json_decode_error(&encoded, &error);
27685                                return Err(common::Error::JsonDecodeError(
27686                                    encoded.to_string(),
27687                                    error,
27688                                ));
27689                            }
27690                        }
27691                    };
27692
27693                    dlg.finished(true);
27694                    return Ok(response);
27695                }
27696            }
27697        }
27698    }
27699
27700    /// User profile ID associated with this request.
27701    ///
27702    /// Sets the *profile id* path property to the given value.
27703    ///
27704    /// Even though the property as already been set when instantiating this call,
27705    /// we provide this method for API completeness.
27706    pub fn profile_id(mut self, new_value: i64) -> CampaignCreativeAssociationListCall<'a, C> {
27707        self._profile_id = new_value;
27708        self
27709    }
27710    /// Campaign ID in this association.
27711    ///
27712    /// Sets the *campaign id* path property to the given value.
27713    ///
27714    /// Even though the property as already been set when instantiating this call,
27715    /// we provide this method for API completeness.
27716    pub fn campaign_id(mut self, new_value: i64) -> CampaignCreativeAssociationListCall<'a, C> {
27717        self._campaign_id = new_value;
27718        self
27719    }
27720    /// Order of sorted results.
27721    ///
27722    /// Sets the *sort order* query property to the given value.
27723    pub fn sort_order(mut self, new_value: &str) -> CampaignCreativeAssociationListCall<'a, C> {
27724        self._sort_order = Some(new_value.to_string());
27725        self
27726    }
27727    /// Value of the nextPageToken from the previous result page.
27728    ///
27729    /// Sets the *page token* query property to the given value.
27730    pub fn page_token(mut self, new_value: &str) -> CampaignCreativeAssociationListCall<'a, C> {
27731        self._page_token = Some(new_value.to_string());
27732        self
27733    }
27734    /// Maximum number of results to return.
27735    ///
27736    /// Sets the *max results* query property to the given value.
27737    pub fn max_results(mut self, new_value: i32) -> CampaignCreativeAssociationListCall<'a, C> {
27738        self._max_results = Some(new_value);
27739        self
27740    }
27741    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27742    /// while executing the actual API request.
27743    ///
27744    /// ````text
27745    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
27746    /// ````
27747    ///
27748    /// Sets the *delegate* property to the given value.
27749    pub fn delegate(
27750        mut self,
27751        new_value: &'a mut dyn common::Delegate,
27752    ) -> CampaignCreativeAssociationListCall<'a, C> {
27753        self._delegate = Some(new_value);
27754        self
27755    }
27756
27757    /// Set any additional parameter of the query string used in the request.
27758    /// It should be used to set parameters which are not yet available through their own
27759    /// setters.
27760    ///
27761    /// Please note that this method must not be used to set any of the known parameters
27762    /// which have their own setter method. If done anyway, the request will fail.
27763    ///
27764    /// # Additional Parameters
27765    ///
27766    /// * *$.xgafv* (query-string) - V1 error format.
27767    /// * *access_token* (query-string) - OAuth access token.
27768    /// * *alt* (query-string) - Data format for response.
27769    /// * *callback* (query-string) - JSONP
27770    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27771    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
27772    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27773    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27774    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
27775    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27776    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27777    pub fn param<T>(mut self, name: T, value: T) -> CampaignCreativeAssociationListCall<'a, C>
27778    where
27779        T: AsRef<str>,
27780    {
27781        self._additional_params
27782            .insert(name.as_ref().to_string(), value.as_ref().to_string());
27783        self
27784    }
27785
27786    /// Identifies the authorization scope for the method you are building.
27787    ///
27788    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27789    /// [`Scope::Dfatrafficking`].
27790    ///
27791    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27792    /// tokens for more than one scope.
27793    ///
27794    /// Usually there is more than one suitable scope to authorize an operation, some of which may
27795    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27796    /// sufficient, a read-write scope will do as well.
27797    pub fn add_scope<St>(mut self, scope: St) -> CampaignCreativeAssociationListCall<'a, C>
27798    where
27799        St: AsRef<str>,
27800    {
27801        self._scopes.insert(String::from(scope.as_ref()));
27802        self
27803    }
27804    /// Identifies the authorization scope(s) for the method you are building.
27805    ///
27806    /// See [`Self::add_scope()`] for details.
27807    pub fn add_scopes<I, St>(mut self, scopes: I) -> CampaignCreativeAssociationListCall<'a, C>
27808    where
27809        I: IntoIterator<Item = St>,
27810        St: AsRef<str>,
27811    {
27812        self._scopes
27813            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27814        self
27815    }
27816
27817    /// Removes all scopes, and no default scope will be used either.
27818    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27819    /// for details).
27820    pub fn clear_scopes(mut self) -> CampaignCreativeAssociationListCall<'a, C> {
27821        self._scopes.clear();
27822        self
27823    }
27824}
27825
27826/// Gets one campaign by ID.
27827///
27828/// A builder for the *get* method supported by a *campaign* resource.
27829/// It is not used directly, but through a [`CampaignMethods`] instance.
27830///
27831/// # Example
27832///
27833/// Instantiate a resource method builder
27834///
27835/// ```test_harness,no_run
27836/// # extern crate hyper;
27837/// # extern crate hyper_rustls;
27838/// # extern crate google_dfareporting3d3 as dfareporting3d3;
27839/// # async fn dox() {
27840/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27841///
27842/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27843/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
27844/// #     secret,
27845/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27846/// # ).build().await.unwrap();
27847///
27848/// # let client = hyper_util::client::legacy::Client::builder(
27849/// #     hyper_util::rt::TokioExecutor::new()
27850/// # )
27851/// # .build(
27852/// #     hyper_rustls::HttpsConnectorBuilder::new()
27853/// #         .with_native_roots()
27854/// #         .unwrap()
27855/// #         .https_or_http()
27856/// #         .enable_http1()
27857/// #         .build()
27858/// # );
27859/// # let mut hub = Dfareporting::new(client, auth);
27860/// // You can configure optional parameters by calling the respective setters at will, and
27861/// // execute the final call using `doit()`.
27862/// // Values shown here are possibly random and not representative !
27863/// let result = hub.campaigns().get(-68, -10)
27864///              .doit().await;
27865/// # }
27866/// ```
27867pub struct CampaignGetCall<'a, C>
27868where
27869    C: 'a,
27870{
27871    hub: &'a Dfareporting<C>,
27872    _profile_id: i64,
27873    _id: i64,
27874    _delegate: Option<&'a mut dyn common::Delegate>,
27875    _additional_params: HashMap<String, String>,
27876    _scopes: BTreeSet<String>,
27877}
27878
27879impl<'a, C> common::CallBuilder for CampaignGetCall<'a, C> {}
27880
27881impl<'a, C> CampaignGetCall<'a, C>
27882where
27883    C: common::Connector,
27884{
27885    /// Perform the operation you have build so far.
27886    pub async fn doit(mut self) -> common::Result<(common::Response, Campaign)> {
27887        use std::borrow::Cow;
27888        use std::io::{Read, Seek};
27889
27890        use common::{url::Params, ToParts};
27891        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27892
27893        let mut dd = common::DefaultDelegate;
27894        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27895        dlg.begin(common::MethodInfo {
27896            id: "dfareporting.campaigns.get",
27897            http_method: hyper::Method::GET,
27898        });
27899
27900        for &field in ["alt", "profileId", "id"].iter() {
27901            if self._additional_params.contains_key(field) {
27902                dlg.finished(false);
27903                return Err(common::Error::FieldClash(field));
27904            }
27905        }
27906
27907        let mut params = Params::with_capacity(4 + self._additional_params.len());
27908        params.push("profileId", self._profile_id.to_string());
27909        params.push("id", self._id.to_string());
27910
27911        params.extend(self._additional_params.iter());
27912
27913        params.push("alt", "json");
27914        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/campaigns/{id}";
27915        if self._scopes.is_empty() {
27916            self._scopes
27917                .insert(Scope::Dfatrafficking.as_ref().to_string());
27918        }
27919
27920        #[allow(clippy::single_element_loop)]
27921        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
27922            url = params.uri_replacement(url, param_name, find_this, false);
27923        }
27924        {
27925            let to_remove = ["id", "profileId"];
27926            params.remove_params(&to_remove);
27927        }
27928
27929        let url = params.parse_with_url(&url);
27930
27931        loop {
27932            let token = match self
27933                .hub
27934                .auth
27935                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27936                .await
27937            {
27938                Ok(token) => token,
27939                Err(e) => match dlg.token(e) {
27940                    Ok(token) => token,
27941                    Err(e) => {
27942                        dlg.finished(false);
27943                        return Err(common::Error::MissingToken(e));
27944                    }
27945                },
27946            };
27947            let mut req_result = {
27948                let client = &self.hub.client;
27949                dlg.pre_request();
27950                let mut req_builder = hyper::Request::builder()
27951                    .method(hyper::Method::GET)
27952                    .uri(url.as_str())
27953                    .header(USER_AGENT, self.hub._user_agent.clone());
27954
27955                if let Some(token) = token.as_ref() {
27956                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27957                }
27958
27959                let request = req_builder
27960                    .header(CONTENT_LENGTH, 0_u64)
27961                    .body(common::to_body::<String>(None));
27962
27963                client.request(request.unwrap()).await
27964            };
27965
27966            match req_result {
27967                Err(err) => {
27968                    if let common::Retry::After(d) = dlg.http_error(&err) {
27969                        sleep(d).await;
27970                        continue;
27971                    }
27972                    dlg.finished(false);
27973                    return Err(common::Error::HttpError(err));
27974                }
27975                Ok(res) => {
27976                    let (mut parts, body) = res.into_parts();
27977                    let mut body = common::Body::new(body);
27978                    if !parts.status.is_success() {
27979                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27980                        let error = serde_json::from_str(&common::to_string(&bytes));
27981                        let response = common::to_response(parts, bytes.into());
27982
27983                        if let common::Retry::After(d) =
27984                            dlg.http_failure(&response, error.as_ref().ok())
27985                        {
27986                            sleep(d).await;
27987                            continue;
27988                        }
27989
27990                        dlg.finished(false);
27991
27992                        return Err(match error {
27993                            Ok(value) => common::Error::BadRequest(value),
27994                            _ => common::Error::Failure(response),
27995                        });
27996                    }
27997                    let response = {
27998                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27999                        let encoded = common::to_string(&bytes);
28000                        match serde_json::from_str(&encoded) {
28001                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28002                            Err(error) => {
28003                                dlg.response_json_decode_error(&encoded, &error);
28004                                return Err(common::Error::JsonDecodeError(
28005                                    encoded.to_string(),
28006                                    error,
28007                                ));
28008                            }
28009                        }
28010                    };
28011
28012                    dlg.finished(true);
28013                    return Ok(response);
28014                }
28015            }
28016        }
28017    }
28018
28019    /// User profile ID associated with this request.
28020    ///
28021    /// Sets the *profile id* path property to the given value.
28022    ///
28023    /// Even though the property as already been set when instantiating this call,
28024    /// we provide this method for API completeness.
28025    pub fn profile_id(mut self, new_value: i64) -> CampaignGetCall<'a, C> {
28026        self._profile_id = new_value;
28027        self
28028    }
28029    /// Campaign ID.
28030    ///
28031    /// Sets the *id* path property to the given value.
28032    ///
28033    /// Even though the property as already been set when instantiating this call,
28034    /// we provide this method for API completeness.
28035    pub fn id(mut self, new_value: i64) -> CampaignGetCall<'a, C> {
28036        self._id = new_value;
28037        self
28038    }
28039    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28040    /// while executing the actual API request.
28041    ///
28042    /// ````text
28043    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
28044    /// ````
28045    ///
28046    /// Sets the *delegate* property to the given value.
28047    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> CampaignGetCall<'a, C> {
28048        self._delegate = Some(new_value);
28049        self
28050    }
28051
28052    /// Set any additional parameter of the query string used in the request.
28053    /// It should be used to set parameters which are not yet available through their own
28054    /// setters.
28055    ///
28056    /// Please note that this method must not be used to set any of the known parameters
28057    /// which have their own setter method. If done anyway, the request will fail.
28058    ///
28059    /// # Additional Parameters
28060    ///
28061    /// * *$.xgafv* (query-string) - V1 error format.
28062    /// * *access_token* (query-string) - OAuth access token.
28063    /// * *alt* (query-string) - Data format for response.
28064    /// * *callback* (query-string) - JSONP
28065    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28066    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
28067    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28068    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28069    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
28070    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28071    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28072    pub fn param<T>(mut self, name: T, value: T) -> CampaignGetCall<'a, C>
28073    where
28074        T: AsRef<str>,
28075    {
28076        self._additional_params
28077            .insert(name.as_ref().to_string(), value.as_ref().to_string());
28078        self
28079    }
28080
28081    /// Identifies the authorization scope for the method you are building.
28082    ///
28083    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28084    /// [`Scope::Dfatrafficking`].
28085    ///
28086    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28087    /// tokens for more than one scope.
28088    ///
28089    /// Usually there is more than one suitable scope to authorize an operation, some of which may
28090    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28091    /// sufficient, a read-write scope will do as well.
28092    pub fn add_scope<St>(mut self, scope: St) -> CampaignGetCall<'a, C>
28093    where
28094        St: AsRef<str>,
28095    {
28096        self._scopes.insert(String::from(scope.as_ref()));
28097        self
28098    }
28099    /// Identifies the authorization scope(s) for the method you are building.
28100    ///
28101    /// See [`Self::add_scope()`] for details.
28102    pub fn add_scopes<I, St>(mut self, scopes: I) -> CampaignGetCall<'a, C>
28103    where
28104        I: IntoIterator<Item = St>,
28105        St: AsRef<str>,
28106    {
28107        self._scopes
28108            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28109        self
28110    }
28111
28112    /// Removes all scopes, and no default scope will be used either.
28113    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28114    /// for details).
28115    pub fn clear_scopes(mut self) -> CampaignGetCall<'a, C> {
28116        self._scopes.clear();
28117        self
28118    }
28119}
28120
28121/// Inserts a new campaign.
28122///
28123/// A builder for the *insert* method supported by a *campaign* resource.
28124/// It is not used directly, but through a [`CampaignMethods`] instance.
28125///
28126/// # Example
28127///
28128/// Instantiate a resource method builder
28129///
28130/// ```test_harness,no_run
28131/// # extern crate hyper;
28132/// # extern crate hyper_rustls;
28133/// # extern crate google_dfareporting3d3 as dfareporting3d3;
28134/// use dfareporting3d3::api::Campaign;
28135/// # async fn dox() {
28136/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28137///
28138/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28139/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
28140/// #     secret,
28141/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28142/// # ).build().await.unwrap();
28143///
28144/// # let client = hyper_util::client::legacy::Client::builder(
28145/// #     hyper_util::rt::TokioExecutor::new()
28146/// # )
28147/// # .build(
28148/// #     hyper_rustls::HttpsConnectorBuilder::new()
28149/// #         .with_native_roots()
28150/// #         .unwrap()
28151/// #         .https_or_http()
28152/// #         .enable_http1()
28153/// #         .build()
28154/// # );
28155/// # let mut hub = Dfareporting::new(client, auth);
28156/// // As the method needs a request, you would usually fill it with the desired information
28157/// // into the respective structure. Some of the parts shown here might not be applicable !
28158/// // Values shown here are possibly random and not representative !
28159/// let mut req = Campaign::default();
28160///
28161/// // You can configure optional parameters by calling the respective setters at will, and
28162/// // execute the final call using `doit()`.
28163/// // Values shown here are possibly random and not representative !
28164/// let result = hub.campaigns().insert(req, -74)
28165///              .doit().await;
28166/// # }
28167/// ```
28168pub struct CampaignInsertCall<'a, C>
28169where
28170    C: 'a,
28171{
28172    hub: &'a Dfareporting<C>,
28173    _request: Campaign,
28174    _profile_id: i64,
28175    _delegate: Option<&'a mut dyn common::Delegate>,
28176    _additional_params: HashMap<String, String>,
28177    _scopes: BTreeSet<String>,
28178}
28179
28180impl<'a, C> common::CallBuilder for CampaignInsertCall<'a, C> {}
28181
28182impl<'a, C> CampaignInsertCall<'a, C>
28183where
28184    C: common::Connector,
28185{
28186    /// Perform the operation you have build so far.
28187    pub async fn doit(mut self) -> common::Result<(common::Response, Campaign)> {
28188        use std::borrow::Cow;
28189        use std::io::{Read, Seek};
28190
28191        use common::{url::Params, ToParts};
28192        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28193
28194        let mut dd = common::DefaultDelegate;
28195        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28196        dlg.begin(common::MethodInfo {
28197            id: "dfareporting.campaigns.insert",
28198            http_method: hyper::Method::POST,
28199        });
28200
28201        for &field in ["alt", "profileId"].iter() {
28202            if self._additional_params.contains_key(field) {
28203                dlg.finished(false);
28204                return Err(common::Error::FieldClash(field));
28205            }
28206        }
28207
28208        let mut params = Params::with_capacity(4 + self._additional_params.len());
28209        params.push("profileId", self._profile_id.to_string());
28210
28211        params.extend(self._additional_params.iter());
28212
28213        params.push("alt", "json");
28214        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/campaigns";
28215        if self._scopes.is_empty() {
28216            self._scopes
28217                .insert(Scope::Dfatrafficking.as_ref().to_string());
28218        }
28219
28220        #[allow(clippy::single_element_loop)]
28221        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
28222            url = params.uri_replacement(url, param_name, find_this, false);
28223        }
28224        {
28225            let to_remove = ["profileId"];
28226            params.remove_params(&to_remove);
28227        }
28228
28229        let url = params.parse_with_url(&url);
28230
28231        let mut json_mime_type = mime::APPLICATION_JSON;
28232        let mut request_value_reader = {
28233            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
28234            common::remove_json_null_values(&mut value);
28235            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
28236            serde_json::to_writer(&mut dst, &value).unwrap();
28237            dst
28238        };
28239        let request_size = request_value_reader
28240            .seek(std::io::SeekFrom::End(0))
28241            .unwrap();
28242        request_value_reader
28243            .seek(std::io::SeekFrom::Start(0))
28244            .unwrap();
28245
28246        loop {
28247            let token = match self
28248                .hub
28249                .auth
28250                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28251                .await
28252            {
28253                Ok(token) => token,
28254                Err(e) => match dlg.token(e) {
28255                    Ok(token) => token,
28256                    Err(e) => {
28257                        dlg.finished(false);
28258                        return Err(common::Error::MissingToken(e));
28259                    }
28260                },
28261            };
28262            request_value_reader
28263                .seek(std::io::SeekFrom::Start(0))
28264                .unwrap();
28265            let mut req_result = {
28266                let client = &self.hub.client;
28267                dlg.pre_request();
28268                let mut req_builder = hyper::Request::builder()
28269                    .method(hyper::Method::POST)
28270                    .uri(url.as_str())
28271                    .header(USER_AGENT, self.hub._user_agent.clone());
28272
28273                if let Some(token) = token.as_ref() {
28274                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28275                }
28276
28277                let request = req_builder
28278                    .header(CONTENT_TYPE, json_mime_type.to_string())
28279                    .header(CONTENT_LENGTH, request_size as u64)
28280                    .body(common::to_body(
28281                        request_value_reader.get_ref().clone().into(),
28282                    ));
28283
28284                client.request(request.unwrap()).await
28285            };
28286
28287            match req_result {
28288                Err(err) => {
28289                    if let common::Retry::After(d) = dlg.http_error(&err) {
28290                        sleep(d).await;
28291                        continue;
28292                    }
28293                    dlg.finished(false);
28294                    return Err(common::Error::HttpError(err));
28295                }
28296                Ok(res) => {
28297                    let (mut parts, body) = res.into_parts();
28298                    let mut body = common::Body::new(body);
28299                    if !parts.status.is_success() {
28300                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28301                        let error = serde_json::from_str(&common::to_string(&bytes));
28302                        let response = common::to_response(parts, bytes.into());
28303
28304                        if let common::Retry::After(d) =
28305                            dlg.http_failure(&response, error.as_ref().ok())
28306                        {
28307                            sleep(d).await;
28308                            continue;
28309                        }
28310
28311                        dlg.finished(false);
28312
28313                        return Err(match error {
28314                            Ok(value) => common::Error::BadRequest(value),
28315                            _ => common::Error::Failure(response),
28316                        });
28317                    }
28318                    let response = {
28319                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28320                        let encoded = common::to_string(&bytes);
28321                        match serde_json::from_str(&encoded) {
28322                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28323                            Err(error) => {
28324                                dlg.response_json_decode_error(&encoded, &error);
28325                                return Err(common::Error::JsonDecodeError(
28326                                    encoded.to_string(),
28327                                    error,
28328                                ));
28329                            }
28330                        }
28331                    };
28332
28333                    dlg.finished(true);
28334                    return Ok(response);
28335                }
28336            }
28337        }
28338    }
28339
28340    ///
28341    /// Sets the *request* property to the given value.
28342    ///
28343    /// Even though the property as already been set when instantiating this call,
28344    /// we provide this method for API completeness.
28345    pub fn request(mut self, new_value: Campaign) -> CampaignInsertCall<'a, C> {
28346        self._request = new_value;
28347        self
28348    }
28349    /// User profile ID associated with this request.
28350    ///
28351    /// Sets the *profile id* path property to the given value.
28352    ///
28353    /// Even though the property as already been set when instantiating this call,
28354    /// we provide this method for API completeness.
28355    pub fn profile_id(mut self, new_value: i64) -> CampaignInsertCall<'a, C> {
28356        self._profile_id = new_value;
28357        self
28358    }
28359    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28360    /// while executing the actual API request.
28361    ///
28362    /// ````text
28363    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
28364    /// ````
28365    ///
28366    /// Sets the *delegate* property to the given value.
28367    pub fn delegate(
28368        mut self,
28369        new_value: &'a mut dyn common::Delegate,
28370    ) -> CampaignInsertCall<'a, C> {
28371        self._delegate = Some(new_value);
28372        self
28373    }
28374
28375    /// Set any additional parameter of the query string used in the request.
28376    /// It should be used to set parameters which are not yet available through their own
28377    /// setters.
28378    ///
28379    /// Please note that this method must not be used to set any of the known parameters
28380    /// which have their own setter method. If done anyway, the request will fail.
28381    ///
28382    /// # Additional Parameters
28383    ///
28384    /// * *$.xgafv* (query-string) - V1 error format.
28385    /// * *access_token* (query-string) - OAuth access token.
28386    /// * *alt* (query-string) - Data format for response.
28387    /// * *callback* (query-string) - JSONP
28388    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28389    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
28390    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28391    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28392    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
28393    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28394    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28395    pub fn param<T>(mut self, name: T, value: T) -> CampaignInsertCall<'a, C>
28396    where
28397        T: AsRef<str>,
28398    {
28399        self._additional_params
28400            .insert(name.as_ref().to_string(), value.as_ref().to_string());
28401        self
28402    }
28403
28404    /// Identifies the authorization scope for the method you are building.
28405    ///
28406    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28407    /// [`Scope::Dfatrafficking`].
28408    ///
28409    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28410    /// tokens for more than one scope.
28411    ///
28412    /// Usually there is more than one suitable scope to authorize an operation, some of which may
28413    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28414    /// sufficient, a read-write scope will do as well.
28415    pub fn add_scope<St>(mut self, scope: St) -> CampaignInsertCall<'a, C>
28416    where
28417        St: AsRef<str>,
28418    {
28419        self._scopes.insert(String::from(scope.as_ref()));
28420        self
28421    }
28422    /// Identifies the authorization scope(s) for the method you are building.
28423    ///
28424    /// See [`Self::add_scope()`] for details.
28425    pub fn add_scopes<I, St>(mut self, scopes: I) -> CampaignInsertCall<'a, C>
28426    where
28427        I: IntoIterator<Item = St>,
28428        St: AsRef<str>,
28429    {
28430        self._scopes
28431            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28432        self
28433    }
28434
28435    /// Removes all scopes, and no default scope will be used either.
28436    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28437    /// for details).
28438    pub fn clear_scopes(mut self) -> CampaignInsertCall<'a, C> {
28439        self._scopes.clear();
28440        self
28441    }
28442}
28443
28444/// Retrieves a list of campaigns, possibly filtered. This method supports paging.
28445///
28446/// A builder for the *list* method supported by a *campaign* resource.
28447/// It is not used directly, but through a [`CampaignMethods`] instance.
28448///
28449/// # Example
28450///
28451/// Instantiate a resource method builder
28452///
28453/// ```test_harness,no_run
28454/// # extern crate hyper;
28455/// # extern crate hyper_rustls;
28456/// # extern crate google_dfareporting3d3 as dfareporting3d3;
28457/// # async fn dox() {
28458/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28459///
28460/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28461/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
28462/// #     secret,
28463/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28464/// # ).build().await.unwrap();
28465///
28466/// # let client = hyper_util::client::legacy::Client::builder(
28467/// #     hyper_util::rt::TokioExecutor::new()
28468/// # )
28469/// # .build(
28470/// #     hyper_rustls::HttpsConnectorBuilder::new()
28471/// #         .with_native_roots()
28472/// #         .unwrap()
28473/// #         .https_or_http()
28474/// #         .enable_http1()
28475/// #         .build()
28476/// # );
28477/// # let mut hub = Dfareporting::new(client, auth);
28478/// // You can configure optional parameters by calling the respective setters at will, and
28479/// // execute the final call using `doit()`.
28480/// // Values shown here are possibly random and not representative !
28481/// let result = hub.campaigns().list(-77)
28482///              .subaccount_id(-84)
28483///              .sort_order("eirmod")
28484///              .sort_field("Lorem")
28485///              .search_string("accusam")
28486///              .page_token("amet")
28487///              .overridden_event_tag_id(-31)
28488///              .max_results(-69)
28489///              .add_ids(-81)
28490///              .add_excluded_ids(-73)
28491///              .at_least_one_optimization_activity(true)
28492///              .archived(true)
28493///              .add_advertiser_ids(-22)
28494///              .add_advertiser_group_ids(-77)
28495///              .doit().await;
28496/// # }
28497/// ```
28498pub struct CampaignListCall<'a, C>
28499where
28500    C: 'a,
28501{
28502    hub: &'a Dfareporting<C>,
28503    _profile_id: i64,
28504    _subaccount_id: Option<i64>,
28505    _sort_order: Option<String>,
28506    _sort_field: Option<String>,
28507    _search_string: Option<String>,
28508    _page_token: Option<String>,
28509    _overridden_event_tag_id: Option<i64>,
28510    _max_results: Option<i32>,
28511    _ids: Vec<i64>,
28512    _excluded_ids: Vec<i64>,
28513    _at_least_one_optimization_activity: Option<bool>,
28514    _archived: Option<bool>,
28515    _advertiser_ids: Vec<i64>,
28516    _advertiser_group_ids: Vec<i64>,
28517    _delegate: Option<&'a mut dyn common::Delegate>,
28518    _additional_params: HashMap<String, String>,
28519    _scopes: BTreeSet<String>,
28520}
28521
28522impl<'a, C> common::CallBuilder for CampaignListCall<'a, C> {}
28523
28524impl<'a, C> CampaignListCall<'a, C>
28525where
28526    C: common::Connector,
28527{
28528    /// Perform the operation you have build so far.
28529    pub async fn doit(mut self) -> common::Result<(common::Response, CampaignsListResponse)> {
28530        use std::borrow::Cow;
28531        use std::io::{Read, Seek};
28532
28533        use common::{url::Params, ToParts};
28534        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28535
28536        let mut dd = common::DefaultDelegate;
28537        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28538        dlg.begin(common::MethodInfo {
28539            id: "dfareporting.campaigns.list",
28540            http_method: hyper::Method::GET,
28541        });
28542
28543        for &field in [
28544            "alt",
28545            "profileId",
28546            "subaccountId",
28547            "sortOrder",
28548            "sortField",
28549            "searchString",
28550            "pageToken",
28551            "overriddenEventTagId",
28552            "maxResults",
28553            "ids",
28554            "excludedIds",
28555            "atLeastOneOptimizationActivity",
28556            "archived",
28557            "advertiserIds",
28558            "advertiserGroupIds",
28559        ]
28560        .iter()
28561        {
28562            if self._additional_params.contains_key(field) {
28563                dlg.finished(false);
28564                return Err(common::Error::FieldClash(field));
28565            }
28566        }
28567
28568        let mut params = Params::with_capacity(16 + self._additional_params.len());
28569        params.push("profileId", self._profile_id.to_string());
28570        if let Some(value) = self._subaccount_id.as_ref() {
28571            params.push("subaccountId", value.to_string());
28572        }
28573        if let Some(value) = self._sort_order.as_ref() {
28574            params.push("sortOrder", value);
28575        }
28576        if let Some(value) = self._sort_field.as_ref() {
28577            params.push("sortField", value);
28578        }
28579        if let Some(value) = self._search_string.as_ref() {
28580            params.push("searchString", value);
28581        }
28582        if let Some(value) = self._page_token.as_ref() {
28583            params.push("pageToken", value);
28584        }
28585        if let Some(value) = self._overridden_event_tag_id.as_ref() {
28586            params.push("overriddenEventTagId", value.to_string());
28587        }
28588        if let Some(value) = self._max_results.as_ref() {
28589            params.push("maxResults", value.to_string());
28590        }
28591        if !self._ids.is_empty() {
28592            for f in self._ids.iter() {
28593                params.push("ids", f.to_string());
28594            }
28595        }
28596        if !self._excluded_ids.is_empty() {
28597            for f in self._excluded_ids.iter() {
28598                params.push("excludedIds", f.to_string());
28599            }
28600        }
28601        if let Some(value) = self._at_least_one_optimization_activity.as_ref() {
28602            params.push("atLeastOneOptimizationActivity", value.to_string());
28603        }
28604        if let Some(value) = self._archived.as_ref() {
28605            params.push("archived", value.to_string());
28606        }
28607        if !self._advertiser_ids.is_empty() {
28608            for f in self._advertiser_ids.iter() {
28609                params.push("advertiserIds", f.to_string());
28610            }
28611        }
28612        if !self._advertiser_group_ids.is_empty() {
28613            for f in self._advertiser_group_ids.iter() {
28614                params.push("advertiserGroupIds", f.to_string());
28615            }
28616        }
28617
28618        params.extend(self._additional_params.iter());
28619
28620        params.push("alt", "json");
28621        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/campaigns";
28622        if self._scopes.is_empty() {
28623            self._scopes
28624                .insert(Scope::Dfatrafficking.as_ref().to_string());
28625        }
28626
28627        #[allow(clippy::single_element_loop)]
28628        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
28629            url = params.uri_replacement(url, param_name, find_this, false);
28630        }
28631        {
28632            let to_remove = ["profileId"];
28633            params.remove_params(&to_remove);
28634        }
28635
28636        let url = params.parse_with_url(&url);
28637
28638        loop {
28639            let token = match self
28640                .hub
28641                .auth
28642                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28643                .await
28644            {
28645                Ok(token) => token,
28646                Err(e) => match dlg.token(e) {
28647                    Ok(token) => token,
28648                    Err(e) => {
28649                        dlg.finished(false);
28650                        return Err(common::Error::MissingToken(e));
28651                    }
28652                },
28653            };
28654            let mut req_result = {
28655                let client = &self.hub.client;
28656                dlg.pre_request();
28657                let mut req_builder = hyper::Request::builder()
28658                    .method(hyper::Method::GET)
28659                    .uri(url.as_str())
28660                    .header(USER_AGENT, self.hub._user_agent.clone());
28661
28662                if let Some(token) = token.as_ref() {
28663                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28664                }
28665
28666                let request = req_builder
28667                    .header(CONTENT_LENGTH, 0_u64)
28668                    .body(common::to_body::<String>(None));
28669
28670                client.request(request.unwrap()).await
28671            };
28672
28673            match req_result {
28674                Err(err) => {
28675                    if let common::Retry::After(d) = dlg.http_error(&err) {
28676                        sleep(d).await;
28677                        continue;
28678                    }
28679                    dlg.finished(false);
28680                    return Err(common::Error::HttpError(err));
28681                }
28682                Ok(res) => {
28683                    let (mut parts, body) = res.into_parts();
28684                    let mut body = common::Body::new(body);
28685                    if !parts.status.is_success() {
28686                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28687                        let error = serde_json::from_str(&common::to_string(&bytes));
28688                        let response = common::to_response(parts, bytes.into());
28689
28690                        if let common::Retry::After(d) =
28691                            dlg.http_failure(&response, error.as_ref().ok())
28692                        {
28693                            sleep(d).await;
28694                            continue;
28695                        }
28696
28697                        dlg.finished(false);
28698
28699                        return Err(match error {
28700                            Ok(value) => common::Error::BadRequest(value),
28701                            _ => common::Error::Failure(response),
28702                        });
28703                    }
28704                    let response = {
28705                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28706                        let encoded = common::to_string(&bytes);
28707                        match serde_json::from_str(&encoded) {
28708                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28709                            Err(error) => {
28710                                dlg.response_json_decode_error(&encoded, &error);
28711                                return Err(common::Error::JsonDecodeError(
28712                                    encoded.to_string(),
28713                                    error,
28714                                ));
28715                            }
28716                        }
28717                    };
28718
28719                    dlg.finished(true);
28720                    return Ok(response);
28721                }
28722            }
28723        }
28724    }
28725
28726    /// User profile ID associated with this request.
28727    ///
28728    /// Sets the *profile id* path property to the given value.
28729    ///
28730    /// Even though the property as already been set when instantiating this call,
28731    /// we provide this method for API completeness.
28732    pub fn profile_id(mut self, new_value: i64) -> CampaignListCall<'a, C> {
28733        self._profile_id = new_value;
28734        self
28735    }
28736    /// Select only campaigns that belong to this subaccount.
28737    ///
28738    /// Sets the *subaccount id* query property to the given value.
28739    pub fn subaccount_id(mut self, new_value: i64) -> CampaignListCall<'a, C> {
28740        self._subaccount_id = Some(new_value);
28741        self
28742    }
28743    /// Order of sorted results.
28744    ///
28745    /// Sets the *sort order* query property to the given value.
28746    pub fn sort_order(mut self, new_value: &str) -> CampaignListCall<'a, C> {
28747        self._sort_order = Some(new_value.to_string());
28748        self
28749    }
28750    /// Field by which to sort the list.
28751    ///
28752    /// Sets the *sort field* query property to the given value.
28753    pub fn sort_field(mut self, new_value: &str) -> CampaignListCall<'a, C> {
28754        self._sort_field = Some(new_value.to_string());
28755        self
28756    }
28757    /// Allows searching for campaigns by name or ID. Wildcards (*) are allowed. For example, "campaign*2015" will return campaigns with names like "campaign June 2015", "campaign April 2015", or simply "campaign 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "campaign" will match campaigns with name "my campaign", "campaign 2015", or simply "campaign".
28758    ///
28759    /// Sets the *search string* query property to the given value.
28760    pub fn search_string(mut self, new_value: &str) -> CampaignListCall<'a, C> {
28761        self._search_string = Some(new_value.to_string());
28762        self
28763    }
28764    /// Value of the nextPageToken from the previous result page.
28765    ///
28766    /// Sets the *page token* query property to the given value.
28767    pub fn page_token(mut self, new_value: &str) -> CampaignListCall<'a, C> {
28768        self._page_token = Some(new_value.to_string());
28769        self
28770    }
28771    /// Select only campaigns that have overridden this event tag ID.
28772    ///
28773    /// Sets the *overridden event tag id* query property to the given value.
28774    pub fn overridden_event_tag_id(mut self, new_value: i64) -> CampaignListCall<'a, C> {
28775        self._overridden_event_tag_id = Some(new_value);
28776        self
28777    }
28778    /// Maximum number of results to return.
28779    ///
28780    /// Sets the *max results* query property to the given value.
28781    pub fn max_results(mut self, new_value: i32) -> CampaignListCall<'a, C> {
28782        self._max_results = Some(new_value);
28783        self
28784    }
28785    /// Select only campaigns with these IDs.
28786    ///
28787    /// Append the given value to the *ids* query property.
28788    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
28789    pub fn add_ids(mut self, new_value: i64) -> CampaignListCall<'a, C> {
28790        self._ids.push(new_value);
28791        self
28792    }
28793    /// Exclude campaigns with these IDs.
28794    ///
28795    /// Append the given value to the *excluded ids* query property.
28796    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
28797    pub fn add_excluded_ids(mut self, new_value: i64) -> CampaignListCall<'a, C> {
28798        self._excluded_ids.push(new_value);
28799        self
28800    }
28801    /// Select only campaigns that have at least one optimization activity.
28802    ///
28803    /// Sets the *at least one optimization activity* query property to the given value.
28804    pub fn at_least_one_optimization_activity(
28805        mut self,
28806        new_value: bool,
28807    ) -> CampaignListCall<'a, C> {
28808        self._at_least_one_optimization_activity = Some(new_value);
28809        self
28810    }
28811    /// Select only archived campaigns. Don't set this field to select both archived and non-archived campaigns.
28812    ///
28813    /// Sets the *archived* query property to the given value.
28814    pub fn archived(mut self, new_value: bool) -> CampaignListCall<'a, C> {
28815        self._archived = Some(new_value);
28816        self
28817    }
28818    /// Select only campaigns that belong to these advertisers.
28819    ///
28820    /// Append the given value to the *advertiser ids* query property.
28821    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
28822    pub fn add_advertiser_ids(mut self, new_value: i64) -> CampaignListCall<'a, C> {
28823        self._advertiser_ids.push(new_value);
28824        self
28825    }
28826    /// Select only campaigns whose advertisers belong to these advertiser groups.
28827    ///
28828    /// Append the given value to the *advertiser group ids* query property.
28829    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
28830    pub fn add_advertiser_group_ids(mut self, new_value: i64) -> CampaignListCall<'a, C> {
28831        self._advertiser_group_ids.push(new_value);
28832        self
28833    }
28834    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28835    /// while executing the actual API request.
28836    ///
28837    /// ````text
28838    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
28839    /// ````
28840    ///
28841    /// Sets the *delegate* property to the given value.
28842    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> CampaignListCall<'a, C> {
28843        self._delegate = Some(new_value);
28844        self
28845    }
28846
28847    /// Set any additional parameter of the query string used in the request.
28848    /// It should be used to set parameters which are not yet available through their own
28849    /// setters.
28850    ///
28851    /// Please note that this method must not be used to set any of the known parameters
28852    /// which have their own setter method. If done anyway, the request will fail.
28853    ///
28854    /// # Additional Parameters
28855    ///
28856    /// * *$.xgafv* (query-string) - V1 error format.
28857    /// * *access_token* (query-string) - OAuth access token.
28858    /// * *alt* (query-string) - Data format for response.
28859    /// * *callback* (query-string) - JSONP
28860    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28861    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
28862    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28863    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28864    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
28865    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28866    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28867    pub fn param<T>(mut self, name: T, value: T) -> CampaignListCall<'a, C>
28868    where
28869        T: AsRef<str>,
28870    {
28871        self._additional_params
28872            .insert(name.as_ref().to_string(), value.as_ref().to_string());
28873        self
28874    }
28875
28876    /// Identifies the authorization scope for the method you are building.
28877    ///
28878    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28879    /// [`Scope::Dfatrafficking`].
28880    ///
28881    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28882    /// tokens for more than one scope.
28883    ///
28884    /// Usually there is more than one suitable scope to authorize an operation, some of which may
28885    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28886    /// sufficient, a read-write scope will do as well.
28887    pub fn add_scope<St>(mut self, scope: St) -> CampaignListCall<'a, C>
28888    where
28889        St: AsRef<str>,
28890    {
28891        self._scopes.insert(String::from(scope.as_ref()));
28892        self
28893    }
28894    /// Identifies the authorization scope(s) for the method you are building.
28895    ///
28896    /// See [`Self::add_scope()`] for details.
28897    pub fn add_scopes<I, St>(mut self, scopes: I) -> CampaignListCall<'a, C>
28898    where
28899        I: IntoIterator<Item = St>,
28900        St: AsRef<str>,
28901    {
28902        self._scopes
28903            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28904        self
28905    }
28906
28907    /// Removes all scopes, and no default scope will be used either.
28908    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28909    /// for details).
28910    pub fn clear_scopes(mut self) -> CampaignListCall<'a, C> {
28911        self._scopes.clear();
28912        self
28913    }
28914}
28915
28916/// Updates an existing campaign. This method supports patch semantics.
28917///
28918/// A builder for the *patch* method supported by a *campaign* resource.
28919/// It is not used directly, but through a [`CampaignMethods`] instance.
28920///
28921/// # Example
28922///
28923/// Instantiate a resource method builder
28924///
28925/// ```test_harness,no_run
28926/// # extern crate hyper;
28927/// # extern crate hyper_rustls;
28928/// # extern crate google_dfareporting3d3 as dfareporting3d3;
28929/// use dfareporting3d3::api::Campaign;
28930/// # async fn dox() {
28931/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28932///
28933/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28934/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
28935/// #     secret,
28936/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28937/// # ).build().await.unwrap();
28938///
28939/// # let client = hyper_util::client::legacy::Client::builder(
28940/// #     hyper_util::rt::TokioExecutor::new()
28941/// # )
28942/// # .build(
28943/// #     hyper_rustls::HttpsConnectorBuilder::new()
28944/// #         .with_native_roots()
28945/// #         .unwrap()
28946/// #         .https_or_http()
28947/// #         .enable_http1()
28948/// #         .build()
28949/// # );
28950/// # let mut hub = Dfareporting::new(client, auth);
28951/// // As the method needs a request, you would usually fill it with the desired information
28952/// // into the respective structure. Some of the parts shown here might not be applicable !
28953/// // Values shown here are possibly random and not representative !
28954/// let mut req = Campaign::default();
28955///
28956/// // You can configure optional parameters by calling the respective setters at will, and
28957/// // execute the final call using `doit()`.
28958/// // Values shown here are possibly random and not representative !
28959/// let result = hub.campaigns().patch(req, -4, -22)
28960///              .doit().await;
28961/// # }
28962/// ```
28963pub struct CampaignPatchCall<'a, C>
28964where
28965    C: 'a,
28966{
28967    hub: &'a Dfareporting<C>,
28968    _request: Campaign,
28969    _profile_id: i64,
28970    _id: i64,
28971    _delegate: Option<&'a mut dyn common::Delegate>,
28972    _additional_params: HashMap<String, String>,
28973    _scopes: BTreeSet<String>,
28974}
28975
28976impl<'a, C> common::CallBuilder for CampaignPatchCall<'a, C> {}
28977
28978impl<'a, C> CampaignPatchCall<'a, C>
28979where
28980    C: common::Connector,
28981{
28982    /// Perform the operation you have build so far.
28983    pub async fn doit(mut self) -> common::Result<(common::Response, Campaign)> {
28984        use std::borrow::Cow;
28985        use std::io::{Read, Seek};
28986
28987        use common::{url::Params, ToParts};
28988        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28989
28990        let mut dd = common::DefaultDelegate;
28991        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28992        dlg.begin(common::MethodInfo {
28993            id: "dfareporting.campaigns.patch",
28994            http_method: hyper::Method::PATCH,
28995        });
28996
28997        for &field in ["alt", "profileId", "id"].iter() {
28998            if self._additional_params.contains_key(field) {
28999                dlg.finished(false);
29000                return Err(common::Error::FieldClash(field));
29001            }
29002        }
29003
29004        let mut params = Params::with_capacity(5 + self._additional_params.len());
29005        params.push("profileId", self._profile_id.to_string());
29006        params.push("id", self._id.to_string());
29007
29008        params.extend(self._additional_params.iter());
29009
29010        params.push("alt", "json");
29011        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/campaigns";
29012        if self._scopes.is_empty() {
29013            self._scopes
29014                .insert(Scope::Dfatrafficking.as_ref().to_string());
29015        }
29016
29017        #[allow(clippy::single_element_loop)]
29018        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
29019            url = params.uri_replacement(url, param_name, find_this, false);
29020        }
29021        {
29022            let to_remove = ["profileId"];
29023            params.remove_params(&to_remove);
29024        }
29025
29026        let url = params.parse_with_url(&url);
29027
29028        let mut json_mime_type = mime::APPLICATION_JSON;
29029        let mut request_value_reader = {
29030            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
29031            common::remove_json_null_values(&mut value);
29032            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
29033            serde_json::to_writer(&mut dst, &value).unwrap();
29034            dst
29035        };
29036        let request_size = request_value_reader
29037            .seek(std::io::SeekFrom::End(0))
29038            .unwrap();
29039        request_value_reader
29040            .seek(std::io::SeekFrom::Start(0))
29041            .unwrap();
29042
29043        loop {
29044            let token = match self
29045                .hub
29046                .auth
29047                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29048                .await
29049            {
29050                Ok(token) => token,
29051                Err(e) => match dlg.token(e) {
29052                    Ok(token) => token,
29053                    Err(e) => {
29054                        dlg.finished(false);
29055                        return Err(common::Error::MissingToken(e));
29056                    }
29057                },
29058            };
29059            request_value_reader
29060                .seek(std::io::SeekFrom::Start(0))
29061                .unwrap();
29062            let mut req_result = {
29063                let client = &self.hub.client;
29064                dlg.pre_request();
29065                let mut req_builder = hyper::Request::builder()
29066                    .method(hyper::Method::PATCH)
29067                    .uri(url.as_str())
29068                    .header(USER_AGENT, self.hub._user_agent.clone());
29069
29070                if let Some(token) = token.as_ref() {
29071                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29072                }
29073
29074                let request = req_builder
29075                    .header(CONTENT_TYPE, json_mime_type.to_string())
29076                    .header(CONTENT_LENGTH, request_size as u64)
29077                    .body(common::to_body(
29078                        request_value_reader.get_ref().clone().into(),
29079                    ));
29080
29081                client.request(request.unwrap()).await
29082            };
29083
29084            match req_result {
29085                Err(err) => {
29086                    if let common::Retry::After(d) = dlg.http_error(&err) {
29087                        sleep(d).await;
29088                        continue;
29089                    }
29090                    dlg.finished(false);
29091                    return Err(common::Error::HttpError(err));
29092                }
29093                Ok(res) => {
29094                    let (mut parts, body) = res.into_parts();
29095                    let mut body = common::Body::new(body);
29096                    if !parts.status.is_success() {
29097                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29098                        let error = serde_json::from_str(&common::to_string(&bytes));
29099                        let response = common::to_response(parts, bytes.into());
29100
29101                        if let common::Retry::After(d) =
29102                            dlg.http_failure(&response, error.as_ref().ok())
29103                        {
29104                            sleep(d).await;
29105                            continue;
29106                        }
29107
29108                        dlg.finished(false);
29109
29110                        return Err(match error {
29111                            Ok(value) => common::Error::BadRequest(value),
29112                            _ => common::Error::Failure(response),
29113                        });
29114                    }
29115                    let response = {
29116                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29117                        let encoded = common::to_string(&bytes);
29118                        match serde_json::from_str(&encoded) {
29119                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29120                            Err(error) => {
29121                                dlg.response_json_decode_error(&encoded, &error);
29122                                return Err(common::Error::JsonDecodeError(
29123                                    encoded.to_string(),
29124                                    error,
29125                                ));
29126                            }
29127                        }
29128                    };
29129
29130                    dlg.finished(true);
29131                    return Ok(response);
29132                }
29133            }
29134        }
29135    }
29136
29137    ///
29138    /// Sets the *request* property to the given value.
29139    ///
29140    /// Even though the property as already been set when instantiating this call,
29141    /// we provide this method for API completeness.
29142    pub fn request(mut self, new_value: Campaign) -> CampaignPatchCall<'a, C> {
29143        self._request = new_value;
29144        self
29145    }
29146    /// User profile ID associated with this request.
29147    ///
29148    /// Sets the *profile id* path property to the given value.
29149    ///
29150    /// Even though the property as already been set when instantiating this call,
29151    /// we provide this method for API completeness.
29152    pub fn profile_id(mut self, new_value: i64) -> CampaignPatchCall<'a, C> {
29153        self._profile_id = new_value;
29154        self
29155    }
29156    /// Campaign ID.
29157    ///
29158    /// Sets the *id* query property to the given value.
29159    ///
29160    /// Even though the property as already been set when instantiating this call,
29161    /// we provide this method for API completeness.
29162    pub fn id(mut self, new_value: i64) -> CampaignPatchCall<'a, C> {
29163        self._id = new_value;
29164        self
29165    }
29166    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29167    /// while executing the actual API request.
29168    ///
29169    /// ````text
29170    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
29171    /// ````
29172    ///
29173    /// Sets the *delegate* property to the given value.
29174    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> CampaignPatchCall<'a, C> {
29175        self._delegate = Some(new_value);
29176        self
29177    }
29178
29179    /// Set any additional parameter of the query string used in the request.
29180    /// It should be used to set parameters which are not yet available through their own
29181    /// setters.
29182    ///
29183    /// Please note that this method must not be used to set any of the known parameters
29184    /// which have their own setter method. If done anyway, the request will fail.
29185    ///
29186    /// # Additional Parameters
29187    ///
29188    /// * *$.xgafv* (query-string) - V1 error format.
29189    /// * *access_token* (query-string) - OAuth access token.
29190    /// * *alt* (query-string) - Data format for response.
29191    /// * *callback* (query-string) - JSONP
29192    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29193    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
29194    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29195    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29196    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
29197    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29198    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29199    pub fn param<T>(mut self, name: T, value: T) -> CampaignPatchCall<'a, C>
29200    where
29201        T: AsRef<str>,
29202    {
29203        self._additional_params
29204            .insert(name.as_ref().to_string(), value.as_ref().to_string());
29205        self
29206    }
29207
29208    /// Identifies the authorization scope for the method you are building.
29209    ///
29210    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29211    /// [`Scope::Dfatrafficking`].
29212    ///
29213    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29214    /// tokens for more than one scope.
29215    ///
29216    /// Usually there is more than one suitable scope to authorize an operation, some of which may
29217    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29218    /// sufficient, a read-write scope will do as well.
29219    pub fn add_scope<St>(mut self, scope: St) -> CampaignPatchCall<'a, C>
29220    where
29221        St: AsRef<str>,
29222    {
29223        self._scopes.insert(String::from(scope.as_ref()));
29224        self
29225    }
29226    /// Identifies the authorization scope(s) for the method you are building.
29227    ///
29228    /// See [`Self::add_scope()`] for details.
29229    pub fn add_scopes<I, St>(mut self, scopes: I) -> CampaignPatchCall<'a, C>
29230    where
29231        I: IntoIterator<Item = St>,
29232        St: AsRef<str>,
29233    {
29234        self._scopes
29235            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29236        self
29237    }
29238
29239    /// Removes all scopes, and no default scope will be used either.
29240    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29241    /// for details).
29242    pub fn clear_scopes(mut self) -> CampaignPatchCall<'a, C> {
29243        self._scopes.clear();
29244        self
29245    }
29246}
29247
29248/// Updates an existing campaign.
29249///
29250/// A builder for the *update* method supported by a *campaign* resource.
29251/// It is not used directly, but through a [`CampaignMethods`] instance.
29252///
29253/// # Example
29254///
29255/// Instantiate a resource method builder
29256///
29257/// ```test_harness,no_run
29258/// # extern crate hyper;
29259/// # extern crate hyper_rustls;
29260/// # extern crate google_dfareporting3d3 as dfareporting3d3;
29261/// use dfareporting3d3::api::Campaign;
29262/// # async fn dox() {
29263/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29264///
29265/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29266/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
29267/// #     secret,
29268/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29269/// # ).build().await.unwrap();
29270///
29271/// # let client = hyper_util::client::legacy::Client::builder(
29272/// #     hyper_util::rt::TokioExecutor::new()
29273/// # )
29274/// # .build(
29275/// #     hyper_rustls::HttpsConnectorBuilder::new()
29276/// #         .with_native_roots()
29277/// #         .unwrap()
29278/// #         .https_or_http()
29279/// #         .enable_http1()
29280/// #         .build()
29281/// # );
29282/// # let mut hub = Dfareporting::new(client, auth);
29283/// // As the method needs a request, you would usually fill it with the desired information
29284/// // into the respective structure. Some of the parts shown here might not be applicable !
29285/// // Values shown here are possibly random and not representative !
29286/// let mut req = Campaign::default();
29287///
29288/// // You can configure optional parameters by calling the respective setters at will, and
29289/// // execute the final call using `doit()`.
29290/// // Values shown here are possibly random and not representative !
29291/// let result = hub.campaigns().update(req, -48)
29292///              .doit().await;
29293/// # }
29294/// ```
29295pub struct CampaignUpdateCall<'a, C>
29296where
29297    C: 'a,
29298{
29299    hub: &'a Dfareporting<C>,
29300    _request: Campaign,
29301    _profile_id: i64,
29302    _delegate: Option<&'a mut dyn common::Delegate>,
29303    _additional_params: HashMap<String, String>,
29304    _scopes: BTreeSet<String>,
29305}
29306
29307impl<'a, C> common::CallBuilder for CampaignUpdateCall<'a, C> {}
29308
29309impl<'a, C> CampaignUpdateCall<'a, C>
29310where
29311    C: common::Connector,
29312{
29313    /// Perform the operation you have build so far.
29314    pub async fn doit(mut self) -> common::Result<(common::Response, Campaign)> {
29315        use std::borrow::Cow;
29316        use std::io::{Read, Seek};
29317
29318        use common::{url::Params, ToParts};
29319        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29320
29321        let mut dd = common::DefaultDelegate;
29322        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29323        dlg.begin(common::MethodInfo {
29324            id: "dfareporting.campaigns.update",
29325            http_method: hyper::Method::PUT,
29326        });
29327
29328        for &field in ["alt", "profileId"].iter() {
29329            if self._additional_params.contains_key(field) {
29330                dlg.finished(false);
29331                return Err(common::Error::FieldClash(field));
29332            }
29333        }
29334
29335        let mut params = Params::with_capacity(4 + self._additional_params.len());
29336        params.push("profileId", self._profile_id.to_string());
29337
29338        params.extend(self._additional_params.iter());
29339
29340        params.push("alt", "json");
29341        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/campaigns";
29342        if self._scopes.is_empty() {
29343            self._scopes
29344                .insert(Scope::Dfatrafficking.as_ref().to_string());
29345        }
29346
29347        #[allow(clippy::single_element_loop)]
29348        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
29349            url = params.uri_replacement(url, param_name, find_this, false);
29350        }
29351        {
29352            let to_remove = ["profileId"];
29353            params.remove_params(&to_remove);
29354        }
29355
29356        let url = params.parse_with_url(&url);
29357
29358        let mut json_mime_type = mime::APPLICATION_JSON;
29359        let mut request_value_reader = {
29360            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
29361            common::remove_json_null_values(&mut value);
29362            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
29363            serde_json::to_writer(&mut dst, &value).unwrap();
29364            dst
29365        };
29366        let request_size = request_value_reader
29367            .seek(std::io::SeekFrom::End(0))
29368            .unwrap();
29369        request_value_reader
29370            .seek(std::io::SeekFrom::Start(0))
29371            .unwrap();
29372
29373        loop {
29374            let token = match self
29375                .hub
29376                .auth
29377                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29378                .await
29379            {
29380                Ok(token) => token,
29381                Err(e) => match dlg.token(e) {
29382                    Ok(token) => token,
29383                    Err(e) => {
29384                        dlg.finished(false);
29385                        return Err(common::Error::MissingToken(e));
29386                    }
29387                },
29388            };
29389            request_value_reader
29390                .seek(std::io::SeekFrom::Start(0))
29391                .unwrap();
29392            let mut req_result = {
29393                let client = &self.hub.client;
29394                dlg.pre_request();
29395                let mut req_builder = hyper::Request::builder()
29396                    .method(hyper::Method::PUT)
29397                    .uri(url.as_str())
29398                    .header(USER_AGENT, self.hub._user_agent.clone());
29399
29400                if let Some(token) = token.as_ref() {
29401                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29402                }
29403
29404                let request = req_builder
29405                    .header(CONTENT_TYPE, json_mime_type.to_string())
29406                    .header(CONTENT_LENGTH, request_size as u64)
29407                    .body(common::to_body(
29408                        request_value_reader.get_ref().clone().into(),
29409                    ));
29410
29411                client.request(request.unwrap()).await
29412            };
29413
29414            match req_result {
29415                Err(err) => {
29416                    if let common::Retry::After(d) = dlg.http_error(&err) {
29417                        sleep(d).await;
29418                        continue;
29419                    }
29420                    dlg.finished(false);
29421                    return Err(common::Error::HttpError(err));
29422                }
29423                Ok(res) => {
29424                    let (mut parts, body) = res.into_parts();
29425                    let mut body = common::Body::new(body);
29426                    if !parts.status.is_success() {
29427                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29428                        let error = serde_json::from_str(&common::to_string(&bytes));
29429                        let response = common::to_response(parts, bytes.into());
29430
29431                        if let common::Retry::After(d) =
29432                            dlg.http_failure(&response, error.as_ref().ok())
29433                        {
29434                            sleep(d).await;
29435                            continue;
29436                        }
29437
29438                        dlg.finished(false);
29439
29440                        return Err(match error {
29441                            Ok(value) => common::Error::BadRequest(value),
29442                            _ => common::Error::Failure(response),
29443                        });
29444                    }
29445                    let response = {
29446                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29447                        let encoded = common::to_string(&bytes);
29448                        match serde_json::from_str(&encoded) {
29449                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29450                            Err(error) => {
29451                                dlg.response_json_decode_error(&encoded, &error);
29452                                return Err(common::Error::JsonDecodeError(
29453                                    encoded.to_string(),
29454                                    error,
29455                                ));
29456                            }
29457                        }
29458                    };
29459
29460                    dlg.finished(true);
29461                    return Ok(response);
29462                }
29463            }
29464        }
29465    }
29466
29467    ///
29468    /// Sets the *request* property to the given value.
29469    ///
29470    /// Even though the property as already been set when instantiating this call,
29471    /// we provide this method for API completeness.
29472    pub fn request(mut self, new_value: Campaign) -> CampaignUpdateCall<'a, C> {
29473        self._request = new_value;
29474        self
29475    }
29476    /// User profile ID associated with this request.
29477    ///
29478    /// Sets the *profile id* path property to the given value.
29479    ///
29480    /// Even though the property as already been set when instantiating this call,
29481    /// we provide this method for API completeness.
29482    pub fn profile_id(mut self, new_value: i64) -> CampaignUpdateCall<'a, C> {
29483        self._profile_id = new_value;
29484        self
29485    }
29486    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29487    /// while executing the actual API request.
29488    ///
29489    /// ````text
29490    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
29491    /// ````
29492    ///
29493    /// Sets the *delegate* property to the given value.
29494    pub fn delegate(
29495        mut self,
29496        new_value: &'a mut dyn common::Delegate,
29497    ) -> CampaignUpdateCall<'a, C> {
29498        self._delegate = Some(new_value);
29499        self
29500    }
29501
29502    /// Set any additional parameter of the query string used in the request.
29503    /// It should be used to set parameters which are not yet available through their own
29504    /// setters.
29505    ///
29506    /// Please note that this method must not be used to set any of the known parameters
29507    /// which have their own setter method. If done anyway, the request will fail.
29508    ///
29509    /// # Additional Parameters
29510    ///
29511    /// * *$.xgafv* (query-string) - V1 error format.
29512    /// * *access_token* (query-string) - OAuth access token.
29513    /// * *alt* (query-string) - Data format for response.
29514    /// * *callback* (query-string) - JSONP
29515    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29516    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
29517    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29518    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29519    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
29520    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29521    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29522    pub fn param<T>(mut self, name: T, value: T) -> CampaignUpdateCall<'a, C>
29523    where
29524        T: AsRef<str>,
29525    {
29526        self._additional_params
29527            .insert(name.as_ref().to_string(), value.as_ref().to_string());
29528        self
29529    }
29530
29531    /// Identifies the authorization scope for the method you are building.
29532    ///
29533    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29534    /// [`Scope::Dfatrafficking`].
29535    ///
29536    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29537    /// tokens for more than one scope.
29538    ///
29539    /// Usually there is more than one suitable scope to authorize an operation, some of which may
29540    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29541    /// sufficient, a read-write scope will do as well.
29542    pub fn add_scope<St>(mut self, scope: St) -> CampaignUpdateCall<'a, C>
29543    where
29544        St: AsRef<str>,
29545    {
29546        self._scopes.insert(String::from(scope.as_ref()));
29547        self
29548    }
29549    /// Identifies the authorization scope(s) for the method you are building.
29550    ///
29551    /// See [`Self::add_scope()`] for details.
29552    pub fn add_scopes<I, St>(mut self, scopes: I) -> CampaignUpdateCall<'a, C>
29553    where
29554        I: IntoIterator<Item = St>,
29555        St: AsRef<str>,
29556    {
29557        self._scopes
29558            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29559        self
29560    }
29561
29562    /// Removes all scopes, and no default scope will be used either.
29563    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29564    /// for details).
29565    pub fn clear_scopes(mut self) -> CampaignUpdateCall<'a, C> {
29566        self._scopes.clear();
29567        self
29568    }
29569}
29570
29571/// Gets one change log by ID.
29572///
29573/// A builder for the *get* method supported by a *changeLog* resource.
29574/// It is not used directly, but through a [`ChangeLogMethods`] instance.
29575///
29576/// # Example
29577///
29578/// Instantiate a resource method builder
29579///
29580/// ```test_harness,no_run
29581/// # extern crate hyper;
29582/// # extern crate hyper_rustls;
29583/// # extern crate google_dfareporting3d3 as dfareporting3d3;
29584/// # async fn dox() {
29585/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29586///
29587/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29588/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
29589/// #     secret,
29590/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29591/// # ).build().await.unwrap();
29592///
29593/// # let client = hyper_util::client::legacy::Client::builder(
29594/// #     hyper_util::rt::TokioExecutor::new()
29595/// # )
29596/// # .build(
29597/// #     hyper_rustls::HttpsConnectorBuilder::new()
29598/// #         .with_native_roots()
29599/// #         .unwrap()
29600/// #         .https_or_http()
29601/// #         .enable_http1()
29602/// #         .build()
29603/// # );
29604/// # let mut hub = Dfareporting::new(client, auth);
29605/// // You can configure optional parameters by calling the respective setters at will, and
29606/// // execute the final call using `doit()`.
29607/// // Values shown here are possibly random and not representative !
29608/// let result = hub.change_logs().get(-81, -10)
29609///              .doit().await;
29610/// # }
29611/// ```
29612pub struct ChangeLogGetCall<'a, C>
29613where
29614    C: 'a,
29615{
29616    hub: &'a Dfareporting<C>,
29617    _profile_id: i64,
29618    _id: i64,
29619    _delegate: Option<&'a mut dyn common::Delegate>,
29620    _additional_params: HashMap<String, String>,
29621    _scopes: BTreeSet<String>,
29622}
29623
29624impl<'a, C> common::CallBuilder for ChangeLogGetCall<'a, C> {}
29625
29626impl<'a, C> ChangeLogGetCall<'a, C>
29627where
29628    C: common::Connector,
29629{
29630    /// Perform the operation you have build so far.
29631    pub async fn doit(mut self) -> common::Result<(common::Response, ChangeLog)> {
29632        use std::borrow::Cow;
29633        use std::io::{Read, Seek};
29634
29635        use common::{url::Params, ToParts};
29636        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29637
29638        let mut dd = common::DefaultDelegate;
29639        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29640        dlg.begin(common::MethodInfo {
29641            id: "dfareporting.changeLogs.get",
29642            http_method: hyper::Method::GET,
29643        });
29644
29645        for &field in ["alt", "profileId", "id"].iter() {
29646            if self._additional_params.contains_key(field) {
29647                dlg.finished(false);
29648                return Err(common::Error::FieldClash(field));
29649            }
29650        }
29651
29652        let mut params = Params::with_capacity(4 + self._additional_params.len());
29653        params.push("profileId", self._profile_id.to_string());
29654        params.push("id", self._id.to_string());
29655
29656        params.extend(self._additional_params.iter());
29657
29658        params.push("alt", "json");
29659        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/changeLogs/{id}";
29660        if self._scopes.is_empty() {
29661            self._scopes
29662                .insert(Scope::Dfatrafficking.as_ref().to_string());
29663        }
29664
29665        #[allow(clippy::single_element_loop)]
29666        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
29667            url = params.uri_replacement(url, param_name, find_this, false);
29668        }
29669        {
29670            let to_remove = ["id", "profileId"];
29671            params.remove_params(&to_remove);
29672        }
29673
29674        let url = params.parse_with_url(&url);
29675
29676        loop {
29677            let token = match self
29678                .hub
29679                .auth
29680                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29681                .await
29682            {
29683                Ok(token) => token,
29684                Err(e) => match dlg.token(e) {
29685                    Ok(token) => token,
29686                    Err(e) => {
29687                        dlg.finished(false);
29688                        return Err(common::Error::MissingToken(e));
29689                    }
29690                },
29691            };
29692            let mut req_result = {
29693                let client = &self.hub.client;
29694                dlg.pre_request();
29695                let mut req_builder = hyper::Request::builder()
29696                    .method(hyper::Method::GET)
29697                    .uri(url.as_str())
29698                    .header(USER_AGENT, self.hub._user_agent.clone());
29699
29700                if let Some(token) = token.as_ref() {
29701                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29702                }
29703
29704                let request = req_builder
29705                    .header(CONTENT_LENGTH, 0_u64)
29706                    .body(common::to_body::<String>(None));
29707
29708                client.request(request.unwrap()).await
29709            };
29710
29711            match req_result {
29712                Err(err) => {
29713                    if let common::Retry::After(d) = dlg.http_error(&err) {
29714                        sleep(d).await;
29715                        continue;
29716                    }
29717                    dlg.finished(false);
29718                    return Err(common::Error::HttpError(err));
29719                }
29720                Ok(res) => {
29721                    let (mut parts, body) = res.into_parts();
29722                    let mut body = common::Body::new(body);
29723                    if !parts.status.is_success() {
29724                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29725                        let error = serde_json::from_str(&common::to_string(&bytes));
29726                        let response = common::to_response(parts, bytes.into());
29727
29728                        if let common::Retry::After(d) =
29729                            dlg.http_failure(&response, error.as_ref().ok())
29730                        {
29731                            sleep(d).await;
29732                            continue;
29733                        }
29734
29735                        dlg.finished(false);
29736
29737                        return Err(match error {
29738                            Ok(value) => common::Error::BadRequest(value),
29739                            _ => common::Error::Failure(response),
29740                        });
29741                    }
29742                    let response = {
29743                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29744                        let encoded = common::to_string(&bytes);
29745                        match serde_json::from_str(&encoded) {
29746                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29747                            Err(error) => {
29748                                dlg.response_json_decode_error(&encoded, &error);
29749                                return Err(common::Error::JsonDecodeError(
29750                                    encoded.to_string(),
29751                                    error,
29752                                ));
29753                            }
29754                        }
29755                    };
29756
29757                    dlg.finished(true);
29758                    return Ok(response);
29759                }
29760            }
29761        }
29762    }
29763
29764    /// User profile ID associated with this request.
29765    ///
29766    /// Sets the *profile id* path property to the given value.
29767    ///
29768    /// Even though the property as already been set when instantiating this call,
29769    /// we provide this method for API completeness.
29770    pub fn profile_id(mut self, new_value: i64) -> ChangeLogGetCall<'a, C> {
29771        self._profile_id = new_value;
29772        self
29773    }
29774    /// Change log ID.
29775    ///
29776    /// Sets the *id* path property to the given value.
29777    ///
29778    /// Even though the property as already been set when instantiating this call,
29779    /// we provide this method for API completeness.
29780    pub fn id(mut self, new_value: i64) -> ChangeLogGetCall<'a, C> {
29781        self._id = new_value;
29782        self
29783    }
29784    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29785    /// while executing the actual API request.
29786    ///
29787    /// ````text
29788    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
29789    /// ````
29790    ///
29791    /// Sets the *delegate* property to the given value.
29792    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ChangeLogGetCall<'a, C> {
29793        self._delegate = Some(new_value);
29794        self
29795    }
29796
29797    /// Set any additional parameter of the query string used in the request.
29798    /// It should be used to set parameters which are not yet available through their own
29799    /// setters.
29800    ///
29801    /// Please note that this method must not be used to set any of the known parameters
29802    /// which have their own setter method. If done anyway, the request will fail.
29803    ///
29804    /// # Additional Parameters
29805    ///
29806    /// * *$.xgafv* (query-string) - V1 error format.
29807    /// * *access_token* (query-string) - OAuth access token.
29808    /// * *alt* (query-string) - Data format for response.
29809    /// * *callback* (query-string) - JSONP
29810    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29811    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
29812    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29813    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29814    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
29815    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29816    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29817    pub fn param<T>(mut self, name: T, value: T) -> ChangeLogGetCall<'a, C>
29818    where
29819        T: AsRef<str>,
29820    {
29821        self._additional_params
29822            .insert(name.as_ref().to_string(), value.as_ref().to_string());
29823        self
29824    }
29825
29826    /// Identifies the authorization scope for the method you are building.
29827    ///
29828    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29829    /// [`Scope::Dfatrafficking`].
29830    ///
29831    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29832    /// tokens for more than one scope.
29833    ///
29834    /// Usually there is more than one suitable scope to authorize an operation, some of which may
29835    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29836    /// sufficient, a read-write scope will do as well.
29837    pub fn add_scope<St>(mut self, scope: St) -> ChangeLogGetCall<'a, C>
29838    where
29839        St: AsRef<str>,
29840    {
29841        self._scopes.insert(String::from(scope.as_ref()));
29842        self
29843    }
29844    /// Identifies the authorization scope(s) for the method you are building.
29845    ///
29846    /// See [`Self::add_scope()`] for details.
29847    pub fn add_scopes<I, St>(mut self, scopes: I) -> ChangeLogGetCall<'a, C>
29848    where
29849        I: IntoIterator<Item = St>,
29850        St: AsRef<str>,
29851    {
29852        self._scopes
29853            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29854        self
29855    }
29856
29857    /// Removes all scopes, and no default scope will be used either.
29858    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29859    /// for details).
29860    pub fn clear_scopes(mut self) -> ChangeLogGetCall<'a, C> {
29861        self._scopes.clear();
29862        self
29863    }
29864}
29865
29866/// Retrieves a list of change logs. This method supports paging.
29867///
29868/// A builder for the *list* method supported by a *changeLog* resource.
29869/// It is not used directly, but through a [`ChangeLogMethods`] instance.
29870///
29871/// # Example
29872///
29873/// Instantiate a resource method builder
29874///
29875/// ```test_harness,no_run
29876/// # extern crate hyper;
29877/// # extern crate hyper_rustls;
29878/// # extern crate google_dfareporting3d3 as dfareporting3d3;
29879/// # async fn dox() {
29880/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29881///
29882/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29883/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
29884/// #     secret,
29885/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29886/// # ).build().await.unwrap();
29887///
29888/// # let client = hyper_util::client::legacy::Client::builder(
29889/// #     hyper_util::rt::TokioExecutor::new()
29890/// # )
29891/// # .build(
29892/// #     hyper_rustls::HttpsConnectorBuilder::new()
29893/// #         .with_native_roots()
29894/// #         .unwrap()
29895/// #         .https_or_http()
29896/// #         .enable_http1()
29897/// #         .build()
29898/// # );
29899/// # let mut hub = Dfareporting::new(client, auth);
29900/// // You can configure optional parameters by calling the respective setters at will, and
29901/// // execute the final call using `doit()`.
29902/// // Values shown here are possibly random and not representative !
29903/// let result = hub.change_logs().list(-41)
29904///              .add_user_profile_ids(-22)
29905///              .search_string("gubergren")
29906///              .page_token("justo")
29907///              .object_type("sea")
29908///              .add_object_ids(-96)
29909///              .min_change_time("sit")
29910///              .max_results(-32)
29911///              .max_change_time("eos")
29912///              .add_ids(-77)
29913///              .action("dolores")
29914///              .doit().await;
29915/// # }
29916/// ```
29917pub struct ChangeLogListCall<'a, C>
29918where
29919    C: 'a,
29920{
29921    hub: &'a Dfareporting<C>,
29922    _profile_id: i64,
29923    _user_profile_ids: Vec<i64>,
29924    _search_string: Option<String>,
29925    _page_token: Option<String>,
29926    _object_type: Option<String>,
29927    _object_ids: Vec<i64>,
29928    _min_change_time: Option<String>,
29929    _max_results: Option<i32>,
29930    _max_change_time: Option<String>,
29931    _ids: Vec<i64>,
29932    _action: Option<String>,
29933    _delegate: Option<&'a mut dyn common::Delegate>,
29934    _additional_params: HashMap<String, String>,
29935    _scopes: BTreeSet<String>,
29936}
29937
29938impl<'a, C> common::CallBuilder for ChangeLogListCall<'a, C> {}
29939
29940impl<'a, C> ChangeLogListCall<'a, C>
29941where
29942    C: common::Connector,
29943{
29944    /// Perform the operation you have build so far.
29945    pub async fn doit(mut self) -> common::Result<(common::Response, ChangeLogsListResponse)> {
29946        use std::borrow::Cow;
29947        use std::io::{Read, Seek};
29948
29949        use common::{url::Params, ToParts};
29950        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29951
29952        let mut dd = common::DefaultDelegate;
29953        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29954        dlg.begin(common::MethodInfo {
29955            id: "dfareporting.changeLogs.list",
29956            http_method: hyper::Method::GET,
29957        });
29958
29959        for &field in [
29960            "alt",
29961            "profileId",
29962            "userProfileIds",
29963            "searchString",
29964            "pageToken",
29965            "objectType",
29966            "objectIds",
29967            "minChangeTime",
29968            "maxResults",
29969            "maxChangeTime",
29970            "ids",
29971            "action",
29972        ]
29973        .iter()
29974        {
29975            if self._additional_params.contains_key(field) {
29976                dlg.finished(false);
29977                return Err(common::Error::FieldClash(field));
29978            }
29979        }
29980
29981        let mut params = Params::with_capacity(13 + self._additional_params.len());
29982        params.push("profileId", self._profile_id.to_string());
29983        if !self._user_profile_ids.is_empty() {
29984            for f in self._user_profile_ids.iter() {
29985                params.push("userProfileIds", f.to_string());
29986            }
29987        }
29988        if let Some(value) = self._search_string.as_ref() {
29989            params.push("searchString", value);
29990        }
29991        if let Some(value) = self._page_token.as_ref() {
29992            params.push("pageToken", value);
29993        }
29994        if let Some(value) = self._object_type.as_ref() {
29995            params.push("objectType", value);
29996        }
29997        if !self._object_ids.is_empty() {
29998            for f in self._object_ids.iter() {
29999                params.push("objectIds", f.to_string());
30000            }
30001        }
30002        if let Some(value) = self._min_change_time.as_ref() {
30003            params.push("minChangeTime", value);
30004        }
30005        if let Some(value) = self._max_results.as_ref() {
30006            params.push("maxResults", value.to_string());
30007        }
30008        if let Some(value) = self._max_change_time.as_ref() {
30009            params.push("maxChangeTime", value);
30010        }
30011        if !self._ids.is_empty() {
30012            for f in self._ids.iter() {
30013                params.push("ids", f.to_string());
30014            }
30015        }
30016        if let Some(value) = self._action.as_ref() {
30017            params.push("action", value);
30018        }
30019
30020        params.extend(self._additional_params.iter());
30021
30022        params.push("alt", "json");
30023        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/changeLogs";
30024        if self._scopes.is_empty() {
30025            self._scopes
30026                .insert(Scope::Dfatrafficking.as_ref().to_string());
30027        }
30028
30029        #[allow(clippy::single_element_loop)]
30030        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
30031            url = params.uri_replacement(url, param_name, find_this, false);
30032        }
30033        {
30034            let to_remove = ["profileId"];
30035            params.remove_params(&to_remove);
30036        }
30037
30038        let url = params.parse_with_url(&url);
30039
30040        loop {
30041            let token = match self
30042                .hub
30043                .auth
30044                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30045                .await
30046            {
30047                Ok(token) => token,
30048                Err(e) => match dlg.token(e) {
30049                    Ok(token) => token,
30050                    Err(e) => {
30051                        dlg.finished(false);
30052                        return Err(common::Error::MissingToken(e));
30053                    }
30054                },
30055            };
30056            let mut req_result = {
30057                let client = &self.hub.client;
30058                dlg.pre_request();
30059                let mut req_builder = hyper::Request::builder()
30060                    .method(hyper::Method::GET)
30061                    .uri(url.as_str())
30062                    .header(USER_AGENT, self.hub._user_agent.clone());
30063
30064                if let Some(token) = token.as_ref() {
30065                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30066                }
30067
30068                let request = req_builder
30069                    .header(CONTENT_LENGTH, 0_u64)
30070                    .body(common::to_body::<String>(None));
30071
30072                client.request(request.unwrap()).await
30073            };
30074
30075            match req_result {
30076                Err(err) => {
30077                    if let common::Retry::After(d) = dlg.http_error(&err) {
30078                        sleep(d).await;
30079                        continue;
30080                    }
30081                    dlg.finished(false);
30082                    return Err(common::Error::HttpError(err));
30083                }
30084                Ok(res) => {
30085                    let (mut parts, body) = res.into_parts();
30086                    let mut body = common::Body::new(body);
30087                    if !parts.status.is_success() {
30088                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30089                        let error = serde_json::from_str(&common::to_string(&bytes));
30090                        let response = common::to_response(parts, bytes.into());
30091
30092                        if let common::Retry::After(d) =
30093                            dlg.http_failure(&response, error.as_ref().ok())
30094                        {
30095                            sleep(d).await;
30096                            continue;
30097                        }
30098
30099                        dlg.finished(false);
30100
30101                        return Err(match error {
30102                            Ok(value) => common::Error::BadRequest(value),
30103                            _ => common::Error::Failure(response),
30104                        });
30105                    }
30106                    let response = {
30107                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30108                        let encoded = common::to_string(&bytes);
30109                        match serde_json::from_str(&encoded) {
30110                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30111                            Err(error) => {
30112                                dlg.response_json_decode_error(&encoded, &error);
30113                                return Err(common::Error::JsonDecodeError(
30114                                    encoded.to_string(),
30115                                    error,
30116                                ));
30117                            }
30118                        }
30119                    };
30120
30121                    dlg.finished(true);
30122                    return Ok(response);
30123                }
30124            }
30125        }
30126    }
30127
30128    /// User profile ID associated with this request.
30129    ///
30130    /// Sets the *profile id* path property to the given value.
30131    ///
30132    /// Even though the property as already been set when instantiating this call,
30133    /// we provide this method for API completeness.
30134    pub fn profile_id(mut self, new_value: i64) -> ChangeLogListCall<'a, C> {
30135        self._profile_id = new_value;
30136        self
30137    }
30138    /// Select only change logs with these user profile IDs.
30139    ///
30140    /// Append the given value to the *user profile ids* query property.
30141    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
30142    pub fn add_user_profile_ids(mut self, new_value: i64) -> ChangeLogListCall<'a, C> {
30143        self._user_profile_ids.push(new_value);
30144        self
30145    }
30146    /// Select only change logs whose object ID, user name, old or new values match the search string.
30147    ///
30148    /// Sets the *search string* query property to the given value.
30149    pub fn search_string(mut self, new_value: &str) -> ChangeLogListCall<'a, C> {
30150        self._search_string = Some(new_value.to_string());
30151        self
30152    }
30153    /// Value of the nextPageToken from the previous result page.
30154    ///
30155    /// Sets the *page token* query property to the given value.
30156    pub fn page_token(mut self, new_value: &str) -> ChangeLogListCall<'a, C> {
30157        self._page_token = Some(new_value.to_string());
30158        self
30159    }
30160    /// Select only change logs with the specified object type.
30161    ///
30162    /// Sets the *object type* query property to the given value.
30163    pub fn object_type(mut self, new_value: &str) -> ChangeLogListCall<'a, C> {
30164        self._object_type = Some(new_value.to_string());
30165        self
30166    }
30167    /// Select only change logs with these object IDs.
30168    ///
30169    /// Append the given value to the *object ids* query property.
30170    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
30171    pub fn add_object_ids(mut self, new_value: i64) -> ChangeLogListCall<'a, C> {
30172        self._object_ids.push(new_value);
30173        self
30174    }
30175    /// Select only change logs whose change time is after the specified minChangeTime.The time should be formatted as an RFC3339 date/time string. For example, for 10:54 PM on July 18th, 2015, in the America/New York time zone, the format is "2015-07-18T22:54:00-04:00". In other words, the year, month, day, the letter T, the hour (24-hour clock system), minute, second, and then the time zone offset.
30176    ///
30177    /// Sets the *min change time* query property to the given value.
30178    pub fn min_change_time(mut self, new_value: &str) -> ChangeLogListCall<'a, C> {
30179        self._min_change_time = Some(new_value.to_string());
30180        self
30181    }
30182    /// Maximum number of results to return.
30183    ///
30184    /// Sets the *max results* query property to the given value.
30185    pub fn max_results(mut self, new_value: i32) -> ChangeLogListCall<'a, C> {
30186        self._max_results = Some(new_value);
30187        self
30188    }
30189    /// Select only change logs whose change time is before the specified maxChangeTime.The time should be formatted as an RFC3339 date/time string. For example, for 10:54 PM on July 18th, 2015, in the America/New York time zone, the format is "2015-07-18T22:54:00-04:00". In other words, the year, month, day, the letter T, the hour (24-hour clock system), minute, second, and then the time zone offset.
30190    ///
30191    /// Sets the *max change time* query property to the given value.
30192    pub fn max_change_time(mut self, new_value: &str) -> ChangeLogListCall<'a, C> {
30193        self._max_change_time = Some(new_value.to_string());
30194        self
30195    }
30196    /// Select only change logs with these IDs.
30197    ///
30198    /// Append the given value to the *ids* query property.
30199    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
30200    pub fn add_ids(mut self, new_value: i64) -> ChangeLogListCall<'a, C> {
30201        self._ids.push(new_value);
30202        self
30203    }
30204    /// Select only change logs with the specified action.
30205    ///
30206    /// Sets the *action* query property to the given value.
30207    pub fn action(mut self, new_value: &str) -> ChangeLogListCall<'a, C> {
30208        self._action = Some(new_value.to_string());
30209        self
30210    }
30211    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30212    /// while executing the actual API request.
30213    ///
30214    /// ````text
30215    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
30216    /// ````
30217    ///
30218    /// Sets the *delegate* property to the given value.
30219    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ChangeLogListCall<'a, C> {
30220        self._delegate = Some(new_value);
30221        self
30222    }
30223
30224    /// Set any additional parameter of the query string used in the request.
30225    /// It should be used to set parameters which are not yet available through their own
30226    /// setters.
30227    ///
30228    /// Please note that this method must not be used to set any of the known parameters
30229    /// which have their own setter method. If done anyway, the request will fail.
30230    ///
30231    /// # Additional Parameters
30232    ///
30233    /// * *$.xgafv* (query-string) - V1 error format.
30234    /// * *access_token* (query-string) - OAuth access token.
30235    /// * *alt* (query-string) - Data format for response.
30236    /// * *callback* (query-string) - JSONP
30237    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30238    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
30239    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30240    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30241    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
30242    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30243    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30244    pub fn param<T>(mut self, name: T, value: T) -> ChangeLogListCall<'a, C>
30245    where
30246        T: AsRef<str>,
30247    {
30248        self._additional_params
30249            .insert(name.as_ref().to_string(), value.as_ref().to_string());
30250        self
30251    }
30252
30253    /// Identifies the authorization scope for the method you are building.
30254    ///
30255    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30256    /// [`Scope::Dfatrafficking`].
30257    ///
30258    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30259    /// tokens for more than one scope.
30260    ///
30261    /// Usually there is more than one suitable scope to authorize an operation, some of which may
30262    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30263    /// sufficient, a read-write scope will do as well.
30264    pub fn add_scope<St>(mut self, scope: St) -> ChangeLogListCall<'a, C>
30265    where
30266        St: AsRef<str>,
30267    {
30268        self._scopes.insert(String::from(scope.as_ref()));
30269        self
30270    }
30271    /// Identifies the authorization scope(s) for the method you are building.
30272    ///
30273    /// See [`Self::add_scope()`] for details.
30274    pub fn add_scopes<I, St>(mut self, scopes: I) -> ChangeLogListCall<'a, C>
30275    where
30276        I: IntoIterator<Item = St>,
30277        St: AsRef<str>,
30278    {
30279        self._scopes
30280            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30281        self
30282    }
30283
30284    /// Removes all scopes, and no default scope will be used either.
30285    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30286    /// for details).
30287    pub fn clear_scopes(mut self) -> ChangeLogListCall<'a, C> {
30288        self._scopes.clear();
30289        self
30290    }
30291}
30292
30293/// Retrieves a list of cities, possibly filtered.
30294///
30295/// A builder for the *list* method supported by a *city* resource.
30296/// It is not used directly, but through a [`CityMethods`] instance.
30297///
30298/// # Example
30299///
30300/// Instantiate a resource method builder
30301///
30302/// ```test_harness,no_run
30303/// # extern crate hyper;
30304/// # extern crate hyper_rustls;
30305/// # extern crate google_dfareporting3d3 as dfareporting3d3;
30306/// # async fn dox() {
30307/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30308///
30309/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30310/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
30311/// #     secret,
30312/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30313/// # ).build().await.unwrap();
30314///
30315/// # let client = hyper_util::client::legacy::Client::builder(
30316/// #     hyper_util::rt::TokioExecutor::new()
30317/// # )
30318/// # .build(
30319/// #     hyper_rustls::HttpsConnectorBuilder::new()
30320/// #         .with_native_roots()
30321/// #         .unwrap()
30322/// #         .https_or_http()
30323/// #         .enable_http1()
30324/// #         .build()
30325/// # );
30326/// # let mut hub = Dfareporting::new(client, auth);
30327/// // You can configure optional parameters by calling the respective setters at will, and
30328/// // execute the final call using `doit()`.
30329/// // Values shown here are possibly random and not representative !
30330/// let result = hub.cities().list(-46)
30331///              .add_region_dart_ids(-62)
30332///              .name_prefix("dolor")
30333///              .add_dart_ids(-32)
30334///              .add_country_dart_ids(-61)
30335///              .doit().await;
30336/// # }
30337/// ```
30338pub struct CityListCall<'a, C>
30339where
30340    C: 'a,
30341{
30342    hub: &'a Dfareporting<C>,
30343    _profile_id: i64,
30344    _region_dart_ids: Vec<i64>,
30345    _name_prefix: Option<String>,
30346    _dart_ids: Vec<i64>,
30347    _country_dart_ids: Vec<i64>,
30348    _delegate: Option<&'a mut dyn common::Delegate>,
30349    _additional_params: HashMap<String, String>,
30350    _scopes: BTreeSet<String>,
30351}
30352
30353impl<'a, C> common::CallBuilder for CityListCall<'a, C> {}
30354
30355impl<'a, C> CityListCall<'a, C>
30356where
30357    C: common::Connector,
30358{
30359    /// Perform the operation you have build so far.
30360    pub async fn doit(mut self) -> common::Result<(common::Response, CitiesListResponse)> {
30361        use std::borrow::Cow;
30362        use std::io::{Read, Seek};
30363
30364        use common::{url::Params, ToParts};
30365        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30366
30367        let mut dd = common::DefaultDelegate;
30368        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30369        dlg.begin(common::MethodInfo {
30370            id: "dfareporting.cities.list",
30371            http_method: hyper::Method::GET,
30372        });
30373
30374        for &field in [
30375            "alt",
30376            "profileId",
30377            "regionDartIds",
30378            "namePrefix",
30379            "dartIds",
30380            "countryDartIds",
30381        ]
30382        .iter()
30383        {
30384            if self._additional_params.contains_key(field) {
30385                dlg.finished(false);
30386                return Err(common::Error::FieldClash(field));
30387            }
30388        }
30389
30390        let mut params = Params::with_capacity(7 + self._additional_params.len());
30391        params.push("profileId", self._profile_id.to_string());
30392        if !self._region_dart_ids.is_empty() {
30393            for f in self._region_dart_ids.iter() {
30394                params.push("regionDartIds", f.to_string());
30395            }
30396        }
30397        if let Some(value) = self._name_prefix.as_ref() {
30398            params.push("namePrefix", value);
30399        }
30400        if !self._dart_ids.is_empty() {
30401            for f in self._dart_ids.iter() {
30402                params.push("dartIds", f.to_string());
30403            }
30404        }
30405        if !self._country_dart_ids.is_empty() {
30406            for f in self._country_dart_ids.iter() {
30407                params.push("countryDartIds", f.to_string());
30408            }
30409        }
30410
30411        params.extend(self._additional_params.iter());
30412
30413        params.push("alt", "json");
30414        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/cities";
30415        if self._scopes.is_empty() {
30416            self._scopes
30417                .insert(Scope::Dfatrafficking.as_ref().to_string());
30418        }
30419
30420        #[allow(clippy::single_element_loop)]
30421        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
30422            url = params.uri_replacement(url, param_name, find_this, false);
30423        }
30424        {
30425            let to_remove = ["profileId"];
30426            params.remove_params(&to_remove);
30427        }
30428
30429        let url = params.parse_with_url(&url);
30430
30431        loop {
30432            let token = match self
30433                .hub
30434                .auth
30435                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30436                .await
30437            {
30438                Ok(token) => token,
30439                Err(e) => match dlg.token(e) {
30440                    Ok(token) => token,
30441                    Err(e) => {
30442                        dlg.finished(false);
30443                        return Err(common::Error::MissingToken(e));
30444                    }
30445                },
30446            };
30447            let mut req_result = {
30448                let client = &self.hub.client;
30449                dlg.pre_request();
30450                let mut req_builder = hyper::Request::builder()
30451                    .method(hyper::Method::GET)
30452                    .uri(url.as_str())
30453                    .header(USER_AGENT, self.hub._user_agent.clone());
30454
30455                if let Some(token) = token.as_ref() {
30456                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30457                }
30458
30459                let request = req_builder
30460                    .header(CONTENT_LENGTH, 0_u64)
30461                    .body(common::to_body::<String>(None));
30462
30463                client.request(request.unwrap()).await
30464            };
30465
30466            match req_result {
30467                Err(err) => {
30468                    if let common::Retry::After(d) = dlg.http_error(&err) {
30469                        sleep(d).await;
30470                        continue;
30471                    }
30472                    dlg.finished(false);
30473                    return Err(common::Error::HttpError(err));
30474                }
30475                Ok(res) => {
30476                    let (mut parts, body) = res.into_parts();
30477                    let mut body = common::Body::new(body);
30478                    if !parts.status.is_success() {
30479                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30480                        let error = serde_json::from_str(&common::to_string(&bytes));
30481                        let response = common::to_response(parts, bytes.into());
30482
30483                        if let common::Retry::After(d) =
30484                            dlg.http_failure(&response, error.as_ref().ok())
30485                        {
30486                            sleep(d).await;
30487                            continue;
30488                        }
30489
30490                        dlg.finished(false);
30491
30492                        return Err(match error {
30493                            Ok(value) => common::Error::BadRequest(value),
30494                            _ => common::Error::Failure(response),
30495                        });
30496                    }
30497                    let response = {
30498                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30499                        let encoded = common::to_string(&bytes);
30500                        match serde_json::from_str(&encoded) {
30501                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30502                            Err(error) => {
30503                                dlg.response_json_decode_error(&encoded, &error);
30504                                return Err(common::Error::JsonDecodeError(
30505                                    encoded.to_string(),
30506                                    error,
30507                                ));
30508                            }
30509                        }
30510                    };
30511
30512                    dlg.finished(true);
30513                    return Ok(response);
30514                }
30515            }
30516        }
30517    }
30518
30519    /// User profile ID associated with this request.
30520    ///
30521    /// Sets the *profile id* path property to the given value.
30522    ///
30523    /// Even though the property as already been set when instantiating this call,
30524    /// we provide this method for API completeness.
30525    pub fn profile_id(mut self, new_value: i64) -> CityListCall<'a, C> {
30526        self._profile_id = new_value;
30527        self
30528    }
30529    /// Select only cities from these regions.
30530    ///
30531    /// Append the given value to the *region dart ids* query property.
30532    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
30533    pub fn add_region_dart_ids(mut self, new_value: i64) -> CityListCall<'a, C> {
30534        self._region_dart_ids.push(new_value);
30535        self
30536    }
30537    /// Select only cities with names starting with this prefix.
30538    ///
30539    /// Sets the *name prefix* query property to the given value.
30540    pub fn name_prefix(mut self, new_value: &str) -> CityListCall<'a, C> {
30541        self._name_prefix = Some(new_value.to_string());
30542        self
30543    }
30544    /// Select only cities with these DART IDs.
30545    ///
30546    /// Append the given value to the *dart ids* query property.
30547    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
30548    pub fn add_dart_ids(mut self, new_value: i64) -> CityListCall<'a, C> {
30549        self._dart_ids.push(new_value);
30550        self
30551    }
30552    /// Select only cities from these countries.
30553    ///
30554    /// Append the given value to the *country dart ids* query property.
30555    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
30556    pub fn add_country_dart_ids(mut self, new_value: i64) -> CityListCall<'a, C> {
30557        self._country_dart_ids.push(new_value);
30558        self
30559    }
30560    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30561    /// while executing the actual API request.
30562    ///
30563    /// ````text
30564    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
30565    /// ````
30566    ///
30567    /// Sets the *delegate* property to the given value.
30568    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> CityListCall<'a, C> {
30569        self._delegate = Some(new_value);
30570        self
30571    }
30572
30573    /// Set any additional parameter of the query string used in the request.
30574    /// It should be used to set parameters which are not yet available through their own
30575    /// setters.
30576    ///
30577    /// Please note that this method must not be used to set any of the known parameters
30578    /// which have their own setter method. If done anyway, the request will fail.
30579    ///
30580    /// # Additional Parameters
30581    ///
30582    /// * *$.xgafv* (query-string) - V1 error format.
30583    /// * *access_token* (query-string) - OAuth access token.
30584    /// * *alt* (query-string) - Data format for response.
30585    /// * *callback* (query-string) - JSONP
30586    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30587    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
30588    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30589    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30590    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
30591    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30592    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30593    pub fn param<T>(mut self, name: T, value: T) -> CityListCall<'a, C>
30594    where
30595        T: AsRef<str>,
30596    {
30597        self._additional_params
30598            .insert(name.as_ref().to_string(), value.as_ref().to_string());
30599        self
30600    }
30601
30602    /// Identifies the authorization scope for the method you are building.
30603    ///
30604    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30605    /// [`Scope::Dfatrafficking`].
30606    ///
30607    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30608    /// tokens for more than one scope.
30609    ///
30610    /// Usually there is more than one suitable scope to authorize an operation, some of which may
30611    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30612    /// sufficient, a read-write scope will do as well.
30613    pub fn add_scope<St>(mut self, scope: St) -> CityListCall<'a, C>
30614    where
30615        St: AsRef<str>,
30616    {
30617        self._scopes.insert(String::from(scope.as_ref()));
30618        self
30619    }
30620    /// Identifies the authorization scope(s) for the method you are building.
30621    ///
30622    /// See [`Self::add_scope()`] for details.
30623    pub fn add_scopes<I, St>(mut self, scopes: I) -> CityListCall<'a, C>
30624    where
30625        I: IntoIterator<Item = St>,
30626        St: AsRef<str>,
30627    {
30628        self._scopes
30629            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30630        self
30631    }
30632
30633    /// Removes all scopes, and no default scope will be used either.
30634    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30635    /// for details).
30636    pub fn clear_scopes(mut self) -> CityListCall<'a, C> {
30637        self._scopes.clear();
30638        self
30639    }
30640}
30641
30642/// Gets one connection type by ID.
30643///
30644/// A builder for the *get* method supported by a *connectionType* resource.
30645/// It is not used directly, but through a [`ConnectionTypeMethods`] instance.
30646///
30647/// # Example
30648///
30649/// Instantiate a resource method builder
30650///
30651/// ```test_harness,no_run
30652/// # extern crate hyper;
30653/// # extern crate hyper_rustls;
30654/// # extern crate google_dfareporting3d3 as dfareporting3d3;
30655/// # async fn dox() {
30656/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30657///
30658/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30659/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
30660/// #     secret,
30661/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30662/// # ).build().await.unwrap();
30663///
30664/// # let client = hyper_util::client::legacy::Client::builder(
30665/// #     hyper_util::rt::TokioExecutor::new()
30666/// # )
30667/// # .build(
30668/// #     hyper_rustls::HttpsConnectorBuilder::new()
30669/// #         .with_native_roots()
30670/// #         .unwrap()
30671/// #         .https_or_http()
30672/// #         .enable_http1()
30673/// #         .build()
30674/// # );
30675/// # let mut hub = Dfareporting::new(client, auth);
30676/// // You can configure optional parameters by calling the respective setters at will, and
30677/// // execute the final call using `doit()`.
30678/// // Values shown here are possibly random and not representative !
30679/// let result = hub.connection_types().get(-2, -50)
30680///              .doit().await;
30681/// # }
30682/// ```
30683pub struct ConnectionTypeGetCall<'a, C>
30684where
30685    C: 'a,
30686{
30687    hub: &'a Dfareporting<C>,
30688    _profile_id: i64,
30689    _id: i64,
30690    _delegate: Option<&'a mut dyn common::Delegate>,
30691    _additional_params: HashMap<String, String>,
30692    _scopes: BTreeSet<String>,
30693}
30694
30695impl<'a, C> common::CallBuilder for ConnectionTypeGetCall<'a, C> {}
30696
30697impl<'a, C> ConnectionTypeGetCall<'a, C>
30698where
30699    C: common::Connector,
30700{
30701    /// Perform the operation you have build so far.
30702    pub async fn doit(mut self) -> common::Result<(common::Response, ConnectionType)> {
30703        use std::borrow::Cow;
30704        use std::io::{Read, Seek};
30705
30706        use common::{url::Params, ToParts};
30707        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30708
30709        let mut dd = common::DefaultDelegate;
30710        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30711        dlg.begin(common::MethodInfo {
30712            id: "dfareporting.connectionTypes.get",
30713            http_method: hyper::Method::GET,
30714        });
30715
30716        for &field in ["alt", "profileId", "id"].iter() {
30717            if self._additional_params.contains_key(field) {
30718                dlg.finished(false);
30719                return Err(common::Error::FieldClash(field));
30720            }
30721        }
30722
30723        let mut params = Params::with_capacity(4 + self._additional_params.len());
30724        params.push("profileId", self._profile_id.to_string());
30725        params.push("id", self._id.to_string());
30726
30727        params.extend(self._additional_params.iter());
30728
30729        params.push("alt", "json");
30730        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/connectionTypes/{id}";
30731        if self._scopes.is_empty() {
30732            self._scopes
30733                .insert(Scope::Dfatrafficking.as_ref().to_string());
30734        }
30735
30736        #[allow(clippy::single_element_loop)]
30737        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
30738            url = params.uri_replacement(url, param_name, find_this, false);
30739        }
30740        {
30741            let to_remove = ["id", "profileId"];
30742            params.remove_params(&to_remove);
30743        }
30744
30745        let url = params.parse_with_url(&url);
30746
30747        loop {
30748            let token = match self
30749                .hub
30750                .auth
30751                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30752                .await
30753            {
30754                Ok(token) => token,
30755                Err(e) => match dlg.token(e) {
30756                    Ok(token) => token,
30757                    Err(e) => {
30758                        dlg.finished(false);
30759                        return Err(common::Error::MissingToken(e));
30760                    }
30761                },
30762            };
30763            let mut req_result = {
30764                let client = &self.hub.client;
30765                dlg.pre_request();
30766                let mut req_builder = hyper::Request::builder()
30767                    .method(hyper::Method::GET)
30768                    .uri(url.as_str())
30769                    .header(USER_AGENT, self.hub._user_agent.clone());
30770
30771                if let Some(token) = token.as_ref() {
30772                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30773                }
30774
30775                let request = req_builder
30776                    .header(CONTENT_LENGTH, 0_u64)
30777                    .body(common::to_body::<String>(None));
30778
30779                client.request(request.unwrap()).await
30780            };
30781
30782            match req_result {
30783                Err(err) => {
30784                    if let common::Retry::After(d) = dlg.http_error(&err) {
30785                        sleep(d).await;
30786                        continue;
30787                    }
30788                    dlg.finished(false);
30789                    return Err(common::Error::HttpError(err));
30790                }
30791                Ok(res) => {
30792                    let (mut parts, body) = res.into_parts();
30793                    let mut body = common::Body::new(body);
30794                    if !parts.status.is_success() {
30795                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30796                        let error = serde_json::from_str(&common::to_string(&bytes));
30797                        let response = common::to_response(parts, bytes.into());
30798
30799                        if let common::Retry::After(d) =
30800                            dlg.http_failure(&response, error.as_ref().ok())
30801                        {
30802                            sleep(d).await;
30803                            continue;
30804                        }
30805
30806                        dlg.finished(false);
30807
30808                        return Err(match error {
30809                            Ok(value) => common::Error::BadRequest(value),
30810                            _ => common::Error::Failure(response),
30811                        });
30812                    }
30813                    let response = {
30814                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30815                        let encoded = common::to_string(&bytes);
30816                        match serde_json::from_str(&encoded) {
30817                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30818                            Err(error) => {
30819                                dlg.response_json_decode_error(&encoded, &error);
30820                                return Err(common::Error::JsonDecodeError(
30821                                    encoded.to_string(),
30822                                    error,
30823                                ));
30824                            }
30825                        }
30826                    };
30827
30828                    dlg.finished(true);
30829                    return Ok(response);
30830                }
30831            }
30832        }
30833    }
30834
30835    /// User profile ID associated with this request.
30836    ///
30837    /// Sets the *profile id* path property to the given value.
30838    ///
30839    /// Even though the property as already been set when instantiating this call,
30840    /// we provide this method for API completeness.
30841    pub fn profile_id(mut self, new_value: i64) -> ConnectionTypeGetCall<'a, C> {
30842        self._profile_id = new_value;
30843        self
30844    }
30845    /// Connection type ID.
30846    ///
30847    /// Sets the *id* path property to the given value.
30848    ///
30849    /// Even though the property as already been set when instantiating this call,
30850    /// we provide this method for API completeness.
30851    pub fn id(mut self, new_value: i64) -> ConnectionTypeGetCall<'a, C> {
30852        self._id = new_value;
30853        self
30854    }
30855    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30856    /// while executing the actual API request.
30857    ///
30858    /// ````text
30859    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
30860    /// ````
30861    ///
30862    /// Sets the *delegate* property to the given value.
30863    pub fn delegate(
30864        mut self,
30865        new_value: &'a mut dyn common::Delegate,
30866    ) -> ConnectionTypeGetCall<'a, C> {
30867        self._delegate = Some(new_value);
30868        self
30869    }
30870
30871    /// Set any additional parameter of the query string used in the request.
30872    /// It should be used to set parameters which are not yet available through their own
30873    /// setters.
30874    ///
30875    /// Please note that this method must not be used to set any of the known parameters
30876    /// which have their own setter method. If done anyway, the request will fail.
30877    ///
30878    /// # Additional Parameters
30879    ///
30880    /// * *$.xgafv* (query-string) - V1 error format.
30881    /// * *access_token* (query-string) - OAuth access token.
30882    /// * *alt* (query-string) - Data format for response.
30883    /// * *callback* (query-string) - JSONP
30884    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30885    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
30886    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30887    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30888    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
30889    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30890    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30891    pub fn param<T>(mut self, name: T, value: T) -> ConnectionTypeGetCall<'a, C>
30892    where
30893        T: AsRef<str>,
30894    {
30895        self._additional_params
30896            .insert(name.as_ref().to_string(), value.as_ref().to_string());
30897        self
30898    }
30899
30900    /// Identifies the authorization scope for the method you are building.
30901    ///
30902    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30903    /// [`Scope::Dfatrafficking`].
30904    ///
30905    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30906    /// tokens for more than one scope.
30907    ///
30908    /// Usually there is more than one suitable scope to authorize an operation, some of which may
30909    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30910    /// sufficient, a read-write scope will do as well.
30911    pub fn add_scope<St>(mut self, scope: St) -> ConnectionTypeGetCall<'a, C>
30912    where
30913        St: AsRef<str>,
30914    {
30915        self._scopes.insert(String::from(scope.as_ref()));
30916        self
30917    }
30918    /// Identifies the authorization scope(s) for the method you are building.
30919    ///
30920    /// See [`Self::add_scope()`] for details.
30921    pub fn add_scopes<I, St>(mut self, scopes: I) -> ConnectionTypeGetCall<'a, C>
30922    where
30923        I: IntoIterator<Item = St>,
30924        St: AsRef<str>,
30925    {
30926        self._scopes
30927            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30928        self
30929    }
30930
30931    /// Removes all scopes, and no default scope will be used either.
30932    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30933    /// for details).
30934    pub fn clear_scopes(mut self) -> ConnectionTypeGetCall<'a, C> {
30935        self._scopes.clear();
30936        self
30937    }
30938}
30939
30940/// Retrieves a list of connection types.
30941///
30942/// A builder for the *list* method supported by a *connectionType* resource.
30943/// It is not used directly, but through a [`ConnectionTypeMethods`] instance.
30944///
30945/// # Example
30946///
30947/// Instantiate a resource method builder
30948///
30949/// ```test_harness,no_run
30950/// # extern crate hyper;
30951/// # extern crate hyper_rustls;
30952/// # extern crate google_dfareporting3d3 as dfareporting3d3;
30953/// # async fn dox() {
30954/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30955///
30956/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30957/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
30958/// #     secret,
30959/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30960/// # ).build().await.unwrap();
30961///
30962/// # let client = hyper_util::client::legacy::Client::builder(
30963/// #     hyper_util::rt::TokioExecutor::new()
30964/// # )
30965/// # .build(
30966/// #     hyper_rustls::HttpsConnectorBuilder::new()
30967/// #         .with_native_roots()
30968/// #         .unwrap()
30969/// #         .https_or_http()
30970/// #         .enable_http1()
30971/// #         .build()
30972/// # );
30973/// # let mut hub = Dfareporting::new(client, auth);
30974/// // You can configure optional parameters by calling the respective setters at will, and
30975/// // execute the final call using `doit()`.
30976/// // Values shown here are possibly random and not representative !
30977/// let result = hub.connection_types().list(-56)
30978///              .doit().await;
30979/// # }
30980/// ```
30981pub struct ConnectionTypeListCall<'a, C>
30982where
30983    C: 'a,
30984{
30985    hub: &'a Dfareporting<C>,
30986    _profile_id: i64,
30987    _delegate: Option<&'a mut dyn common::Delegate>,
30988    _additional_params: HashMap<String, String>,
30989    _scopes: BTreeSet<String>,
30990}
30991
30992impl<'a, C> common::CallBuilder for ConnectionTypeListCall<'a, C> {}
30993
30994impl<'a, C> ConnectionTypeListCall<'a, C>
30995where
30996    C: common::Connector,
30997{
30998    /// Perform the operation you have build so far.
30999    pub async fn doit(mut self) -> common::Result<(common::Response, ConnectionTypesListResponse)> {
31000        use std::borrow::Cow;
31001        use std::io::{Read, Seek};
31002
31003        use common::{url::Params, ToParts};
31004        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31005
31006        let mut dd = common::DefaultDelegate;
31007        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31008        dlg.begin(common::MethodInfo {
31009            id: "dfareporting.connectionTypes.list",
31010            http_method: hyper::Method::GET,
31011        });
31012
31013        for &field in ["alt", "profileId"].iter() {
31014            if self._additional_params.contains_key(field) {
31015                dlg.finished(false);
31016                return Err(common::Error::FieldClash(field));
31017            }
31018        }
31019
31020        let mut params = Params::with_capacity(3 + self._additional_params.len());
31021        params.push("profileId", self._profile_id.to_string());
31022
31023        params.extend(self._additional_params.iter());
31024
31025        params.push("alt", "json");
31026        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/connectionTypes";
31027        if self._scopes.is_empty() {
31028            self._scopes
31029                .insert(Scope::Dfatrafficking.as_ref().to_string());
31030        }
31031
31032        #[allow(clippy::single_element_loop)]
31033        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
31034            url = params.uri_replacement(url, param_name, find_this, false);
31035        }
31036        {
31037            let to_remove = ["profileId"];
31038            params.remove_params(&to_remove);
31039        }
31040
31041        let url = params.parse_with_url(&url);
31042
31043        loop {
31044            let token = match self
31045                .hub
31046                .auth
31047                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31048                .await
31049            {
31050                Ok(token) => token,
31051                Err(e) => match dlg.token(e) {
31052                    Ok(token) => token,
31053                    Err(e) => {
31054                        dlg.finished(false);
31055                        return Err(common::Error::MissingToken(e));
31056                    }
31057                },
31058            };
31059            let mut req_result = {
31060                let client = &self.hub.client;
31061                dlg.pre_request();
31062                let mut req_builder = hyper::Request::builder()
31063                    .method(hyper::Method::GET)
31064                    .uri(url.as_str())
31065                    .header(USER_AGENT, self.hub._user_agent.clone());
31066
31067                if let Some(token) = token.as_ref() {
31068                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31069                }
31070
31071                let request = req_builder
31072                    .header(CONTENT_LENGTH, 0_u64)
31073                    .body(common::to_body::<String>(None));
31074
31075                client.request(request.unwrap()).await
31076            };
31077
31078            match req_result {
31079                Err(err) => {
31080                    if let common::Retry::After(d) = dlg.http_error(&err) {
31081                        sleep(d).await;
31082                        continue;
31083                    }
31084                    dlg.finished(false);
31085                    return Err(common::Error::HttpError(err));
31086                }
31087                Ok(res) => {
31088                    let (mut parts, body) = res.into_parts();
31089                    let mut body = common::Body::new(body);
31090                    if !parts.status.is_success() {
31091                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31092                        let error = serde_json::from_str(&common::to_string(&bytes));
31093                        let response = common::to_response(parts, bytes.into());
31094
31095                        if let common::Retry::After(d) =
31096                            dlg.http_failure(&response, error.as_ref().ok())
31097                        {
31098                            sleep(d).await;
31099                            continue;
31100                        }
31101
31102                        dlg.finished(false);
31103
31104                        return Err(match error {
31105                            Ok(value) => common::Error::BadRequest(value),
31106                            _ => common::Error::Failure(response),
31107                        });
31108                    }
31109                    let response = {
31110                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31111                        let encoded = common::to_string(&bytes);
31112                        match serde_json::from_str(&encoded) {
31113                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
31114                            Err(error) => {
31115                                dlg.response_json_decode_error(&encoded, &error);
31116                                return Err(common::Error::JsonDecodeError(
31117                                    encoded.to_string(),
31118                                    error,
31119                                ));
31120                            }
31121                        }
31122                    };
31123
31124                    dlg.finished(true);
31125                    return Ok(response);
31126                }
31127            }
31128        }
31129    }
31130
31131    /// User profile ID associated with this request.
31132    ///
31133    /// Sets the *profile id* path property to the given value.
31134    ///
31135    /// Even though the property as already been set when instantiating this call,
31136    /// we provide this method for API completeness.
31137    pub fn profile_id(mut self, new_value: i64) -> ConnectionTypeListCall<'a, C> {
31138        self._profile_id = new_value;
31139        self
31140    }
31141    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31142    /// while executing the actual API request.
31143    ///
31144    /// ````text
31145    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
31146    /// ````
31147    ///
31148    /// Sets the *delegate* property to the given value.
31149    pub fn delegate(
31150        mut self,
31151        new_value: &'a mut dyn common::Delegate,
31152    ) -> ConnectionTypeListCall<'a, C> {
31153        self._delegate = Some(new_value);
31154        self
31155    }
31156
31157    /// Set any additional parameter of the query string used in the request.
31158    /// It should be used to set parameters which are not yet available through their own
31159    /// setters.
31160    ///
31161    /// Please note that this method must not be used to set any of the known parameters
31162    /// which have their own setter method. If done anyway, the request will fail.
31163    ///
31164    /// # Additional Parameters
31165    ///
31166    /// * *$.xgafv* (query-string) - V1 error format.
31167    /// * *access_token* (query-string) - OAuth access token.
31168    /// * *alt* (query-string) - Data format for response.
31169    /// * *callback* (query-string) - JSONP
31170    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31171    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
31172    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31173    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31174    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
31175    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31176    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31177    pub fn param<T>(mut self, name: T, value: T) -> ConnectionTypeListCall<'a, C>
31178    where
31179        T: AsRef<str>,
31180    {
31181        self._additional_params
31182            .insert(name.as_ref().to_string(), value.as_ref().to_string());
31183        self
31184    }
31185
31186    /// Identifies the authorization scope for the method you are building.
31187    ///
31188    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31189    /// [`Scope::Dfatrafficking`].
31190    ///
31191    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31192    /// tokens for more than one scope.
31193    ///
31194    /// Usually there is more than one suitable scope to authorize an operation, some of which may
31195    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31196    /// sufficient, a read-write scope will do as well.
31197    pub fn add_scope<St>(mut self, scope: St) -> ConnectionTypeListCall<'a, C>
31198    where
31199        St: AsRef<str>,
31200    {
31201        self._scopes.insert(String::from(scope.as_ref()));
31202        self
31203    }
31204    /// Identifies the authorization scope(s) for the method you are building.
31205    ///
31206    /// See [`Self::add_scope()`] for details.
31207    pub fn add_scopes<I, St>(mut self, scopes: I) -> ConnectionTypeListCall<'a, C>
31208    where
31209        I: IntoIterator<Item = St>,
31210        St: AsRef<str>,
31211    {
31212        self._scopes
31213            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31214        self
31215    }
31216
31217    /// Removes all scopes, and no default scope will be used either.
31218    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31219    /// for details).
31220    pub fn clear_scopes(mut self) -> ConnectionTypeListCall<'a, C> {
31221        self._scopes.clear();
31222        self
31223    }
31224}
31225
31226/// Deletes an existing content category.
31227///
31228/// A builder for the *delete* method supported by a *contentCategory* resource.
31229/// It is not used directly, but through a [`ContentCategoryMethods`] instance.
31230///
31231/// # Example
31232///
31233/// Instantiate a resource method builder
31234///
31235/// ```test_harness,no_run
31236/// # extern crate hyper;
31237/// # extern crate hyper_rustls;
31238/// # extern crate google_dfareporting3d3 as dfareporting3d3;
31239/// # async fn dox() {
31240/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31241///
31242/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31243/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
31244/// #     secret,
31245/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
31246/// # ).build().await.unwrap();
31247///
31248/// # let client = hyper_util::client::legacy::Client::builder(
31249/// #     hyper_util::rt::TokioExecutor::new()
31250/// # )
31251/// # .build(
31252/// #     hyper_rustls::HttpsConnectorBuilder::new()
31253/// #         .with_native_roots()
31254/// #         .unwrap()
31255/// #         .https_or_http()
31256/// #         .enable_http1()
31257/// #         .build()
31258/// # );
31259/// # let mut hub = Dfareporting::new(client, auth);
31260/// // You can configure optional parameters by calling the respective setters at will, and
31261/// // execute the final call using `doit()`.
31262/// // Values shown here are possibly random and not representative !
31263/// let result = hub.content_categories().delete(-73, -62)
31264///              .doit().await;
31265/// # }
31266/// ```
31267pub struct ContentCategoryDeleteCall<'a, C>
31268where
31269    C: 'a,
31270{
31271    hub: &'a Dfareporting<C>,
31272    _profile_id: i64,
31273    _id: i64,
31274    _delegate: Option<&'a mut dyn common::Delegate>,
31275    _additional_params: HashMap<String, String>,
31276    _scopes: BTreeSet<String>,
31277}
31278
31279impl<'a, C> common::CallBuilder for ContentCategoryDeleteCall<'a, C> {}
31280
31281impl<'a, C> ContentCategoryDeleteCall<'a, C>
31282where
31283    C: common::Connector,
31284{
31285    /// Perform the operation you have build so far.
31286    pub async fn doit(mut self) -> common::Result<common::Response> {
31287        use std::borrow::Cow;
31288        use std::io::{Read, Seek};
31289
31290        use common::{url::Params, ToParts};
31291        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31292
31293        let mut dd = common::DefaultDelegate;
31294        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31295        dlg.begin(common::MethodInfo {
31296            id: "dfareporting.contentCategories.delete",
31297            http_method: hyper::Method::DELETE,
31298        });
31299
31300        for &field in ["profileId", "id"].iter() {
31301            if self._additional_params.contains_key(field) {
31302                dlg.finished(false);
31303                return Err(common::Error::FieldClash(field));
31304            }
31305        }
31306
31307        let mut params = Params::with_capacity(3 + self._additional_params.len());
31308        params.push("profileId", self._profile_id.to_string());
31309        params.push("id", self._id.to_string());
31310
31311        params.extend(self._additional_params.iter());
31312
31313        let mut url =
31314            self.hub._base_url.clone() + "userprofiles/{profileId}/contentCategories/{id}";
31315        if self._scopes.is_empty() {
31316            self._scopes
31317                .insert(Scope::Dfatrafficking.as_ref().to_string());
31318        }
31319
31320        #[allow(clippy::single_element_loop)]
31321        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
31322            url = params.uri_replacement(url, param_name, find_this, false);
31323        }
31324        {
31325            let to_remove = ["id", "profileId"];
31326            params.remove_params(&to_remove);
31327        }
31328
31329        let url = params.parse_with_url(&url);
31330
31331        loop {
31332            let token = match self
31333                .hub
31334                .auth
31335                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31336                .await
31337            {
31338                Ok(token) => token,
31339                Err(e) => match dlg.token(e) {
31340                    Ok(token) => token,
31341                    Err(e) => {
31342                        dlg.finished(false);
31343                        return Err(common::Error::MissingToken(e));
31344                    }
31345                },
31346            };
31347            let mut req_result = {
31348                let client = &self.hub.client;
31349                dlg.pre_request();
31350                let mut req_builder = hyper::Request::builder()
31351                    .method(hyper::Method::DELETE)
31352                    .uri(url.as_str())
31353                    .header(USER_AGENT, self.hub._user_agent.clone());
31354
31355                if let Some(token) = token.as_ref() {
31356                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31357                }
31358
31359                let request = req_builder
31360                    .header(CONTENT_LENGTH, 0_u64)
31361                    .body(common::to_body::<String>(None));
31362
31363                client.request(request.unwrap()).await
31364            };
31365
31366            match req_result {
31367                Err(err) => {
31368                    if let common::Retry::After(d) = dlg.http_error(&err) {
31369                        sleep(d).await;
31370                        continue;
31371                    }
31372                    dlg.finished(false);
31373                    return Err(common::Error::HttpError(err));
31374                }
31375                Ok(res) => {
31376                    let (mut parts, body) = res.into_parts();
31377                    let mut body = common::Body::new(body);
31378                    if !parts.status.is_success() {
31379                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31380                        let error = serde_json::from_str(&common::to_string(&bytes));
31381                        let response = common::to_response(parts, bytes.into());
31382
31383                        if let common::Retry::After(d) =
31384                            dlg.http_failure(&response, error.as_ref().ok())
31385                        {
31386                            sleep(d).await;
31387                            continue;
31388                        }
31389
31390                        dlg.finished(false);
31391
31392                        return Err(match error {
31393                            Ok(value) => common::Error::BadRequest(value),
31394                            _ => common::Error::Failure(response),
31395                        });
31396                    }
31397                    let response = common::Response::from_parts(parts, body);
31398
31399                    dlg.finished(true);
31400                    return Ok(response);
31401                }
31402            }
31403        }
31404    }
31405
31406    /// User profile ID associated with this request.
31407    ///
31408    /// Sets the *profile id* path property to the given value.
31409    ///
31410    /// Even though the property as already been set when instantiating this call,
31411    /// we provide this method for API completeness.
31412    pub fn profile_id(mut self, new_value: i64) -> ContentCategoryDeleteCall<'a, C> {
31413        self._profile_id = new_value;
31414        self
31415    }
31416    /// Content category ID.
31417    ///
31418    /// Sets the *id* path property to the given value.
31419    ///
31420    /// Even though the property as already been set when instantiating this call,
31421    /// we provide this method for API completeness.
31422    pub fn id(mut self, new_value: i64) -> ContentCategoryDeleteCall<'a, C> {
31423        self._id = new_value;
31424        self
31425    }
31426    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31427    /// while executing the actual API request.
31428    ///
31429    /// ````text
31430    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
31431    /// ````
31432    ///
31433    /// Sets the *delegate* property to the given value.
31434    pub fn delegate(
31435        mut self,
31436        new_value: &'a mut dyn common::Delegate,
31437    ) -> ContentCategoryDeleteCall<'a, C> {
31438        self._delegate = Some(new_value);
31439        self
31440    }
31441
31442    /// Set any additional parameter of the query string used in the request.
31443    /// It should be used to set parameters which are not yet available through their own
31444    /// setters.
31445    ///
31446    /// Please note that this method must not be used to set any of the known parameters
31447    /// which have their own setter method. If done anyway, the request will fail.
31448    ///
31449    /// # Additional Parameters
31450    ///
31451    /// * *$.xgafv* (query-string) - V1 error format.
31452    /// * *access_token* (query-string) - OAuth access token.
31453    /// * *alt* (query-string) - Data format for response.
31454    /// * *callback* (query-string) - JSONP
31455    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31456    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
31457    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31458    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31459    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
31460    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31461    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31462    pub fn param<T>(mut self, name: T, value: T) -> ContentCategoryDeleteCall<'a, C>
31463    where
31464        T: AsRef<str>,
31465    {
31466        self._additional_params
31467            .insert(name.as_ref().to_string(), value.as_ref().to_string());
31468        self
31469    }
31470
31471    /// Identifies the authorization scope for the method you are building.
31472    ///
31473    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31474    /// [`Scope::Dfatrafficking`].
31475    ///
31476    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31477    /// tokens for more than one scope.
31478    ///
31479    /// Usually there is more than one suitable scope to authorize an operation, some of which may
31480    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31481    /// sufficient, a read-write scope will do as well.
31482    pub fn add_scope<St>(mut self, scope: St) -> ContentCategoryDeleteCall<'a, C>
31483    where
31484        St: AsRef<str>,
31485    {
31486        self._scopes.insert(String::from(scope.as_ref()));
31487        self
31488    }
31489    /// Identifies the authorization scope(s) for the method you are building.
31490    ///
31491    /// See [`Self::add_scope()`] for details.
31492    pub fn add_scopes<I, St>(mut self, scopes: I) -> ContentCategoryDeleteCall<'a, C>
31493    where
31494        I: IntoIterator<Item = St>,
31495        St: AsRef<str>,
31496    {
31497        self._scopes
31498            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31499        self
31500    }
31501
31502    /// Removes all scopes, and no default scope will be used either.
31503    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31504    /// for details).
31505    pub fn clear_scopes(mut self) -> ContentCategoryDeleteCall<'a, C> {
31506        self._scopes.clear();
31507        self
31508    }
31509}
31510
31511/// Gets one content category by ID.
31512///
31513/// A builder for the *get* method supported by a *contentCategory* resource.
31514/// It is not used directly, but through a [`ContentCategoryMethods`] instance.
31515///
31516/// # Example
31517///
31518/// Instantiate a resource method builder
31519///
31520/// ```test_harness,no_run
31521/// # extern crate hyper;
31522/// # extern crate hyper_rustls;
31523/// # extern crate google_dfareporting3d3 as dfareporting3d3;
31524/// # async fn dox() {
31525/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31526///
31527/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31528/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
31529/// #     secret,
31530/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
31531/// # ).build().await.unwrap();
31532///
31533/// # let client = hyper_util::client::legacy::Client::builder(
31534/// #     hyper_util::rt::TokioExecutor::new()
31535/// # )
31536/// # .build(
31537/// #     hyper_rustls::HttpsConnectorBuilder::new()
31538/// #         .with_native_roots()
31539/// #         .unwrap()
31540/// #         .https_or_http()
31541/// #         .enable_http1()
31542/// #         .build()
31543/// # );
31544/// # let mut hub = Dfareporting::new(client, auth);
31545/// // You can configure optional parameters by calling the respective setters at will, and
31546/// // execute the final call using `doit()`.
31547/// // Values shown here are possibly random and not representative !
31548/// let result = hub.content_categories().get(-45, -27)
31549///              .doit().await;
31550/// # }
31551/// ```
31552pub struct ContentCategoryGetCall<'a, C>
31553where
31554    C: 'a,
31555{
31556    hub: &'a Dfareporting<C>,
31557    _profile_id: i64,
31558    _id: i64,
31559    _delegate: Option<&'a mut dyn common::Delegate>,
31560    _additional_params: HashMap<String, String>,
31561    _scopes: BTreeSet<String>,
31562}
31563
31564impl<'a, C> common::CallBuilder for ContentCategoryGetCall<'a, C> {}
31565
31566impl<'a, C> ContentCategoryGetCall<'a, C>
31567where
31568    C: common::Connector,
31569{
31570    /// Perform the operation you have build so far.
31571    pub async fn doit(mut self) -> common::Result<(common::Response, ContentCategory)> {
31572        use std::borrow::Cow;
31573        use std::io::{Read, Seek};
31574
31575        use common::{url::Params, ToParts};
31576        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31577
31578        let mut dd = common::DefaultDelegate;
31579        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31580        dlg.begin(common::MethodInfo {
31581            id: "dfareporting.contentCategories.get",
31582            http_method: hyper::Method::GET,
31583        });
31584
31585        for &field in ["alt", "profileId", "id"].iter() {
31586            if self._additional_params.contains_key(field) {
31587                dlg.finished(false);
31588                return Err(common::Error::FieldClash(field));
31589            }
31590        }
31591
31592        let mut params = Params::with_capacity(4 + self._additional_params.len());
31593        params.push("profileId", self._profile_id.to_string());
31594        params.push("id", self._id.to_string());
31595
31596        params.extend(self._additional_params.iter());
31597
31598        params.push("alt", "json");
31599        let mut url =
31600            self.hub._base_url.clone() + "userprofiles/{profileId}/contentCategories/{id}";
31601        if self._scopes.is_empty() {
31602            self._scopes
31603                .insert(Scope::Dfatrafficking.as_ref().to_string());
31604        }
31605
31606        #[allow(clippy::single_element_loop)]
31607        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
31608            url = params.uri_replacement(url, param_name, find_this, false);
31609        }
31610        {
31611            let to_remove = ["id", "profileId"];
31612            params.remove_params(&to_remove);
31613        }
31614
31615        let url = params.parse_with_url(&url);
31616
31617        loop {
31618            let token = match self
31619                .hub
31620                .auth
31621                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31622                .await
31623            {
31624                Ok(token) => token,
31625                Err(e) => match dlg.token(e) {
31626                    Ok(token) => token,
31627                    Err(e) => {
31628                        dlg.finished(false);
31629                        return Err(common::Error::MissingToken(e));
31630                    }
31631                },
31632            };
31633            let mut req_result = {
31634                let client = &self.hub.client;
31635                dlg.pre_request();
31636                let mut req_builder = hyper::Request::builder()
31637                    .method(hyper::Method::GET)
31638                    .uri(url.as_str())
31639                    .header(USER_AGENT, self.hub._user_agent.clone());
31640
31641                if let Some(token) = token.as_ref() {
31642                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31643                }
31644
31645                let request = req_builder
31646                    .header(CONTENT_LENGTH, 0_u64)
31647                    .body(common::to_body::<String>(None));
31648
31649                client.request(request.unwrap()).await
31650            };
31651
31652            match req_result {
31653                Err(err) => {
31654                    if let common::Retry::After(d) = dlg.http_error(&err) {
31655                        sleep(d).await;
31656                        continue;
31657                    }
31658                    dlg.finished(false);
31659                    return Err(common::Error::HttpError(err));
31660                }
31661                Ok(res) => {
31662                    let (mut parts, body) = res.into_parts();
31663                    let mut body = common::Body::new(body);
31664                    if !parts.status.is_success() {
31665                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31666                        let error = serde_json::from_str(&common::to_string(&bytes));
31667                        let response = common::to_response(parts, bytes.into());
31668
31669                        if let common::Retry::After(d) =
31670                            dlg.http_failure(&response, error.as_ref().ok())
31671                        {
31672                            sleep(d).await;
31673                            continue;
31674                        }
31675
31676                        dlg.finished(false);
31677
31678                        return Err(match error {
31679                            Ok(value) => common::Error::BadRequest(value),
31680                            _ => common::Error::Failure(response),
31681                        });
31682                    }
31683                    let response = {
31684                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31685                        let encoded = common::to_string(&bytes);
31686                        match serde_json::from_str(&encoded) {
31687                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
31688                            Err(error) => {
31689                                dlg.response_json_decode_error(&encoded, &error);
31690                                return Err(common::Error::JsonDecodeError(
31691                                    encoded.to_string(),
31692                                    error,
31693                                ));
31694                            }
31695                        }
31696                    };
31697
31698                    dlg.finished(true);
31699                    return Ok(response);
31700                }
31701            }
31702        }
31703    }
31704
31705    /// User profile ID associated with this request.
31706    ///
31707    /// Sets the *profile id* path property to the given value.
31708    ///
31709    /// Even though the property as already been set when instantiating this call,
31710    /// we provide this method for API completeness.
31711    pub fn profile_id(mut self, new_value: i64) -> ContentCategoryGetCall<'a, C> {
31712        self._profile_id = new_value;
31713        self
31714    }
31715    /// Content category ID.
31716    ///
31717    /// Sets the *id* path property to the given value.
31718    ///
31719    /// Even though the property as already been set when instantiating this call,
31720    /// we provide this method for API completeness.
31721    pub fn id(mut self, new_value: i64) -> ContentCategoryGetCall<'a, C> {
31722        self._id = new_value;
31723        self
31724    }
31725    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31726    /// while executing the actual API request.
31727    ///
31728    /// ````text
31729    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
31730    /// ````
31731    ///
31732    /// Sets the *delegate* property to the given value.
31733    pub fn delegate(
31734        mut self,
31735        new_value: &'a mut dyn common::Delegate,
31736    ) -> ContentCategoryGetCall<'a, C> {
31737        self._delegate = Some(new_value);
31738        self
31739    }
31740
31741    /// Set any additional parameter of the query string used in the request.
31742    /// It should be used to set parameters which are not yet available through their own
31743    /// setters.
31744    ///
31745    /// Please note that this method must not be used to set any of the known parameters
31746    /// which have their own setter method. If done anyway, the request will fail.
31747    ///
31748    /// # Additional Parameters
31749    ///
31750    /// * *$.xgafv* (query-string) - V1 error format.
31751    /// * *access_token* (query-string) - OAuth access token.
31752    /// * *alt* (query-string) - Data format for response.
31753    /// * *callback* (query-string) - JSONP
31754    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31755    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
31756    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31757    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31758    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
31759    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31760    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31761    pub fn param<T>(mut self, name: T, value: T) -> ContentCategoryGetCall<'a, C>
31762    where
31763        T: AsRef<str>,
31764    {
31765        self._additional_params
31766            .insert(name.as_ref().to_string(), value.as_ref().to_string());
31767        self
31768    }
31769
31770    /// Identifies the authorization scope for the method you are building.
31771    ///
31772    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31773    /// [`Scope::Dfatrafficking`].
31774    ///
31775    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31776    /// tokens for more than one scope.
31777    ///
31778    /// Usually there is more than one suitable scope to authorize an operation, some of which may
31779    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31780    /// sufficient, a read-write scope will do as well.
31781    pub fn add_scope<St>(mut self, scope: St) -> ContentCategoryGetCall<'a, C>
31782    where
31783        St: AsRef<str>,
31784    {
31785        self._scopes.insert(String::from(scope.as_ref()));
31786        self
31787    }
31788    /// Identifies the authorization scope(s) for the method you are building.
31789    ///
31790    /// See [`Self::add_scope()`] for details.
31791    pub fn add_scopes<I, St>(mut self, scopes: I) -> ContentCategoryGetCall<'a, C>
31792    where
31793        I: IntoIterator<Item = St>,
31794        St: AsRef<str>,
31795    {
31796        self._scopes
31797            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31798        self
31799    }
31800
31801    /// Removes all scopes, and no default scope will be used either.
31802    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31803    /// for details).
31804    pub fn clear_scopes(mut self) -> ContentCategoryGetCall<'a, C> {
31805        self._scopes.clear();
31806        self
31807    }
31808}
31809
31810/// Inserts a new content category.
31811///
31812/// A builder for the *insert* method supported by a *contentCategory* resource.
31813/// It is not used directly, but through a [`ContentCategoryMethods`] instance.
31814///
31815/// # Example
31816///
31817/// Instantiate a resource method builder
31818///
31819/// ```test_harness,no_run
31820/// # extern crate hyper;
31821/// # extern crate hyper_rustls;
31822/// # extern crate google_dfareporting3d3 as dfareporting3d3;
31823/// use dfareporting3d3::api::ContentCategory;
31824/// # async fn dox() {
31825/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31826///
31827/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31828/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
31829/// #     secret,
31830/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
31831/// # ).build().await.unwrap();
31832///
31833/// # let client = hyper_util::client::legacy::Client::builder(
31834/// #     hyper_util::rt::TokioExecutor::new()
31835/// # )
31836/// # .build(
31837/// #     hyper_rustls::HttpsConnectorBuilder::new()
31838/// #         .with_native_roots()
31839/// #         .unwrap()
31840/// #         .https_or_http()
31841/// #         .enable_http1()
31842/// #         .build()
31843/// # );
31844/// # let mut hub = Dfareporting::new(client, auth);
31845/// // As the method needs a request, you would usually fill it with the desired information
31846/// // into the respective structure. Some of the parts shown here might not be applicable !
31847/// // Values shown here are possibly random and not representative !
31848/// let mut req = ContentCategory::default();
31849///
31850/// // You can configure optional parameters by calling the respective setters at will, and
31851/// // execute the final call using `doit()`.
31852/// // Values shown here are possibly random and not representative !
31853/// let result = hub.content_categories().insert(req, -53)
31854///              .doit().await;
31855/// # }
31856/// ```
31857pub struct ContentCategoryInsertCall<'a, C>
31858where
31859    C: 'a,
31860{
31861    hub: &'a Dfareporting<C>,
31862    _request: ContentCategory,
31863    _profile_id: i64,
31864    _delegate: Option<&'a mut dyn common::Delegate>,
31865    _additional_params: HashMap<String, String>,
31866    _scopes: BTreeSet<String>,
31867}
31868
31869impl<'a, C> common::CallBuilder for ContentCategoryInsertCall<'a, C> {}
31870
31871impl<'a, C> ContentCategoryInsertCall<'a, C>
31872where
31873    C: common::Connector,
31874{
31875    /// Perform the operation you have build so far.
31876    pub async fn doit(mut self) -> common::Result<(common::Response, ContentCategory)> {
31877        use std::borrow::Cow;
31878        use std::io::{Read, Seek};
31879
31880        use common::{url::Params, ToParts};
31881        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31882
31883        let mut dd = common::DefaultDelegate;
31884        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31885        dlg.begin(common::MethodInfo {
31886            id: "dfareporting.contentCategories.insert",
31887            http_method: hyper::Method::POST,
31888        });
31889
31890        for &field in ["alt", "profileId"].iter() {
31891            if self._additional_params.contains_key(field) {
31892                dlg.finished(false);
31893                return Err(common::Error::FieldClash(field));
31894            }
31895        }
31896
31897        let mut params = Params::with_capacity(4 + self._additional_params.len());
31898        params.push("profileId", self._profile_id.to_string());
31899
31900        params.extend(self._additional_params.iter());
31901
31902        params.push("alt", "json");
31903        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/contentCategories";
31904        if self._scopes.is_empty() {
31905            self._scopes
31906                .insert(Scope::Dfatrafficking.as_ref().to_string());
31907        }
31908
31909        #[allow(clippy::single_element_loop)]
31910        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
31911            url = params.uri_replacement(url, param_name, find_this, false);
31912        }
31913        {
31914            let to_remove = ["profileId"];
31915            params.remove_params(&to_remove);
31916        }
31917
31918        let url = params.parse_with_url(&url);
31919
31920        let mut json_mime_type = mime::APPLICATION_JSON;
31921        let mut request_value_reader = {
31922            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
31923            common::remove_json_null_values(&mut value);
31924            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
31925            serde_json::to_writer(&mut dst, &value).unwrap();
31926            dst
31927        };
31928        let request_size = request_value_reader
31929            .seek(std::io::SeekFrom::End(0))
31930            .unwrap();
31931        request_value_reader
31932            .seek(std::io::SeekFrom::Start(0))
31933            .unwrap();
31934
31935        loop {
31936            let token = match self
31937                .hub
31938                .auth
31939                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31940                .await
31941            {
31942                Ok(token) => token,
31943                Err(e) => match dlg.token(e) {
31944                    Ok(token) => token,
31945                    Err(e) => {
31946                        dlg.finished(false);
31947                        return Err(common::Error::MissingToken(e));
31948                    }
31949                },
31950            };
31951            request_value_reader
31952                .seek(std::io::SeekFrom::Start(0))
31953                .unwrap();
31954            let mut req_result = {
31955                let client = &self.hub.client;
31956                dlg.pre_request();
31957                let mut req_builder = hyper::Request::builder()
31958                    .method(hyper::Method::POST)
31959                    .uri(url.as_str())
31960                    .header(USER_AGENT, self.hub._user_agent.clone());
31961
31962                if let Some(token) = token.as_ref() {
31963                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31964                }
31965
31966                let request = req_builder
31967                    .header(CONTENT_TYPE, json_mime_type.to_string())
31968                    .header(CONTENT_LENGTH, request_size as u64)
31969                    .body(common::to_body(
31970                        request_value_reader.get_ref().clone().into(),
31971                    ));
31972
31973                client.request(request.unwrap()).await
31974            };
31975
31976            match req_result {
31977                Err(err) => {
31978                    if let common::Retry::After(d) = dlg.http_error(&err) {
31979                        sleep(d).await;
31980                        continue;
31981                    }
31982                    dlg.finished(false);
31983                    return Err(common::Error::HttpError(err));
31984                }
31985                Ok(res) => {
31986                    let (mut parts, body) = res.into_parts();
31987                    let mut body = common::Body::new(body);
31988                    if !parts.status.is_success() {
31989                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31990                        let error = serde_json::from_str(&common::to_string(&bytes));
31991                        let response = common::to_response(parts, bytes.into());
31992
31993                        if let common::Retry::After(d) =
31994                            dlg.http_failure(&response, error.as_ref().ok())
31995                        {
31996                            sleep(d).await;
31997                            continue;
31998                        }
31999
32000                        dlg.finished(false);
32001
32002                        return Err(match error {
32003                            Ok(value) => common::Error::BadRequest(value),
32004                            _ => common::Error::Failure(response),
32005                        });
32006                    }
32007                    let response = {
32008                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32009                        let encoded = common::to_string(&bytes);
32010                        match serde_json::from_str(&encoded) {
32011                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
32012                            Err(error) => {
32013                                dlg.response_json_decode_error(&encoded, &error);
32014                                return Err(common::Error::JsonDecodeError(
32015                                    encoded.to_string(),
32016                                    error,
32017                                ));
32018                            }
32019                        }
32020                    };
32021
32022                    dlg.finished(true);
32023                    return Ok(response);
32024                }
32025            }
32026        }
32027    }
32028
32029    ///
32030    /// Sets the *request* property to the given value.
32031    ///
32032    /// Even though the property as already been set when instantiating this call,
32033    /// we provide this method for API completeness.
32034    pub fn request(mut self, new_value: ContentCategory) -> ContentCategoryInsertCall<'a, C> {
32035        self._request = new_value;
32036        self
32037    }
32038    /// User profile ID associated with this request.
32039    ///
32040    /// Sets the *profile id* path property to the given value.
32041    ///
32042    /// Even though the property as already been set when instantiating this call,
32043    /// we provide this method for API completeness.
32044    pub fn profile_id(mut self, new_value: i64) -> ContentCategoryInsertCall<'a, C> {
32045        self._profile_id = new_value;
32046        self
32047    }
32048    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
32049    /// while executing the actual API request.
32050    ///
32051    /// ````text
32052    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
32053    /// ````
32054    ///
32055    /// Sets the *delegate* property to the given value.
32056    pub fn delegate(
32057        mut self,
32058        new_value: &'a mut dyn common::Delegate,
32059    ) -> ContentCategoryInsertCall<'a, C> {
32060        self._delegate = Some(new_value);
32061        self
32062    }
32063
32064    /// Set any additional parameter of the query string used in the request.
32065    /// It should be used to set parameters which are not yet available through their own
32066    /// setters.
32067    ///
32068    /// Please note that this method must not be used to set any of the known parameters
32069    /// which have their own setter method. If done anyway, the request will fail.
32070    ///
32071    /// # Additional Parameters
32072    ///
32073    /// * *$.xgafv* (query-string) - V1 error format.
32074    /// * *access_token* (query-string) - OAuth access token.
32075    /// * *alt* (query-string) - Data format for response.
32076    /// * *callback* (query-string) - JSONP
32077    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
32078    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
32079    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
32080    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
32081    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
32082    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
32083    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
32084    pub fn param<T>(mut self, name: T, value: T) -> ContentCategoryInsertCall<'a, C>
32085    where
32086        T: AsRef<str>,
32087    {
32088        self._additional_params
32089            .insert(name.as_ref().to_string(), value.as_ref().to_string());
32090        self
32091    }
32092
32093    /// Identifies the authorization scope for the method you are building.
32094    ///
32095    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
32096    /// [`Scope::Dfatrafficking`].
32097    ///
32098    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
32099    /// tokens for more than one scope.
32100    ///
32101    /// Usually there is more than one suitable scope to authorize an operation, some of which may
32102    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
32103    /// sufficient, a read-write scope will do as well.
32104    pub fn add_scope<St>(mut self, scope: St) -> ContentCategoryInsertCall<'a, C>
32105    where
32106        St: AsRef<str>,
32107    {
32108        self._scopes.insert(String::from(scope.as_ref()));
32109        self
32110    }
32111    /// Identifies the authorization scope(s) for the method you are building.
32112    ///
32113    /// See [`Self::add_scope()`] for details.
32114    pub fn add_scopes<I, St>(mut self, scopes: I) -> ContentCategoryInsertCall<'a, C>
32115    where
32116        I: IntoIterator<Item = St>,
32117        St: AsRef<str>,
32118    {
32119        self._scopes
32120            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
32121        self
32122    }
32123
32124    /// Removes all scopes, and no default scope will be used either.
32125    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
32126    /// for details).
32127    pub fn clear_scopes(mut self) -> ContentCategoryInsertCall<'a, C> {
32128        self._scopes.clear();
32129        self
32130    }
32131}
32132
32133/// Retrieves a list of content categories, possibly filtered. This method supports paging.
32134///
32135/// A builder for the *list* method supported by a *contentCategory* resource.
32136/// It is not used directly, but through a [`ContentCategoryMethods`] instance.
32137///
32138/// # Example
32139///
32140/// Instantiate a resource method builder
32141///
32142/// ```test_harness,no_run
32143/// # extern crate hyper;
32144/// # extern crate hyper_rustls;
32145/// # extern crate google_dfareporting3d3 as dfareporting3d3;
32146/// # async fn dox() {
32147/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
32148///
32149/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
32150/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
32151/// #     secret,
32152/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
32153/// # ).build().await.unwrap();
32154///
32155/// # let client = hyper_util::client::legacy::Client::builder(
32156/// #     hyper_util::rt::TokioExecutor::new()
32157/// # )
32158/// # .build(
32159/// #     hyper_rustls::HttpsConnectorBuilder::new()
32160/// #         .with_native_roots()
32161/// #         .unwrap()
32162/// #         .https_or_http()
32163/// #         .enable_http1()
32164/// #         .build()
32165/// # );
32166/// # let mut hub = Dfareporting::new(client, auth);
32167/// // You can configure optional parameters by calling the respective setters at will, and
32168/// // execute the final call using `doit()`.
32169/// // Values shown here are possibly random and not representative !
32170/// let result = hub.content_categories().list(-20)
32171///              .sort_order("sit")
32172///              .sort_field("magna")
32173///              .search_string("et")
32174///              .page_token("rebum.")
32175///              .max_results(-4)
32176///              .add_ids(-6)
32177///              .doit().await;
32178/// # }
32179/// ```
32180pub struct ContentCategoryListCall<'a, C>
32181where
32182    C: 'a,
32183{
32184    hub: &'a Dfareporting<C>,
32185    _profile_id: i64,
32186    _sort_order: Option<String>,
32187    _sort_field: Option<String>,
32188    _search_string: Option<String>,
32189    _page_token: Option<String>,
32190    _max_results: Option<i32>,
32191    _ids: Vec<i64>,
32192    _delegate: Option<&'a mut dyn common::Delegate>,
32193    _additional_params: HashMap<String, String>,
32194    _scopes: BTreeSet<String>,
32195}
32196
32197impl<'a, C> common::CallBuilder for ContentCategoryListCall<'a, C> {}
32198
32199impl<'a, C> ContentCategoryListCall<'a, C>
32200where
32201    C: common::Connector,
32202{
32203    /// Perform the operation you have build so far.
32204    pub async fn doit(
32205        mut self,
32206    ) -> common::Result<(common::Response, ContentCategoriesListResponse)> {
32207        use std::borrow::Cow;
32208        use std::io::{Read, Seek};
32209
32210        use common::{url::Params, ToParts};
32211        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32212
32213        let mut dd = common::DefaultDelegate;
32214        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32215        dlg.begin(common::MethodInfo {
32216            id: "dfareporting.contentCategories.list",
32217            http_method: hyper::Method::GET,
32218        });
32219
32220        for &field in [
32221            "alt",
32222            "profileId",
32223            "sortOrder",
32224            "sortField",
32225            "searchString",
32226            "pageToken",
32227            "maxResults",
32228            "ids",
32229        ]
32230        .iter()
32231        {
32232            if self._additional_params.contains_key(field) {
32233                dlg.finished(false);
32234                return Err(common::Error::FieldClash(field));
32235            }
32236        }
32237
32238        let mut params = Params::with_capacity(9 + self._additional_params.len());
32239        params.push("profileId", self._profile_id.to_string());
32240        if let Some(value) = self._sort_order.as_ref() {
32241            params.push("sortOrder", value);
32242        }
32243        if let Some(value) = self._sort_field.as_ref() {
32244            params.push("sortField", value);
32245        }
32246        if let Some(value) = self._search_string.as_ref() {
32247            params.push("searchString", value);
32248        }
32249        if let Some(value) = self._page_token.as_ref() {
32250            params.push("pageToken", value);
32251        }
32252        if let Some(value) = self._max_results.as_ref() {
32253            params.push("maxResults", value.to_string());
32254        }
32255        if !self._ids.is_empty() {
32256            for f in self._ids.iter() {
32257                params.push("ids", f.to_string());
32258            }
32259        }
32260
32261        params.extend(self._additional_params.iter());
32262
32263        params.push("alt", "json");
32264        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/contentCategories";
32265        if self._scopes.is_empty() {
32266            self._scopes
32267                .insert(Scope::Dfatrafficking.as_ref().to_string());
32268        }
32269
32270        #[allow(clippy::single_element_loop)]
32271        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
32272            url = params.uri_replacement(url, param_name, find_this, false);
32273        }
32274        {
32275            let to_remove = ["profileId"];
32276            params.remove_params(&to_remove);
32277        }
32278
32279        let url = params.parse_with_url(&url);
32280
32281        loop {
32282            let token = match self
32283                .hub
32284                .auth
32285                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
32286                .await
32287            {
32288                Ok(token) => token,
32289                Err(e) => match dlg.token(e) {
32290                    Ok(token) => token,
32291                    Err(e) => {
32292                        dlg.finished(false);
32293                        return Err(common::Error::MissingToken(e));
32294                    }
32295                },
32296            };
32297            let mut req_result = {
32298                let client = &self.hub.client;
32299                dlg.pre_request();
32300                let mut req_builder = hyper::Request::builder()
32301                    .method(hyper::Method::GET)
32302                    .uri(url.as_str())
32303                    .header(USER_AGENT, self.hub._user_agent.clone());
32304
32305                if let Some(token) = token.as_ref() {
32306                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
32307                }
32308
32309                let request = req_builder
32310                    .header(CONTENT_LENGTH, 0_u64)
32311                    .body(common::to_body::<String>(None));
32312
32313                client.request(request.unwrap()).await
32314            };
32315
32316            match req_result {
32317                Err(err) => {
32318                    if let common::Retry::After(d) = dlg.http_error(&err) {
32319                        sleep(d).await;
32320                        continue;
32321                    }
32322                    dlg.finished(false);
32323                    return Err(common::Error::HttpError(err));
32324                }
32325                Ok(res) => {
32326                    let (mut parts, body) = res.into_parts();
32327                    let mut body = common::Body::new(body);
32328                    if !parts.status.is_success() {
32329                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32330                        let error = serde_json::from_str(&common::to_string(&bytes));
32331                        let response = common::to_response(parts, bytes.into());
32332
32333                        if let common::Retry::After(d) =
32334                            dlg.http_failure(&response, error.as_ref().ok())
32335                        {
32336                            sleep(d).await;
32337                            continue;
32338                        }
32339
32340                        dlg.finished(false);
32341
32342                        return Err(match error {
32343                            Ok(value) => common::Error::BadRequest(value),
32344                            _ => common::Error::Failure(response),
32345                        });
32346                    }
32347                    let response = {
32348                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32349                        let encoded = common::to_string(&bytes);
32350                        match serde_json::from_str(&encoded) {
32351                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
32352                            Err(error) => {
32353                                dlg.response_json_decode_error(&encoded, &error);
32354                                return Err(common::Error::JsonDecodeError(
32355                                    encoded.to_string(),
32356                                    error,
32357                                ));
32358                            }
32359                        }
32360                    };
32361
32362                    dlg.finished(true);
32363                    return Ok(response);
32364                }
32365            }
32366        }
32367    }
32368
32369    /// User profile ID associated with this request.
32370    ///
32371    /// Sets the *profile id* path property to the given value.
32372    ///
32373    /// Even though the property as already been set when instantiating this call,
32374    /// we provide this method for API completeness.
32375    pub fn profile_id(mut self, new_value: i64) -> ContentCategoryListCall<'a, C> {
32376        self._profile_id = new_value;
32377        self
32378    }
32379    /// Order of sorted results.
32380    ///
32381    /// Sets the *sort order* query property to the given value.
32382    pub fn sort_order(mut self, new_value: &str) -> ContentCategoryListCall<'a, C> {
32383        self._sort_order = Some(new_value.to_string());
32384        self
32385    }
32386    /// Field by which to sort the list.
32387    ///
32388    /// Sets the *sort field* query property to the given value.
32389    pub fn sort_field(mut self, new_value: &str) -> ContentCategoryListCall<'a, C> {
32390        self._sort_field = Some(new_value.to_string());
32391        self
32392    }
32393    /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "contentcategory*2015" will return objects with names like "contentcategory June 2015", "contentcategory April 2015", or simply "contentcategory 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "contentcategory" will match objects with name "my contentcategory", "contentcategory 2015", or simply "contentcategory".
32394    ///
32395    /// Sets the *search string* query property to the given value.
32396    pub fn search_string(mut self, new_value: &str) -> ContentCategoryListCall<'a, C> {
32397        self._search_string = Some(new_value.to_string());
32398        self
32399    }
32400    /// Value of the nextPageToken from the previous result page.
32401    ///
32402    /// Sets the *page token* query property to the given value.
32403    pub fn page_token(mut self, new_value: &str) -> ContentCategoryListCall<'a, C> {
32404        self._page_token = Some(new_value.to_string());
32405        self
32406    }
32407    /// Maximum number of results to return.
32408    ///
32409    /// Sets the *max results* query property to the given value.
32410    pub fn max_results(mut self, new_value: i32) -> ContentCategoryListCall<'a, C> {
32411        self._max_results = Some(new_value);
32412        self
32413    }
32414    /// Select only content categories with these IDs.
32415    ///
32416    /// Append the given value to the *ids* query property.
32417    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
32418    pub fn add_ids(mut self, new_value: i64) -> ContentCategoryListCall<'a, C> {
32419        self._ids.push(new_value);
32420        self
32421    }
32422    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
32423    /// while executing the actual API request.
32424    ///
32425    /// ````text
32426    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
32427    /// ````
32428    ///
32429    /// Sets the *delegate* property to the given value.
32430    pub fn delegate(
32431        mut self,
32432        new_value: &'a mut dyn common::Delegate,
32433    ) -> ContentCategoryListCall<'a, C> {
32434        self._delegate = Some(new_value);
32435        self
32436    }
32437
32438    /// Set any additional parameter of the query string used in the request.
32439    /// It should be used to set parameters which are not yet available through their own
32440    /// setters.
32441    ///
32442    /// Please note that this method must not be used to set any of the known parameters
32443    /// which have their own setter method. If done anyway, the request will fail.
32444    ///
32445    /// # Additional Parameters
32446    ///
32447    /// * *$.xgafv* (query-string) - V1 error format.
32448    /// * *access_token* (query-string) - OAuth access token.
32449    /// * *alt* (query-string) - Data format for response.
32450    /// * *callback* (query-string) - JSONP
32451    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
32452    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
32453    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
32454    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
32455    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
32456    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
32457    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
32458    pub fn param<T>(mut self, name: T, value: T) -> ContentCategoryListCall<'a, C>
32459    where
32460        T: AsRef<str>,
32461    {
32462        self._additional_params
32463            .insert(name.as_ref().to_string(), value.as_ref().to_string());
32464        self
32465    }
32466
32467    /// Identifies the authorization scope for the method you are building.
32468    ///
32469    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
32470    /// [`Scope::Dfatrafficking`].
32471    ///
32472    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
32473    /// tokens for more than one scope.
32474    ///
32475    /// Usually there is more than one suitable scope to authorize an operation, some of which may
32476    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
32477    /// sufficient, a read-write scope will do as well.
32478    pub fn add_scope<St>(mut self, scope: St) -> ContentCategoryListCall<'a, C>
32479    where
32480        St: AsRef<str>,
32481    {
32482        self._scopes.insert(String::from(scope.as_ref()));
32483        self
32484    }
32485    /// Identifies the authorization scope(s) for the method you are building.
32486    ///
32487    /// See [`Self::add_scope()`] for details.
32488    pub fn add_scopes<I, St>(mut self, scopes: I) -> ContentCategoryListCall<'a, C>
32489    where
32490        I: IntoIterator<Item = St>,
32491        St: AsRef<str>,
32492    {
32493        self._scopes
32494            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
32495        self
32496    }
32497
32498    /// Removes all scopes, and no default scope will be used either.
32499    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
32500    /// for details).
32501    pub fn clear_scopes(mut self) -> ContentCategoryListCall<'a, C> {
32502        self._scopes.clear();
32503        self
32504    }
32505}
32506
32507/// Updates an existing content category. This method supports patch semantics.
32508///
32509/// A builder for the *patch* method supported by a *contentCategory* resource.
32510/// It is not used directly, but through a [`ContentCategoryMethods`] instance.
32511///
32512/// # Example
32513///
32514/// Instantiate a resource method builder
32515///
32516/// ```test_harness,no_run
32517/// # extern crate hyper;
32518/// # extern crate hyper_rustls;
32519/// # extern crate google_dfareporting3d3 as dfareporting3d3;
32520/// use dfareporting3d3::api::ContentCategory;
32521/// # async fn dox() {
32522/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
32523///
32524/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
32525/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
32526/// #     secret,
32527/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
32528/// # ).build().await.unwrap();
32529///
32530/// # let client = hyper_util::client::legacy::Client::builder(
32531/// #     hyper_util::rt::TokioExecutor::new()
32532/// # )
32533/// # .build(
32534/// #     hyper_rustls::HttpsConnectorBuilder::new()
32535/// #         .with_native_roots()
32536/// #         .unwrap()
32537/// #         .https_or_http()
32538/// #         .enable_http1()
32539/// #         .build()
32540/// # );
32541/// # let mut hub = Dfareporting::new(client, auth);
32542/// // As the method needs a request, you would usually fill it with the desired information
32543/// // into the respective structure. Some of the parts shown here might not be applicable !
32544/// // Values shown here are possibly random and not representative !
32545/// let mut req = ContentCategory::default();
32546///
32547/// // You can configure optional parameters by calling the respective setters at will, and
32548/// // execute the final call using `doit()`.
32549/// // Values shown here are possibly random and not representative !
32550/// let result = hub.content_categories().patch(req, -71, -52)
32551///              .doit().await;
32552/// # }
32553/// ```
32554pub struct ContentCategoryPatchCall<'a, C>
32555where
32556    C: 'a,
32557{
32558    hub: &'a Dfareporting<C>,
32559    _request: ContentCategory,
32560    _profile_id: i64,
32561    _id: i64,
32562    _delegate: Option<&'a mut dyn common::Delegate>,
32563    _additional_params: HashMap<String, String>,
32564    _scopes: BTreeSet<String>,
32565}
32566
32567impl<'a, C> common::CallBuilder for ContentCategoryPatchCall<'a, C> {}
32568
32569impl<'a, C> ContentCategoryPatchCall<'a, C>
32570where
32571    C: common::Connector,
32572{
32573    /// Perform the operation you have build so far.
32574    pub async fn doit(mut self) -> common::Result<(common::Response, ContentCategory)> {
32575        use std::borrow::Cow;
32576        use std::io::{Read, Seek};
32577
32578        use common::{url::Params, ToParts};
32579        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32580
32581        let mut dd = common::DefaultDelegate;
32582        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32583        dlg.begin(common::MethodInfo {
32584            id: "dfareporting.contentCategories.patch",
32585            http_method: hyper::Method::PATCH,
32586        });
32587
32588        for &field in ["alt", "profileId", "id"].iter() {
32589            if self._additional_params.contains_key(field) {
32590                dlg.finished(false);
32591                return Err(common::Error::FieldClash(field));
32592            }
32593        }
32594
32595        let mut params = Params::with_capacity(5 + self._additional_params.len());
32596        params.push("profileId", self._profile_id.to_string());
32597        params.push("id", self._id.to_string());
32598
32599        params.extend(self._additional_params.iter());
32600
32601        params.push("alt", "json");
32602        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/contentCategories";
32603        if self._scopes.is_empty() {
32604            self._scopes
32605                .insert(Scope::Dfatrafficking.as_ref().to_string());
32606        }
32607
32608        #[allow(clippy::single_element_loop)]
32609        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
32610            url = params.uri_replacement(url, param_name, find_this, false);
32611        }
32612        {
32613            let to_remove = ["profileId"];
32614            params.remove_params(&to_remove);
32615        }
32616
32617        let url = params.parse_with_url(&url);
32618
32619        let mut json_mime_type = mime::APPLICATION_JSON;
32620        let mut request_value_reader = {
32621            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
32622            common::remove_json_null_values(&mut value);
32623            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
32624            serde_json::to_writer(&mut dst, &value).unwrap();
32625            dst
32626        };
32627        let request_size = request_value_reader
32628            .seek(std::io::SeekFrom::End(0))
32629            .unwrap();
32630        request_value_reader
32631            .seek(std::io::SeekFrom::Start(0))
32632            .unwrap();
32633
32634        loop {
32635            let token = match self
32636                .hub
32637                .auth
32638                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
32639                .await
32640            {
32641                Ok(token) => token,
32642                Err(e) => match dlg.token(e) {
32643                    Ok(token) => token,
32644                    Err(e) => {
32645                        dlg.finished(false);
32646                        return Err(common::Error::MissingToken(e));
32647                    }
32648                },
32649            };
32650            request_value_reader
32651                .seek(std::io::SeekFrom::Start(0))
32652                .unwrap();
32653            let mut req_result = {
32654                let client = &self.hub.client;
32655                dlg.pre_request();
32656                let mut req_builder = hyper::Request::builder()
32657                    .method(hyper::Method::PATCH)
32658                    .uri(url.as_str())
32659                    .header(USER_AGENT, self.hub._user_agent.clone());
32660
32661                if let Some(token) = token.as_ref() {
32662                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
32663                }
32664
32665                let request = req_builder
32666                    .header(CONTENT_TYPE, json_mime_type.to_string())
32667                    .header(CONTENT_LENGTH, request_size as u64)
32668                    .body(common::to_body(
32669                        request_value_reader.get_ref().clone().into(),
32670                    ));
32671
32672                client.request(request.unwrap()).await
32673            };
32674
32675            match req_result {
32676                Err(err) => {
32677                    if let common::Retry::After(d) = dlg.http_error(&err) {
32678                        sleep(d).await;
32679                        continue;
32680                    }
32681                    dlg.finished(false);
32682                    return Err(common::Error::HttpError(err));
32683                }
32684                Ok(res) => {
32685                    let (mut parts, body) = res.into_parts();
32686                    let mut body = common::Body::new(body);
32687                    if !parts.status.is_success() {
32688                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32689                        let error = serde_json::from_str(&common::to_string(&bytes));
32690                        let response = common::to_response(parts, bytes.into());
32691
32692                        if let common::Retry::After(d) =
32693                            dlg.http_failure(&response, error.as_ref().ok())
32694                        {
32695                            sleep(d).await;
32696                            continue;
32697                        }
32698
32699                        dlg.finished(false);
32700
32701                        return Err(match error {
32702                            Ok(value) => common::Error::BadRequest(value),
32703                            _ => common::Error::Failure(response),
32704                        });
32705                    }
32706                    let response = {
32707                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32708                        let encoded = common::to_string(&bytes);
32709                        match serde_json::from_str(&encoded) {
32710                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
32711                            Err(error) => {
32712                                dlg.response_json_decode_error(&encoded, &error);
32713                                return Err(common::Error::JsonDecodeError(
32714                                    encoded.to_string(),
32715                                    error,
32716                                ));
32717                            }
32718                        }
32719                    };
32720
32721                    dlg.finished(true);
32722                    return Ok(response);
32723                }
32724            }
32725        }
32726    }
32727
32728    ///
32729    /// Sets the *request* property to the given value.
32730    ///
32731    /// Even though the property as already been set when instantiating this call,
32732    /// we provide this method for API completeness.
32733    pub fn request(mut self, new_value: ContentCategory) -> ContentCategoryPatchCall<'a, C> {
32734        self._request = new_value;
32735        self
32736    }
32737    /// User profile ID associated with this request.
32738    ///
32739    /// Sets the *profile id* path property to the given value.
32740    ///
32741    /// Even though the property as already been set when instantiating this call,
32742    /// we provide this method for API completeness.
32743    pub fn profile_id(mut self, new_value: i64) -> ContentCategoryPatchCall<'a, C> {
32744        self._profile_id = new_value;
32745        self
32746    }
32747    /// ContentCategory ID.
32748    ///
32749    /// Sets the *id* query property to the given value.
32750    ///
32751    /// Even though the property as already been set when instantiating this call,
32752    /// we provide this method for API completeness.
32753    pub fn id(mut self, new_value: i64) -> ContentCategoryPatchCall<'a, C> {
32754        self._id = new_value;
32755        self
32756    }
32757    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
32758    /// while executing the actual API request.
32759    ///
32760    /// ````text
32761    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
32762    /// ````
32763    ///
32764    /// Sets the *delegate* property to the given value.
32765    pub fn delegate(
32766        mut self,
32767        new_value: &'a mut dyn common::Delegate,
32768    ) -> ContentCategoryPatchCall<'a, C> {
32769        self._delegate = Some(new_value);
32770        self
32771    }
32772
32773    /// Set any additional parameter of the query string used in the request.
32774    /// It should be used to set parameters which are not yet available through their own
32775    /// setters.
32776    ///
32777    /// Please note that this method must not be used to set any of the known parameters
32778    /// which have their own setter method. If done anyway, the request will fail.
32779    ///
32780    /// # Additional Parameters
32781    ///
32782    /// * *$.xgafv* (query-string) - V1 error format.
32783    /// * *access_token* (query-string) - OAuth access token.
32784    /// * *alt* (query-string) - Data format for response.
32785    /// * *callback* (query-string) - JSONP
32786    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
32787    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
32788    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
32789    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
32790    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
32791    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
32792    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
32793    pub fn param<T>(mut self, name: T, value: T) -> ContentCategoryPatchCall<'a, C>
32794    where
32795        T: AsRef<str>,
32796    {
32797        self._additional_params
32798            .insert(name.as_ref().to_string(), value.as_ref().to_string());
32799        self
32800    }
32801
32802    /// Identifies the authorization scope for the method you are building.
32803    ///
32804    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
32805    /// [`Scope::Dfatrafficking`].
32806    ///
32807    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
32808    /// tokens for more than one scope.
32809    ///
32810    /// Usually there is more than one suitable scope to authorize an operation, some of which may
32811    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
32812    /// sufficient, a read-write scope will do as well.
32813    pub fn add_scope<St>(mut self, scope: St) -> ContentCategoryPatchCall<'a, C>
32814    where
32815        St: AsRef<str>,
32816    {
32817        self._scopes.insert(String::from(scope.as_ref()));
32818        self
32819    }
32820    /// Identifies the authorization scope(s) for the method you are building.
32821    ///
32822    /// See [`Self::add_scope()`] for details.
32823    pub fn add_scopes<I, St>(mut self, scopes: I) -> ContentCategoryPatchCall<'a, C>
32824    where
32825        I: IntoIterator<Item = St>,
32826        St: AsRef<str>,
32827    {
32828        self._scopes
32829            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
32830        self
32831    }
32832
32833    /// Removes all scopes, and no default scope will be used either.
32834    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
32835    /// for details).
32836    pub fn clear_scopes(mut self) -> ContentCategoryPatchCall<'a, C> {
32837        self._scopes.clear();
32838        self
32839    }
32840}
32841
32842/// Updates an existing content category.
32843///
32844/// A builder for the *update* method supported by a *contentCategory* resource.
32845/// It is not used directly, but through a [`ContentCategoryMethods`] instance.
32846///
32847/// # Example
32848///
32849/// Instantiate a resource method builder
32850///
32851/// ```test_harness,no_run
32852/// # extern crate hyper;
32853/// # extern crate hyper_rustls;
32854/// # extern crate google_dfareporting3d3 as dfareporting3d3;
32855/// use dfareporting3d3::api::ContentCategory;
32856/// # async fn dox() {
32857/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
32858///
32859/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
32860/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
32861/// #     secret,
32862/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
32863/// # ).build().await.unwrap();
32864///
32865/// # let client = hyper_util::client::legacy::Client::builder(
32866/// #     hyper_util::rt::TokioExecutor::new()
32867/// # )
32868/// # .build(
32869/// #     hyper_rustls::HttpsConnectorBuilder::new()
32870/// #         .with_native_roots()
32871/// #         .unwrap()
32872/// #         .https_or_http()
32873/// #         .enable_http1()
32874/// #         .build()
32875/// # );
32876/// # let mut hub = Dfareporting::new(client, auth);
32877/// // As the method needs a request, you would usually fill it with the desired information
32878/// // into the respective structure. Some of the parts shown here might not be applicable !
32879/// // Values shown here are possibly random and not representative !
32880/// let mut req = ContentCategory::default();
32881///
32882/// // You can configure optional parameters by calling the respective setters at will, and
32883/// // execute the final call using `doit()`.
32884/// // Values shown here are possibly random and not representative !
32885/// let result = hub.content_categories().update(req, -11)
32886///              .doit().await;
32887/// # }
32888/// ```
32889pub struct ContentCategoryUpdateCall<'a, C>
32890where
32891    C: 'a,
32892{
32893    hub: &'a Dfareporting<C>,
32894    _request: ContentCategory,
32895    _profile_id: i64,
32896    _delegate: Option<&'a mut dyn common::Delegate>,
32897    _additional_params: HashMap<String, String>,
32898    _scopes: BTreeSet<String>,
32899}
32900
32901impl<'a, C> common::CallBuilder for ContentCategoryUpdateCall<'a, C> {}
32902
32903impl<'a, C> ContentCategoryUpdateCall<'a, C>
32904where
32905    C: common::Connector,
32906{
32907    /// Perform the operation you have build so far.
32908    pub async fn doit(mut self) -> common::Result<(common::Response, ContentCategory)> {
32909        use std::borrow::Cow;
32910        use std::io::{Read, Seek};
32911
32912        use common::{url::Params, ToParts};
32913        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32914
32915        let mut dd = common::DefaultDelegate;
32916        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32917        dlg.begin(common::MethodInfo {
32918            id: "dfareporting.contentCategories.update",
32919            http_method: hyper::Method::PUT,
32920        });
32921
32922        for &field in ["alt", "profileId"].iter() {
32923            if self._additional_params.contains_key(field) {
32924                dlg.finished(false);
32925                return Err(common::Error::FieldClash(field));
32926            }
32927        }
32928
32929        let mut params = Params::with_capacity(4 + self._additional_params.len());
32930        params.push("profileId", self._profile_id.to_string());
32931
32932        params.extend(self._additional_params.iter());
32933
32934        params.push("alt", "json");
32935        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/contentCategories";
32936        if self._scopes.is_empty() {
32937            self._scopes
32938                .insert(Scope::Dfatrafficking.as_ref().to_string());
32939        }
32940
32941        #[allow(clippy::single_element_loop)]
32942        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
32943            url = params.uri_replacement(url, param_name, find_this, false);
32944        }
32945        {
32946            let to_remove = ["profileId"];
32947            params.remove_params(&to_remove);
32948        }
32949
32950        let url = params.parse_with_url(&url);
32951
32952        let mut json_mime_type = mime::APPLICATION_JSON;
32953        let mut request_value_reader = {
32954            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
32955            common::remove_json_null_values(&mut value);
32956            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
32957            serde_json::to_writer(&mut dst, &value).unwrap();
32958            dst
32959        };
32960        let request_size = request_value_reader
32961            .seek(std::io::SeekFrom::End(0))
32962            .unwrap();
32963        request_value_reader
32964            .seek(std::io::SeekFrom::Start(0))
32965            .unwrap();
32966
32967        loop {
32968            let token = match self
32969                .hub
32970                .auth
32971                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
32972                .await
32973            {
32974                Ok(token) => token,
32975                Err(e) => match dlg.token(e) {
32976                    Ok(token) => token,
32977                    Err(e) => {
32978                        dlg.finished(false);
32979                        return Err(common::Error::MissingToken(e));
32980                    }
32981                },
32982            };
32983            request_value_reader
32984                .seek(std::io::SeekFrom::Start(0))
32985                .unwrap();
32986            let mut req_result = {
32987                let client = &self.hub.client;
32988                dlg.pre_request();
32989                let mut req_builder = hyper::Request::builder()
32990                    .method(hyper::Method::PUT)
32991                    .uri(url.as_str())
32992                    .header(USER_AGENT, self.hub._user_agent.clone());
32993
32994                if let Some(token) = token.as_ref() {
32995                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
32996                }
32997
32998                let request = req_builder
32999                    .header(CONTENT_TYPE, json_mime_type.to_string())
33000                    .header(CONTENT_LENGTH, request_size as u64)
33001                    .body(common::to_body(
33002                        request_value_reader.get_ref().clone().into(),
33003                    ));
33004
33005                client.request(request.unwrap()).await
33006            };
33007
33008            match req_result {
33009                Err(err) => {
33010                    if let common::Retry::After(d) = dlg.http_error(&err) {
33011                        sleep(d).await;
33012                        continue;
33013                    }
33014                    dlg.finished(false);
33015                    return Err(common::Error::HttpError(err));
33016                }
33017                Ok(res) => {
33018                    let (mut parts, body) = res.into_parts();
33019                    let mut body = common::Body::new(body);
33020                    if !parts.status.is_success() {
33021                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33022                        let error = serde_json::from_str(&common::to_string(&bytes));
33023                        let response = common::to_response(parts, bytes.into());
33024
33025                        if let common::Retry::After(d) =
33026                            dlg.http_failure(&response, error.as_ref().ok())
33027                        {
33028                            sleep(d).await;
33029                            continue;
33030                        }
33031
33032                        dlg.finished(false);
33033
33034                        return Err(match error {
33035                            Ok(value) => common::Error::BadRequest(value),
33036                            _ => common::Error::Failure(response),
33037                        });
33038                    }
33039                    let response = {
33040                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33041                        let encoded = common::to_string(&bytes);
33042                        match serde_json::from_str(&encoded) {
33043                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
33044                            Err(error) => {
33045                                dlg.response_json_decode_error(&encoded, &error);
33046                                return Err(common::Error::JsonDecodeError(
33047                                    encoded.to_string(),
33048                                    error,
33049                                ));
33050                            }
33051                        }
33052                    };
33053
33054                    dlg.finished(true);
33055                    return Ok(response);
33056                }
33057            }
33058        }
33059    }
33060
33061    ///
33062    /// Sets the *request* property to the given value.
33063    ///
33064    /// Even though the property as already been set when instantiating this call,
33065    /// we provide this method for API completeness.
33066    pub fn request(mut self, new_value: ContentCategory) -> ContentCategoryUpdateCall<'a, C> {
33067        self._request = new_value;
33068        self
33069    }
33070    /// User profile ID associated with this request.
33071    ///
33072    /// Sets the *profile id* path property to the given value.
33073    ///
33074    /// Even though the property as already been set when instantiating this call,
33075    /// we provide this method for API completeness.
33076    pub fn profile_id(mut self, new_value: i64) -> ContentCategoryUpdateCall<'a, C> {
33077        self._profile_id = new_value;
33078        self
33079    }
33080    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33081    /// while executing the actual API request.
33082    ///
33083    /// ````text
33084    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
33085    /// ````
33086    ///
33087    /// Sets the *delegate* property to the given value.
33088    pub fn delegate(
33089        mut self,
33090        new_value: &'a mut dyn common::Delegate,
33091    ) -> ContentCategoryUpdateCall<'a, C> {
33092        self._delegate = Some(new_value);
33093        self
33094    }
33095
33096    /// Set any additional parameter of the query string used in the request.
33097    /// It should be used to set parameters which are not yet available through their own
33098    /// setters.
33099    ///
33100    /// Please note that this method must not be used to set any of the known parameters
33101    /// which have their own setter method. If done anyway, the request will fail.
33102    ///
33103    /// # Additional Parameters
33104    ///
33105    /// * *$.xgafv* (query-string) - V1 error format.
33106    /// * *access_token* (query-string) - OAuth access token.
33107    /// * *alt* (query-string) - Data format for response.
33108    /// * *callback* (query-string) - JSONP
33109    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
33110    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
33111    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
33112    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
33113    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
33114    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
33115    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
33116    pub fn param<T>(mut self, name: T, value: T) -> ContentCategoryUpdateCall<'a, C>
33117    where
33118        T: AsRef<str>,
33119    {
33120        self._additional_params
33121            .insert(name.as_ref().to_string(), value.as_ref().to_string());
33122        self
33123    }
33124
33125    /// Identifies the authorization scope for the method you are building.
33126    ///
33127    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
33128    /// [`Scope::Dfatrafficking`].
33129    ///
33130    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
33131    /// tokens for more than one scope.
33132    ///
33133    /// Usually there is more than one suitable scope to authorize an operation, some of which may
33134    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
33135    /// sufficient, a read-write scope will do as well.
33136    pub fn add_scope<St>(mut self, scope: St) -> ContentCategoryUpdateCall<'a, C>
33137    where
33138        St: AsRef<str>,
33139    {
33140        self._scopes.insert(String::from(scope.as_ref()));
33141        self
33142    }
33143    /// Identifies the authorization scope(s) for the method you are building.
33144    ///
33145    /// See [`Self::add_scope()`] for details.
33146    pub fn add_scopes<I, St>(mut self, scopes: I) -> ContentCategoryUpdateCall<'a, C>
33147    where
33148        I: IntoIterator<Item = St>,
33149        St: AsRef<str>,
33150    {
33151        self._scopes
33152            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
33153        self
33154    }
33155
33156    /// Removes all scopes, and no default scope will be used either.
33157    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
33158    /// for details).
33159    pub fn clear_scopes(mut self) -> ContentCategoryUpdateCall<'a, C> {
33160        self._scopes.clear();
33161        self
33162    }
33163}
33164
33165/// Inserts conversions.
33166///
33167/// A builder for the *batchinsert* method supported by a *conversion* resource.
33168/// It is not used directly, but through a [`ConversionMethods`] instance.
33169///
33170/// # Example
33171///
33172/// Instantiate a resource method builder
33173///
33174/// ```test_harness,no_run
33175/// # extern crate hyper;
33176/// # extern crate hyper_rustls;
33177/// # extern crate google_dfareporting3d3 as dfareporting3d3;
33178/// use dfareporting3d3::api::ConversionsBatchInsertRequest;
33179/// # async fn dox() {
33180/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
33181///
33182/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
33183/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
33184/// #     secret,
33185/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
33186/// # ).build().await.unwrap();
33187///
33188/// # let client = hyper_util::client::legacy::Client::builder(
33189/// #     hyper_util::rt::TokioExecutor::new()
33190/// # )
33191/// # .build(
33192/// #     hyper_rustls::HttpsConnectorBuilder::new()
33193/// #         .with_native_roots()
33194/// #         .unwrap()
33195/// #         .https_or_http()
33196/// #         .enable_http1()
33197/// #         .build()
33198/// # );
33199/// # let mut hub = Dfareporting::new(client, auth);
33200/// // As the method needs a request, you would usually fill it with the desired information
33201/// // into the respective structure. Some of the parts shown here might not be applicable !
33202/// // Values shown here are possibly random and not representative !
33203/// let mut req = ConversionsBatchInsertRequest::default();
33204///
33205/// // You can configure optional parameters by calling the respective setters at will, and
33206/// // execute the final call using `doit()`.
33207/// // Values shown here are possibly random and not representative !
33208/// let result = hub.conversions().batchinsert(req, -91)
33209///              .doit().await;
33210/// # }
33211/// ```
33212pub struct ConversionBatchinsertCall<'a, C>
33213where
33214    C: 'a,
33215{
33216    hub: &'a Dfareporting<C>,
33217    _request: ConversionsBatchInsertRequest,
33218    _profile_id: i64,
33219    _delegate: Option<&'a mut dyn common::Delegate>,
33220    _additional_params: HashMap<String, String>,
33221    _scopes: BTreeSet<String>,
33222}
33223
33224impl<'a, C> common::CallBuilder for ConversionBatchinsertCall<'a, C> {}
33225
33226impl<'a, C> ConversionBatchinsertCall<'a, C>
33227where
33228    C: common::Connector,
33229{
33230    /// Perform the operation you have build so far.
33231    pub async fn doit(
33232        mut self,
33233    ) -> common::Result<(common::Response, ConversionsBatchInsertResponse)> {
33234        use std::borrow::Cow;
33235        use std::io::{Read, Seek};
33236
33237        use common::{url::Params, ToParts};
33238        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
33239
33240        let mut dd = common::DefaultDelegate;
33241        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
33242        dlg.begin(common::MethodInfo {
33243            id: "dfareporting.conversions.batchinsert",
33244            http_method: hyper::Method::POST,
33245        });
33246
33247        for &field in ["alt", "profileId"].iter() {
33248            if self._additional_params.contains_key(field) {
33249                dlg.finished(false);
33250                return Err(common::Error::FieldClash(field));
33251            }
33252        }
33253
33254        let mut params = Params::with_capacity(4 + self._additional_params.len());
33255        params.push("profileId", self._profile_id.to_string());
33256
33257        params.extend(self._additional_params.iter());
33258
33259        params.push("alt", "json");
33260        let mut url =
33261            self.hub._base_url.clone() + "userprofiles/{profileId}/conversions/batchinsert";
33262        if self._scopes.is_empty() {
33263            self._scopes
33264                .insert(Scope::Ddmconversion.as_ref().to_string());
33265        }
33266
33267        #[allow(clippy::single_element_loop)]
33268        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
33269            url = params.uri_replacement(url, param_name, find_this, false);
33270        }
33271        {
33272            let to_remove = ["profileId"];
33273            params.remove_params(&to_remove);
33274        }
33275
33276        let url = params.parse_with_url(&url);
33277
33278        let mut json_mime_type = mime::APPLICATION_JSON;
33279        let mut request_value_reader = {
33280            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
33281            common::remove_json_null_values(&mut value);
33282            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
33283            serde_json::to_writer(&mut dst, &value).unwrap();
33284            dst
33285        };
33286        let request_size = request_value_reader
33287            .seek(std::io::SeekFrom::End(0))
33288            .unwrap();
33289        request_value_reader
33290            .seek(std::io::SeekFrom::Start(0))
33291            .unwrap();
33292
33293        loop {
33294            let token = match self
33295                .hub
33296                .auth
33297                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
33298                .await
33299            {
33300                Ok(token) => token,
33301                Err(e) => match dlg.token(e) {
33302                    Ok(token) => token,
33303                    Err(e) => {
33304                        dlg.finished(false);
33305                        return Err(common::Error::MissingToken(e));
33306                    }
33307                },
33308            };
33309            request_value_reader
33310                .seek(std::io::SeekFrom::Start(0))
33311                .unwrap();
33312            let mut req_result = {
33313                let client = &self.hub.client;
33314                dlg.pre_request();
33315                let mut req_builder = hyper::Request::builder()
33316                    .method(hyper::Method::POST)
33317                    .uri(url.as_str())
33318                    .header(USER_AGENT, self.hub._user_agent.clone());
33319
33320                if let Some(token) = token.as_ref() {
33321                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
33322                }
33323
33324                let request = req_builder
33325                    .header(CONTENT_TYPE, json_mime_type.to_string())
33326                    .header(CONTENT_LENGTH, request_size as u64)
33327                    .body(common::to_body(
33328                        request_value_reader.get_ref().clone().into(),
33329                    ));
33330
33331                client.request(request.unwrap()).await
33332            };
33333
33334            match req_result {
33335                Err(err) => {
33336                    if let common::Retry::After(d) = dlg.http_error(&err) {
33337                        sleep(d).await;
33338                        continue;
33339                    }
33340                    dlg.finished(false);
33341                    return Err(common::Error::HttpError(err));
33342                }
33343                Ok(res) => {
33344                    let (mut parts, body) = res.into_parts();
33345                    let mut body = common::Body::new(body);
33346                    if !parts.status.is_success() {
33347                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33348                        let error = serde_json::from_str(&common::to_string(&bytes));
33349                        let response = common::to_response(parts, bytes.into());
33350
33351                        if let common::Retry::After(d) =
33352                            dlg.http_failure(&response, error.as_ref().ok())
33353                        {
33354                            sleep(d).await;
33355                            continue;
33356                        }
33357
33358                        dlg.finished(false);
33359
33360                        return Err(match error {
33361                            Ok(value) => common::Error::BadRequest(value),
33362                            _ => common::Error::Failure(response),
33363                        });
33364                    }
33365                    let response = {
33366                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33367                        let encoded = common::to_string(&bytes);
33368                        match serde_json::from_str(&encoded) {
33369                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
33370                            Err(error) => {
33371                                dlg.response_json_decode_error(&encoded, &error);
33372                                return Err(common::Error::JsonDecodeError(
33373                                    encoded.to_string(),
33374                                    error,
33375                                ));
33376                            }
33377                        }
33378                    };
33379
33380                    dlg.finished(true);
33381                    return Ok(response);
33382                }
33383            }
33384        }
33385    }
33386
33387    ///
33388    /// Sets the *request* property to the given value.
33389    ///
33390    /// Even though the property as already been set when instantiating this call,
33391    /// we provide this method for API completeness.
33392    pub fn request(
33393        mut self,
33394        new_value: ConversionsBatchInsertRequest,
33395    ) -> ConversionBatchinsertCall<'a, C> {
33396        self._request = new_value;
33397        self
33398    }
33399    /// User profile ID associated with this request.
33400    ///
33401    /// Sets the *profile id* path property to the given value.
33402    ///
33403    /// Even though the property as already been set when instantiating this call,
33404    /// we provide this method for API completeness.
33405    pub fn profile_id(mut self, new_value: i64) -> ConversionBatchinsertCall<'a, C> {
33406        self._profile_id = new_value;
33407        self
33408    }
33409    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33410    /// while executing the actual API request.
33411    ///
33412    /// ````text
33413    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
33414    /// ````
33415    ///
33416    /// Sets the *delegate* property to the given value.
33417    pub fn delegate(
33418        mut self,
33419        new_value: &'a mut dyn common::Delegate,
33420    ) -> ConversionBatchinsertCall<'a, C> {
33421        self._delegate = Some(new_value);
33422        self
33423    }
33424
33425    /// Set any additional parameter of the query string used in the request.
33426    /// It should be used to set parameters which are not yet available through their own
33427    /// setters.
33428    ///
33429    /// Please note that this method must not be used to set any of the known parameters
33430    /// which have their own setter method. If done anyway, the request will fail.
33431    ///
33432    /// # Additional Parameters
33433    ///
33434    /// * *$.xgafv* (query-string) - V1 error format.
33435    /// * *access_token* (query-string) - OAuth access token.
33436    /// * *alt* (query-string) - Data format for response.
33437    /// * *callback* (query-string) - JSONP
33438    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
33439    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
33440    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
33441    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
33442    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
33443    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
33444    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
33445    pub fn param<T>(mut self, name: T, value: T) -> ConversionBatchinsertCall<'a, C>
33446    where
33447        T: AsRef<str>,
33448    {
33449        self._additional_params
33450            .insert(name.as_ref().to_string(), value.as_ref().to_string());
33451        self
33452    }
33453
33454    /// Identifies the authorization scope for the method you are building.
33455    ///
33456    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
33457    /// [`Scope::Ddmconversion`].
33458    ///
33459    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
33460    /// tokens for more than one scope.
33461    ///
33462    /// Usually there is more than one suitable scope to authorize an operation, some of which may
33463    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
33464    /// sufficient, a read-write scope will do as well.
33465    pub fn add_scope<St>(mut self, scope: St) -> ConversionBatchinsertCall<'a, C>
33466    where
33467        St: AsRef<str>,
33468    {
33469        self._scopes.insert(String::from(scope.as_ref()));
33470        self
33471    }
33472    /// Identifies the authorization scope(s) for the method you are building.
33473    ///
33474    /// See [`Self::add_scope()`] for details.
33475    pub fn add_scopes<I, St>(mut self, scopes: I) -> ConversionBatchinsertCall<'a, C>
33476    where
33477        I: IntoIterator<Item = St>,
33478        St: AsRef<str>,
33479    {
33480        self._scopes
33481            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
33482        self
33483    }
33484
33485    /// Removes all scopes, and no default scope will be used either.
33486    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
33487    /// for details).
33488    pub fn clear_scopes(mut self) -> ConversionBatchinsertCall<'a, C> {
33489        self._scopes.clear();
33490        self
33491    }
33492}
33493
33494/// Updates existing conversions.
33495///
33496/// A builder for the *batchupdate* method supported by a *conversion* resource.
33497/// It is not used directly, but through a [`ConversionMethods`] instance.
33498///
33499/// # Example
33500///
33501/// Instantiate a resource method builder
33502///
33503/// ```test_harness,no_run
33504/// # extern crate hyper;
33505/// # extern crate hyper_rustls;
33506/// # extern crate google_dfareporting3d3 as dfareporting3d3;
33507/// use dfareporting3d3::api::ConversionsBatchUpdateRequest;
33508/// # async fn dox() {
33509/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
33510///
33511/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
33512/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
33513/// #     secret,
33514/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
33515/// # ).build().await.unwrap();
33516///
33517/// # let client = hyper_util::client::legacy::Client::builder(
33518/// #     hyper_util::rt::TokioExecutor::new()
33519/// # )
33520/// # .build(
33521/// #     hyper_rustls::HttpsConnectorBuilder::new()
33522/// #         .with_native_roots()
33523/// #         .unwrap()
33524/// #         .https_or_http()
33525/// #         .enable_http1()
33526/// #         .build()
33527/// # );
33528/// # let mut hub = Dfareporting::new(client, auth);
33529/// // As the method needs a request, you would usually fill it with the desired information
33530/// // into the respective structure. Some of the parts shown here might not be applicable !
33531/// // Values shown here are possibly random and not representative !
33532/// let mut req = ConversionsBatchUpdateRequest::default();
33533///
33534/// // You can configure optional parameters by calling the respective setters at will, and
33535/// // execute the final call using `doit()`.
33536/// // Values shown here are possibly random and not representative !
33537/// let result = hub.conversions().batchupdate(req, -43)
33538///              .doit().await;
33539/// # }
33540/// ```
33541pub struct ConversionBatchupdateCall<'a, C>
33542where
33543    C: 'a,
33544{
33545    hub: &'a Dfareporting<C>,
33546    _request: ConversionsBatchUpdateRequest,
33547    _profile_id: i64,
33548    _delegate: Option<&'a mut dyn common::Delegate>,
33549    _additional_params: HashMap<String, String>,
33550    _scopes: BTreeSet<String>,
33551}
33552
33553impl<'a, C> common::CallBuilder for ConversionBatchupdateCall<'a, C> {}
33554
33555impl<'a, C> ConversionBatchupdateCall<'a, C>
33556where
33557    C: common::Connector,
33558{
33559    /// Perform the operation you have build so far.
33560    pub async fn doit(
33561        mut self,
33562    ) -> common::Result<(common::Response, ConversionsBatchUpdateResponse)> {
33563        use std::borrow::Cow;
33564        use std::io::{Read, Seek};
33565
33566        use common::{url::Params, ToParts};
33567        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
33568
33569        let mut dd = common::DefaultDelegate;
33570        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
33571        dlg.begin(common::MethodInfo {
33572            id: "dfareporting.conversions.batchupdate",
33573            http_method: hyper::Method::POST,
33574        });
33575
33576        for &field in ["alt", "profileId"].iter() {
33577            if self._additional_params.contains_key(field) {
33578                dlg.finished(false);
33579                return Err(common::Error::FieldClash(field));
33580            }
33581        }
33582
33583        let mut params = Params::with_capacity(4 + self._additional_params.len());
33584        params.push("profileId", self._profile_id.to_string());
33585
33586        params.extend(self._additional_params.iter());
33587
33588        params.push("alt", "json");
33589        let mut url =
33590            self.hub._base_url.clone() + "userprofiles/{profileId}/conversions/batchupdate";
33591        if self._scopes.is_empty() {
33592            self._scopes
33593                .insert(Scope::Ddmconversion.as_ref().to_string());
33594        }
33595
33596        #[allow(clippy::single_element_loop)]
33597        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
33598            url = params.uri_replacement(url, param_name, find_this, false);
33599        }
33600        {
33601            let to_remove = ["profileId"];
33602            params.remove_params(&to_remove);
33603        }
33604
33605        let url = params.parse_with_url(&url);
33606
33607        let mut json_mime_type = mime::APPLICATION_JSON;
33608        let mut request_value_reader = {
33609            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
33610            common::remove_json_null_values(&mut value);
33611            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
33612            serde_json::to_writer(&mut dst, &value).unwrap();
33613            dst
33614        };
33615        let request_size = request_value_reader
33616            .seek(std::io::SeekFrom::End(0))
33617            .unwrap();
33618        request_value_reader
33619            .seek(std::io::SeekFrom::Start(0))
33620            .unwrap();
33621
33622        loop {
33623            let token = match self
33624                .hub
33625                .auth
33626                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
33627                .await
33628            {
33629                Ok(token) => token,
33630                Err(e) => match dlg.token(e) {
33631                    Ok(token) => token,
33632                    Err(e) => {
33633                        dlg.finished(false);
33634                        return Err(common::Error::MissingToken(e));
33635                    }
33636                },
33637            };
33638            request_value_reader
33639                .seek(std::io::SeekFrom::Start(0))
33640                .unwrap();
33641            let mut req_result = {
33642                let client = &self.hub.client;
33643                dlg.pre_request();
33644                let mut req_builder = hyper::Request::builder()
33645                    .method(hyper::Method::POST)
33646                    .uri(url.as_str())
33647                    .header(USER_AGENT, self.hub._user_agent.clone());
33648
33649                if let Some(token) = token.as_ref() {
33650                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
33651                }
33652
33653                let request = req_builder
33654                    .header(CONTENT_TYPE, json_mime_type.to_string())
33655                    .header(CONTENT_LENGTH, request_size as u64)
33656                    .body(common::to_body(
33657                        request_value_reader.get_ref().clone().into(),
33658                    ));
33659
33660                client.request(request.unwrap()).await
33661            };
33662
33663            match req_result {
33664                Err(err) => {
33665                    if let common::Retry::After(d) = dlg.http_error(&err) {
33666                        sleep(d).await;
33667                        continue;
33668                    }
33669                    dlg.finished(false);
33670                    return Err(common::Error::HttpError(err));
33671                }
33672                Ok(res) => {
33673                    let (mut parts, body) = res.into_parts();
33674                    let mut body = common::Body::new(body);
33675                    if !parts.status.is_success() {
33676                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33677                        let error = serde_json::from_str(&common::to_string(&bytes));
33678                        let response = common::to_response(parts, bytes.into());
33679
33680                        if let common::Retry::After(d) =
33681                            dlg.http_failure(&response, error.as_ref().ok())
33682                        {
33683                            sleep(d).await;
33684                            continue;
33685                        }
33686
33687                        dlg.finished(false);
33688
33689                        return Err(match error {
33690                            Ok(value) => common::Error::BadRequest(value),
33691                            _ => common::Error::Failure(response),
33692                        });
33693                    }
33694                    let response = {
33695                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33696                        let encoded = common::to_string(&bytes);
33697                        match serde_json::from_str(&encoded) {
33698                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
33699                            Err(error) => {
33700                                dlg.response_json_decode_error(&encoded, &error);
33701                                return Err(common::Error::JsonDecodeError(
33702                                    encoded.to_string(),
33703                                    error,
33704                                ));
33705                            }
33706                        }
33707                    };
33708
33709                    dlg.finished(true);
33710                    return Ok(response);
33711                }
33712            }
33713        }
33714    }
33715
33716    ///
33717    /// Sets the *request* property to the given value.
33718    ///
33719    /// Even though the property as already been set when instantiating this call,
33720    /// we provide this method for API completeness.
33721    pub fn request(
33722        mut self,
33723        new_value: ConversionsBatchUpdateRequest,
33724    ) -> ConversionBatchupdateCall<'a, C> {
33725        self._request = new_value;
33726        self
33727    }
33728    /// User profile ID associated with this request.
33729    ///
33730    /// Sets the *profile id* path property to the given value.
33731    ///
33732    /// Even though the property as already been set when instantiating this call,
33733    /// we provide this method for API completeness.
33734    pub fn profile_id(mut self, new_value: i64) -> ConversionBatchupdateCall<'a, C> {
33735        self._profile_id = new_value;
33736        self
33737    }
33738    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33739    /// while executing the actual API request.
33740    ///
33741    /// ````text
33742    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
33743    /// ````
33744    ///
33745    /// Sets the *delegate* property to the given value.
33746    pub fn delegate(
33747        mut self,
33748        new_value: &'a mut dyn common::Delegate,
33749    ) -> ConversionBatchupdateCall<'a, C> {
33750        self._delegate = Some(new_value);
33751        self
33752    }
33753
33754    /// Set any additional parameter of the query string used in the request.
33755    /// It should be used to set parameters which are not yet available through their own
33756    /// setters.
33757    ///
33758    /// Please note that this method must not be used to set any of the known parameters
33759    /// which have their own setter method. If done anyway, the request will fail.
33760    ///
33761    /// # Additional Parameters
33762    ///
33763    /// * *$.xgafv* (query-string) - V1 error format.
33764    /// * *access_token* (query-string) - OAuth access token.
33765    /// * *alt* (query-string) - Data format for response.
33766    /// * *callback* (query-string) - JSONP
33767    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
33768    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
33769    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
33770    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
33771    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
33772    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
33773    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
33774    pub fn param<T>(mut self, name: T, value: T) -> ConversionBatchupdateCall<'a, C>
33775    where
33776        T: AsRef<str>,
33777    {
33778        self._additional_params
33779            .insert(name.as_ref().to_string(), value.as_ref().to_string());
33780        self
33781    }
33782
33783    /// Identifies the authorization scope for the method you are building.
33784    ///
33785    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
33786    /// [`Scope::Ddmconversion`].
33787    ///
33788    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
33789    /// tokens for more than one scope.
33790    ///
33791    /// Usually there is more than one suitable scope to authorize an operation, some of which may
33792    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
33793    /// sufficient, a read-write scope will do as well.
33794    pub fn add_scope<St>(mut self, scope: St) -> ConversionBatchupdateCall<'a, C>
33795    where
33796        St: AsRef<str>,
33797    {
33798        self._scopes.insert(String::from(scope.as_ref()));
33799        self
33800    }
33801    /// Identifies the authorization scope(s) for the method you are building.
33802    ///
33803    /// See [`Self::add_scope()`] for details.
33804    pub fn add_scopes<I, St>(mut self, scopes: I) -> ConversionBatchupdateCall<'a, C>
33805    where
33806        I: IntoIterator<Item = St>,
33807        St: AsRef<str>,
33808    {
33809        self._scopes
33810            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
33811        self
33812    }
33813
33814    /// Removes all scopes, and no default scope will be used either.
33815    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
33816    /// for details).
33817    pub fn clear_scopes(mut self) -> ConversionBatchupdateCall<'a, C> {
33818        self._scopes.clear();
33819        self
33820    }
33821}
33822
33823/// Gets one country by ID.
33824///
33825/// A builder for the *get* method supported by a *country* resource.
33826/// It is not used directly, but through a [`CountryMethods`] instance.
33827///
33828/// # Example
33829///
33830/// Instantiate a resource method builder
33831///
33832/// ```test_harness,no_run
33833/// # extern crate hyper;
33834/// # extern crate hyper_rustls;
33835/// # extern crate google_dfareporting3d3 as dfareporting3d3;
33836/// # async fn dox() {
33837/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
33838///
33839/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
33840/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
33841/// #     secret,
33842/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
33843/// # ).build().await.unwrap();
33844///
33845/// # let client = hyper_util::client::legacy::Client::builder(
33846/// #     hyper_util::rt::TokioExecutor::new()
33847/// # )
33848/// # .build(
33849/// #     hyper_rustls::HttpsConnectorBuilder::new()
33850/// #         .with_native_roots()
33851/// #         .unwrap()
33852/// #         .https_or_http()
33853/// #         .enable_http1()
33854/// #         .build()
33855/// # );
33856/// # let mut hub = Dfareporting::new(client, auth);
33857/// // You can configure optional parameters by calling the respective setters at will, and
33858/// // execute the final call using `doit()`.
33859/// // Values shown here are possibly random and not representative !
33860/// let result = hub.countries().get(-13, -101)
33861///              .doit().await;
33862/// # }
33863/// ```
33864pub struct CountryGetCall<'a, C>
33865where
33866    C: 'a,
33867{
33868    hub: &'a Dfareporting<C>,
33869    _profile_id: i64,
33870    _dart_id: i64,
33871    _delegate: Option<&'a mut dyn common::Delegate>,
33872    _additional_params: HashMap<String, String>,
33873    _scopes: BTreeSet<String>,
33874}
33875
33876impl<'a, C> common::CallBuilder for CountryGetCall<'a, C> {}
33877
33878impl<'a, C> CountryGetCall<'a, C>
33879where
33880    C: common::Connector,
33881{
33882    /// Perform the operation you have build so far.
33883    pub async fn doit(mut self) -> common::Result<(common::Response, Country)> {
33884        use std::borrow::Cow;
33885        use std::io::{Read, Seek};
33886
33887        use common::{url::Params, ToParts};
33888        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
33889
33890        let mut dd = common::DefaultDelegate;
33891        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
33892        dlg.begin(common::MethodInfo {
33893            id: "dfareporting.countries.get",
33894            http_method: hyper::Method::GET,
33895        });
33896
33897        for &field in ["alt", "profileId", "dartId"].iter() {
33898            if self._additional_params.contains_key(field) {
33899                dlg.finished(false);
33900                return Err(common::Error::FieldClash(field));
33901            }
33902        }
33903
33904        let mut params = Params::with_capacity(4 + self._additional_params.len());
33905        params.push("profileId", self._profile_id.to_string());
33906        params.push("dartId", self._dart_id.to_string());
33907
33908        params.extend(self._additional_params.iter());
33909
33910        params.push("alt", "json");
33911        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/countries/{dartId}";
33912        if self._scopes.is_empty() {
33913            self._scopes
33914                .insert(Scope::Dfatrafficking.as_ref().to_string());
33915        }
33916
33917        #[allow(clippy::single_element_loop)]
33918        for &(find_this, param_name) in
33919            [("{profileId}", "profileId"), ("{dartId}", "dartId")].iter()
33920        {
33921            url = params.uri_replacement(url, param_name, find_this, false);
33922        }
33923        {
33924            let to_remove = ["dartId", "profileId"];
33925            params.remove_params(&to_remove);
33926        }
33927
33928        let url = params.parse_with_url(&url);
33929
33930        loop {
33931            let token = match self
33932                .hub
33933                .auth
33934                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
33935                .await
33936            {
33937                Ok(token) => token,
33938                Err(e) => match dlg.token(e) {
33939                    Ok(token) => token,
33940                    Err(e) => {
33941                        dlg.finished(false);
33942                        return Err(common::Error::MissingToken(e));
33943                    }
33944                },
33945            };
33946            let mut req_result = {
33947                let client = &self.hub.client;
33948                dlg.pre_request();
33949                let mut req_builder = hyper::Request::builder()
33950                    .method(hyper::Method::GET)
33951                    .uri(url.as_str())
33952                    .header(USER_AGENT, self.hub._user_agent.clone());
33953
33954                if let Some(token) = token.as_ref() {
33955                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
33956                }
33957
33958                let request = req_builder
33959                    .header(CONTENT_LENGTH, 0_u64)
33960                    .body(common::to_body::<String>(None));
33961
33962                client.request(request.unwrap()).await
33963            };
33964
33965            match req_result {
33966                Err(err) => {
33967                    if let common::Retry::After(d) = dlg.http_error(&err) {
33968                        sleep(d).await;
33969                        continue;
33970                    }
33971                    dlg.finished(false);
33972                    return Err(common::Error::HttpError(err));
33973                }
33974                Ok(res) => {
33975                    let (mut parts, body) = res.into_parts();
33976                    let mut body = common::Body::new(body);
33977                    if !parts.status.is_success() {
33978                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33979                        let error = serde_json::from_str(&common::to_string(&bytes));
33980                        let response = common::to_response(parts, bytes.into());
33981
33982                        if let common::Retry::After(d) =
33983                            dlg.http_failure(&response, error.as_ref().ok())
33984                        {
33985                            sleep(d).await;
33986                            continue;
33987                        }
33988
33989                        dlg.finished(false);
33990
33991                        return Err(match error {
33992                            Ok(value) => common::Error::BadRequest(value),
33993                            _ => common::Error::Failure(response),
33994                        });
33995                    }
33996                    let response = {
33997                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33998                        let encoded = common::to_string(&bytes);
33999                        match serde_json::from_str(&encoded) {
34000                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
34001                            Err(error) => {
34002                                dlg.response_json_decode_error(&encoded, &error);
34003                                return Err(common::Error::JsonDecodeError(
34004                                    encoded.to_string(),
34005                                    error,
34006                                ));
34007                            }
34008                        }
34009                    };
34010
34011                    dlg.finished(true);
34012                    return Ok(response);
34013                }
34014            }
34015        }
34016    }
34017
34018    /// User profile ID associated with this request.
34019    ///
34020    /// Sets the *profile id* path property to the given value.
34021    ///
34022    /// Even though the property as already been set when instantiating this call,
34023    /// we provide this method for API completeness.
34024    pub fn profile_id(mut self, new_value: i64) -> CountryGetCall<'a, C> {
34025        self._profile_id = new_value;
34026        self
34027    }
34028    /// Country DART ID.
34029    ///
34030    /// Sets the *dart id* path property to the given value.
34031    ///
34032    /// Even though the property as already been set when instantiating this call,
34033    /// we provide this method for API completeness.
34034    pub fn dart_id(mut self, new_value: i64) -> CountryGetCall<'a, C> {
34035        self._dart_id = new_value;
34036        self
34037    }
34038    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34039    /// while executing the actual API request.
34040    ///
34041    /// ````text
34042    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
34043    /// ````
34044    ///
34045    /// Sets the *delegate* property to the given value.
34046    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> CountryGetCall<'a, C> {
34047        self._delegate = Some(new_value);
34048        self
34049    }
34050
34051    /// Set any additional parameter of the query string used in the request.
34052    /// It should be used to set parameters which are not yet available through their own
34053    /// setters.
34054    ///
34055    /// Please note that this method must not be used to set any of the known parameters
34056    /// which have their own setter method. If done anyway, the request will fail.
34057    ///
34058    /// # Additional Parameters
34059    ///
34060    /// * *$.xgafv* (query-string) - V1 error format.
34061    /// * *access_token* (query-string) - OAuth access token.
34062    /// * *alt* (query-string) - Data format for response.
34063    /// * *callback* (query-string) - JSONP
34064    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34065    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
34066    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34067    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34068    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
34069    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34070    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34071    pub fn param<T>(mut self, name: T, value: T) -> CountryGetCall<'a, C>
34072    where
34073        T: AsRef<str>,
34074    {
34075        self._additional_params
34076            .insert(name.as_ref().to_string(), value.as_ref().to_string());
34077        self
34078    }
34079
34080    /// Identifies the authorization scope for the method you are building.
34081    ///
34082    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
34083    /// [`Scope::Dfatrafficking`].
34084    ///
34085    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
34086    /// tokens for more than one scope.
34087    ///
34088    /// Usually there is more than one suitable scope to authorize an operation, some of which may
34089    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
34090    /// sufficient, a read-write scope will do as well.
34091    pub fn add_scope<St>(mut self, scope: St) -> CountryGetCall<'a, C>
34092    where
34093        St: AsRef<str>,
34094    {
34095        self._scopes.insert(String::from(scope.as_ref()));
34096        self
34097    }
34098    /// Identifies the authorization scope(s) for the method you are building.
34099    ///
34100    /// See [`Self::add_scope()`] for details.
34101    pub fn add_scopes<I, St>(mut self, scopes: I) -> CountryGetCall<'a, C>
34102    where
34103        I: IntoIterator<Item = St>,
34104        St: AsRef<str>,
34105    {
34106        self._scopes
34107            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
34108        self
34109    }
34110
34111    /// Removes all scopes, and no default scope will be used either.
34112    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34113    /// for details).
34114    pub fn clear_scopes(mut self) -> CountryGetCall<'a, C> {
34115        self._scopes.clear();
34116        self
34117    }
34118}
34119
34120/// Retrieves a list of countries.
34121///
34122/// A builder for the *list* method supported by a *country* resource.
34123/// It is not used directly, but through a [`CountryMethods`] instance.
34124///
34125/// # Example
34126///
34127/// Instantiate a resource method builder
34128///
34129/// ```test_harness,no_run
34130/// # extern crate hyper;
34131/// # extern crate hyper_rustls;
34132/// # extern crate google_dfareporting3d3 as dfareporting3d3;
34133/// # async fn dox() {
34134/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
34135///
34136/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
34137/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
34138/// #     secret,
34139/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
34140/// # ).build().await.unwrap();
34141///
34142/// # let client = hyper_util::client::legacy::Client::builder(
34143/// #     hyper_util::rt::TokioExecutor::new()
34144/// # )
34145/// # .build(
34146/// #     hyper_rustls::HttpsConnectorBuilder::new()
34147/// #         .with_native_roots()
34148/// #         .unwrap()
34149/// #         .https_or_http()
34150/// #         .enable_http1()
34151/// #         .build()
34152/// # );
34153/// # let mut hub = Dfareporting::new(client, auth);
34154/// // You can configure optional parameters by calling the respective setters at will, and
34155/// // execute the final call using `doit()`.
34156/// // Values shown here are possibly random and not representative !
34157/// let result = hub.countries().list(-58)
34158///              .doit().await;
34159/// # }
34160/// ```
34161pub struct CountryListCall<'a, C>
34162where
34163    C: 'a,
34164{
34165    hub: &'a Dfareporting<C>,
34166    _profile_id: i64,
34167    _delegate: Option<&'a mut dyn common::Delegate>,
34168    _additional_params: HashMap<String, String>,
34169    _scopes: BTreeSet<String>,
34170}
34171
34172impl<'a, C> common::CallBuilder for CountryListCall<'a, C> {}
34173
34174impl<'a, C> CountryListCall<'a, C>
34175where
34176    C: common::Connector,
34177{
34178    /// Perform the operation you have build so far.
34179    pub async fn doit(mut self) -> common::Result<(common::Response, CountriesListResponse)> {
34180        use std::borrow::Cow;
34181        use std::io::{Read, Seek};
34182
34183        use common::{url::Params, ToParts};
34184        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
34185
34186        let mut dd = common::DefaultDelegate;
34187        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
34188        dlg.begin(common::MethodInfo {
34189            id: "dfareporting.countries.list",
34190            http_method: hyper::Method::GET,
34191        });
34192
34193        for &field in ["alt", "profileId"].iter() {
34194            if self._additional_params.contains_key(field) {
34195                dlg.finished(false);
34196                return Err(common::Error::FieldClash(field));
34197            }
34198        }
34199
34200        let mut params = Params::with_capacity(3 + self._additional_params.len());
34201        params.push("profileId", self._profile_id.to_string());
34202
34203        params.extend(self._additional_params.iter());
34204
34205        params.push("alt", "json");
34206        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/countries";
34207        if self._scopes.is_empty() {
34208            self._scopes
34209                .insert(Scope::Dfatrafficking.as_ref().to_string());
34210        }
34211
34212        #[allow(clippy::single_element_loop)]
34213        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
34214            url = params.uri_replacement(url, param_name, find_this, false);
34215        }
34216        {
34217            let to_remove = ["profileId"];
34218            params.remove_params(&to_remove);
34219        }
34220
34221        let url = params.parse_with_url(&url);
34222
34223        loop {
34224            let token = match self
34225                .hub
34226                .auth
34227                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
34228                .await
34229            {
34230                Ok(token) => token,
34231                Err(e) => match dlg.token(e) {
34232                    Ok(token) => token,
34233                    Err(e) => {
34234                        dlg.finished(false);
34235                        return Err(common::Error::MissingToken(e));
34236                    }
34237                },
34238            };
34239            let mut req_result = {
34240                let client = &self.hub.client;
34241                dlg.pre_request();
34242                let mut req_builder = hyper::Request::builder()
34243                    .method(hyper::Method::GET)
34244                    .uri(url.as_str())
34245                    .header(USER_AGENT, self.hub._user_agent.clone());
34246
34247                if let Some(token) = token.as_ref() {
34248                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
34249                }
34250
34251                let request = req_builder
34252                    .header(CONTENT_LENGTH, 0_u64)
34253                    .body(common::to_body::<String>(None));
34254
34255                client.request(request.unwrap()).await
34256            };
34257
34258            match req_result {
34259                Err(err) => {
34260                    if let common::Retry::After(d) = dlg.http_error(&err) {
34261                        sleep(d).await;
34262                        continue;
34263                    }
34264                    dlg.finished(false);
34265                    return Err(common::Error::HttpError(err));
34266                }
34267                Ok(res) => {
34268                    let (mut parts, body) = res.into_parts();
34269                    let mut body = common::Body::new(body);
34270                    if !parts.status.is_success() {
34271                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34272                        let error = serde_json::from_str(&common::to_string(&bytes));
34273                        let response = common::to_response(parts, bytes.into());
34274
34275                        if let common::Retry::After(d) =
34276                            dlg.http_failure(&response, error.as_ref().ok())
34277                        {
34278                            sleep(d).await;
34279                            continue;
34280                        }
34281
34282                        dlg.finished(false);
34283
34284                        return Err(match error {
34285                            Ok(value) => common::Error::BadRequest(value),
34286                            _ => common::Error::Failure(response),
34287                        });
34288                    }
34289                    let response = {
34290                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34291                        let encoded = common::to_string(&bytes);
34292                        match serde_json::from_str(&encoded) {
34293                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
34294                            Err(error) => {
34295                                dlg.response_json_decode_error(&encoded, &error);
34296                                return Err(common::Error::JsonDecodeError(
34297                                    encoded.to_string(),
34298                                    error,
34299                                ));
34300                            }
34301                        }
34302                    };
34303
34304                    dlg.finished(true);
34305                    return Ok(response);
34306                }
34307            }
34308        }
34309    }
34310
34311    /// User profile ID associated with this request.
34312    ///
34313    /// Sets the *profile id* path property to the given value.
34314    ///
34315    /// Even though the property as already been set when instantiating this call,
34316    /// we provide this method for API completeness.
34317    pub fn profile_id(mut self, new_value: i64) -> CountryListCall<'a, C> {
34318        self._profile_id = new_value;
34319        self
34320    }
34321    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34322    /// while executing the actual API request.
34323    ///
34324    /// ````text
34325    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
34326    /// ````
34327    ///
34328    /// Sets the *delegate* property to the given value.
34329    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> CountryListCall<'a, C> {
34330        self._delegate = Some(new_value);
34331        self
34332    }
34333
34334    /// Set any additional parameter of the query string used in the request.
34335    /// It should be used to set parameters which are not yet available through their own
34336    /// setters.
34337    ///
34338    /// Please note that this method must not be used to set any of the known parameters
34339    /// which have their own setter method. If done anyway, the request will fail.
34340    ///
34341    /// # Additional Parameters
34342    ///
34343    /// * *$.xgafv* (query-string) - V1 error format.
34344    /// * *access_token* (query-string) - OAuth access token.
34345    /// * *alt* (query-string) - Data format for response.
34346    /// * *callback* (query-string) - JSONP
34347    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34348    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
34349    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34350    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34351    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
34352    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34353    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34354    pub fn param<T>(mut self, name: T, value: T) -> CountryListCall<'a, C>
34355    where
34356        T: AsRef<str>,
34357    {
34358        self._additional_params
34359            .insert(name.as_ref().to_string(), value.as_ref().to_string());
34360        self
34361    }
34362
34363    /// Identifies the authorization scope for the method you are building.
34364    ///
34365    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
34366    /// [`Scope::Dfatrafficking`].
34367    ///
34368    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
34369    /// tokens for more than one scope.
34370    ///
34371    /// Usually there is more than one suitable scope to authorize an operation, some of which may
34372    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
34373    /// sufficient, a read-write scope will do as well.
34374    pub fn add_scope<St>(mut self, scope: St) -> CountryListCall<'a, C>
34375    where
34376        St: AsRef<str>,
34377    {
34378        self._scopes.insert(String::from(scope.as_ref()));
34379        self
34380    }
34381    /// Identifies the authorization scope(s) for the method you are building.
34382    ///
34383    /// See [`Self::add_scope()`] for details.
34384    pub fn add_scopes<I, St>(mut self, scopes: I) -> CountryListCall<'a, C>
34385    where
34386        I: IntoIterator<Item = St>,
34387        St: AsRef<str>,
34388    {
34389        self._scopes
34390            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
34391        self
34392    }
34393
34394    /// Removes all scopes, and no default scope will be used either.
34395    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34396    /// for details).
34397    pub fn clear_scopes(mut self) -> CountryListCall<'a, C> {
34398        self._scopes.clear();
34399        self
34400    }
34401}
34402
34403/// Inserts a new creative asset.
34404///
34405/// A builder for the *insert* method supported by a *creativeAsset* resource.
34406/// It is not used directly, but through a [`CreativeAssetMethods`] instance.
34407///
34408/// # Example
34409///
34410/// Instantiate a resource method builder
34411///
34412/// ```test_harness,no_run
34413/// # extern crate hyper;
34414/// # extern crate hyper_rustls;
34415/// # extern crate google_dfareporting3d3 as dfareporting3d3;
34416/// use dfareporting3d3::api::CreativeAssetMetadata;
34417/// use std::fs;
34418/// # async fn dox() {
34419/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
34420///
34421/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
34422/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
34423/// #     secret,
34424/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
34425/// # ).build().await.unwrap();
34426///
34427/// # let client = hyper_util::client::legacy::Client::builder(
34428/// #     hyper_util::rt::TokioExecutor::new()
34429/// # )
34430/// # .build(
34431/// #     hyper_rustls::HttpsConnectorBuilder::new()
34432/// #         .with_native_roots()
34433/// #         .unwrap()
34434/// #         .https_or_http()
34435/// #         .enable_http1()
34436/// #         .build()
34437/// # );
34438/// # let mut hub = Dfareporting::new(client, auth);
34439/// // As the method needs a request, you would usually fill it with the desired information
34440/// // into the respective structure. Some of the parts shown here might not be applicable !
34441/// // Values shown here are possibly random and not representative !
34442/// let mut req = CreativeAssetMetadata::default();
34443///
34444/// // You can configure optional parameters by calling the respective setters at will, and
34445/// // execute the final call using `upload(...)`.
34446/// // Values shown here are possibly random and not representative !
34447/// let result = hub.creative_assets().insert(req, -91, -66)
34448///              .upload(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()).await;
34449/// # }
34450/// ```
34451pub struct CreativeAssetInsertCall<'a, C>
34452where
34453    C: 'a,
34454{
34455    hub: &'a Dfareporting<C>,
34456    _request: CreativeAssetMetadata,
34457    _profile_id: i64,
34458    _advertiser_id: i64,
34459    _delegate: Option<&'a mut dyn common::Delegate>,
34460    _additional_params: HashMap<String, String>,
34461    _scopes: BTreeSet<String>,
34462}
34463
34464impl<'a, C> common::CallBuilder for CreativeAssetInsertCall<'a, C> {}
34465
34466impl<'a, C> CreativeAssetInsertCall<'a, C>
34467where
34468    C: common::Connector,
34469{
34470    /// Perform the operation you have build so far.
34471    async fn doit<RS>(
34472        mut self,
34473        mut reader: RS,
34474        reader_mime_type: mime::Mime,
34475        protocol: common::UploadProtocol,
34476    ) -> common::Result<(common::Response, CreativeAssetMetadata)>
34477    where
34478        RS: common::ReadSeek,
34479    {
34480        use std::borrow::Cow;
34481        use std::io::{Read, Seek};
34482
34483        use common::{url::Params, ToParts};
34484        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
34485
34486        let mut dd = common::DefaultDelegate;
34487        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
34488        dlg.begin(common::MethodInfo {
34489            id: "dfareporting.creativeAssets.insert",
34490            http_method: hyper::Method::POST,
34491        });
34492
34493        for &field in ["alt", "profileId", "advertiserId"].iter() {
34494            if self._additional_params.contains_key(field) {
34495                dlg.finished(false);
34496                return Err(common::Error::FieldClash(field));
34497            }
34498        }
34499
34500        let mut params = Params::with_capacity(5 + self._additional_params.len());
34501        params.push("profileId", self._profile_id.to_string());
34502        params.push("advertiserId", self._advertiser_id.to_string());
34503
34504        params.extend(self._additional_params.iter());
34505
34506        params.push("alt", "json");
34507        let (mut url, upload_type) = if protocol == common::UploadProtocol::Simple {
34508            (self.hub._root_url.clone() + "upload/dfareporting/v3.3/userprofiles/{profileId}/creativeAssets/{advertiserId}/creativeAssets", "multipart")
34509        } else {
34510            unreachable!()
34511        };
34512        params.push("uploadType", upload_type);
34513        if self._scopes.is_empty() {
34514            self._scopes
34515                .insert(Scope::Dfatrafficking.as_ref().to_string());
34516        }
34517
34518        #[allow(clippy::single_element_loop)]
34519        for &(find_this, param_name) in [
34520            ("{profileId}", "profileId"),
34521            ("{advertiserId}", "advertiserId"),
34522        ]
34523        .iter()
34524        {
34525            url = params.uri_replacement(url, param_name, find_this, false);
34526        }
34527        {
34528            let to_remove = ["advertiserId", "profileId"];
34529            params.remove_params(&to_remove);
34530        }
34531
34532        let url = params.parse_with_url(&url);
34533
34534        let mut json_mime_type = mime::APPLICATION_JSON;
34535        let mut request_value_reader = {
34536            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
34537            common::remove_json_null_values(&mut value);
34538            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
34539            serde_json::to_writer(&mut dst, &value).unwrap();
34540            dst
34541        };
34542        let request_size = request_value_reader
34543            .seek(std::io::SeekFrom::End(0))
34544            .unwrap();
34545        request_value_reader
34546            .seek(std::io::SeekFrom::Start(0))
34547            .unwrap();
34548
34549        loop {
34550            let token = match self
34551                .hub
34552                .auth
34553                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
34554                .await
34555            {
34556                Ok(token) => token,
34557                Err(e) => match dlg.token(e) {
34558                    Ok(token) => token,
34559                    Err(e) => {
34560                        dlg.finished(false);
34561                        return Err(common::Error::MissingToken(e));
34562                    }
34563                },
34564            };
34565            request_value_reader
34566                .seek(std::io::SeekFrom::Start(0))
34567                .unwrap();
34568            let mut req_result = {
34569                let mut mp_reader: common::MultiPartReader = Default::default();
34570                let (mut body_reader, content_type) = match protocol {
34571                    common::UploadProtocol::Simple => {
34572                        mp_reader.reserve_exact(2);
34573                        let size = reader.seek(std::io::SeekFrom::End(0)).unwrap();
34574                        reader.seek(std::io::SeekFrom::Start(0)).unwrap();
34575                        if size > 1073741824 {
34576                            return Err(common::Error::UploadSizeLimitExceeded(size, 1073741824));
34577                        }
34578                        mp_reader
34579                            .add_part(
34580                                &mut request_value_reader,
34581                                request_size,
34582                                json_mime_type.clone(),
34583                            )
34584                            .add_part(&mut reader, size, reader_mime_type.clone());
34585                        (
34586                            &mut mp_reader as &mut (dyn std::io::Read + Send),
34587                            common::MultiPartReader::mime_type(),
34588                        )
34589                    }
34590                    _ => (
34591                        &mut request_value_reader as &mut (dyn std::io::Read + Send),
34592                        json_mime_type.clone(),
34593                    ),
34594                };
34595                let client = &self.hub.client;
34596                dlg.pre_request();
34597                let mut req_builder = hyper::Request::builder()
34598                    .method(hyper::Method::POST)
34599                    .uri(url.as_str())
34600                    .header(USER_AGENT, self.hub._user_agent.clone());
34601
34602                if let Some(token) = token.as_ref() {
34603                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
34604                }
34605
34606                let mut body_reader_bytes = vec![];
34607                body_reader.read_to_end(&mut body_reader_bytes).unwrap();
34608                let request = req_builder
34609                    .header(CONTENT_TYPE, content_type.to_string())
34610                    .body(common::to_body(body_reader_bytes.into()));
34611
34612                client.request(request.unwrap()).await
34613            };
34614
34615            match req_result {
34616                Err(err) => {
34617                    if let common::Retry::After(d) = dlg.http_error(&err) {
34618                        sleep(d).await;
34619                        continue;
34620                    }
34621                    dlg.finished(false);
34622                    return Err(common::Error::HttpError(err));
34623                }
34624                Ok(res) => {
34625                    let (mut parts, body) = res.into_parts();
34626                    let mut body = common::Body::new(body);
34627                    if !parts.status.is_success() {
34628                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34629                        let error = serde_json::from_str(&common::to_string(&bytes));
34630                        let response = common::to_response(parts, bytes.into());
34631
34632                        if let common::Retry::After(d) =
34633                            dlg.http_failure(&response, error.as_ref().ok())
34634                        {
34635                            sleep(d).await;
34636                            continue;
34637                        }
34638
34639                        dlg.finished(false);
34640
34641                        return Err(match error {
34642                            Ok(value) => common::Error::BadRequest(value),
34643                            _ => common::Error::Failure(response),
34644                        });
34645                    }
34646                    let response = {
34647                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34648                        let encoded = common::to_string(&bytes);
34649                        match serde_json::from_str(&encoded) {
34650                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
34651                            Err(error) => {
34652                                dlg.response_json_decode_error(&encoded, &error);
34653                                return Err(common::Error::JsonDecodeError(
34654                                    encoded.to_string(),
34655                                    error,
34656                                ));
34657                            }
34658                        }
34659                    };
34660
34661                    dlg.finished(true);
34662                    return Ok(response);
34663                }
34664            }
34665        }
34666    }
34667
34668    /// Upload media all at once.
34669    /// If the upload fails for whichever reason, all progress is lost.
34670    ///
34671    /// * *multipart*: yes
34672    /// * *max size*: 1073741824
34673    /// * *valid mime types*: '*/*'
34674    pub async fn upload<RS>(
34675        self,
34676        stream: RS,
34677        mime_type: mime::Mime,
34678    ) -> common::Result<(common::Response, CreativeAssetMetadata)>
34679    where
34680        RS: common::ReadSeek,
34681    {
34682        self.doit(stream, mime_type, common::UploadProtocol::Simple)
34683            .await
34684    }
34685
34686    ///
34687    /// Sets the *request* property to the given value.
34688    ///
34689    /// Even though the property as already been set when instantiating this call,
34690    /// we provide this method for API completeness.
34691    pub fn request(mut self, new_value: CreativeAssetMetadata) -> CreativeAssetInsertCall<'a, C> {
34692        self._request = new_value;
34693        self
34694    }
34695    /// User profile ID associated with this request.
34696    ///
34697    /// Sets the *profile id* path property to the given value.
34698    ///
34699    /// Even though the property as already been set when instantiating this call,
34700    /// we provide this method for API completeness.
34701    pub fn profile_id(mut self, new_value: i64) -> CreativeAssetInsertCall<'a, C> {
34702        self._profile_id = new_value;
34703        self
34704    }
34705    /// Advertiser ID of this creative. This is a required field.
34706    ///
34707    /// Sets the *advertiser id* path property to the given value.
34708    ///
34709    /// Even though the property as already been set when instantiating this call,
34710    /// we provide this method for API completeness.
34711    pub fn advertiser_id(mut self, new_value: i64) -> CreativeAssetInsertCall<'a, C> {
34712        self._advertiser_id = new_value;
34713        self
34714    }
34715    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34716    /// while executing the actual API request.
34717    ///
34718    /// ````text
34719    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
34720    /// ````
34721    ///
34722    /// Sets the *delegate* property to the given value.
34723    pub fn delegate(
34724        mut self,
34725        new_value: &'a mut dyn common::Delegate,
34726    ) -> CreativeAssetInsertCall<'a, C> {
34727        self._delegate = Some(new_value);
34728        self
34729    }
34730
34731    /// Set any additional parameter of the query string used in the request.
34732    /// It should be used to set parameters which are not yet available through their own
34733    /// setters.
34734    ///
34735    /// Please note that this method must not be used to set any of the known parameters
34736    /// which have their own setter method. If done anyway, the request will fail.
34737    ///
34738    /// # Additional Parameters
34739    ///
34740    /// * *$.xgafv* (query-string) - V1 error format.
34741    /// * *access_token* (query-string) - OAuth access token.
34742    /// * *alt* (query-string) - Data format for response.
34743    /// * *callback* (query-string) - JSONP
34744    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34745    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
34746    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34747    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34748    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
34749    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34750    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34751    pub fn param<T>(mut self, name: T, value: T) -> CreativeAssetInsertCall<'a, C>
34752    where
34753        T: AsRef<str>,
34754    {
34755        self._additional_params
34756            .insert(name.as_ref().to_string(), value.as_ref().to_string());
34757        self
34758    }
34759
34760    /// Identifies the authorization scope for the method you are building.
34761    ///
34762    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
34763    /// [`Scope::Dfatrafficking`].
34764    ///
34765    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
34766    /// tokens for more than one scope.
34767    ///
34768    /// Usually there is more than one suitable scope to authorize an operation, some of which may
34769    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
34770    /// sufficient, a read-write scope will do as well.
34771    pub fn add_scope<St>(mut self, scope: St) -> CreativeAssetInsertCall<'a, C>
34772    where
34773        St: AsRef<str>,
34774    {
34775        self._scopes.insert(String::from(scope.as_ref()));
34776        self
34777    }
34778    /// Identifies the authorization scope(s) for the method you are building.
34779    ///
34780    /// See [`Self::add_scope()`] for details.
34781    pub fn add_scopes<I, St>(mut self, scopes: I) -> CreativeAssetInsertCall<'a, C>
34782    where
34783        I: IntoIterator<Item = St>,
34784        St: AsRef<str>,
34785    {
34786        self._scopes
34787            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
34788        self
34789    }
34790
34791    /// Removes all scopes, and no default scope will be used either.
34792    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34793    /// for details).
34794    pub fn clear_scopes(mut self) -> CreativeAssetInsertCall<'a, C> {
34795        self._scopes.clear();
34796        self
34797    }
34798}
34799
34800/// Deletes an existing creative field value.
34801///
34802/// A builder for the *delete* method supported by a *creativeFieldValue* resource.
34803/// It is not used directly, but through a [`CreativeFieldValueMethods`] instance.
34804///
34805/// # Example
34806///
34807/// Instantiate a resource method builder
34808///
34809/// ```test_harness,no_run
34810/// # extern crate hyper;
34811/// # extern crate hyper_rustls;
34812/// # extern crate google_dfareporting3d3 as dfareporting3d3;
34813/// # async fn dox() {
34814/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
34815///
34816/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
34817/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
34818/// #     secret,
34819/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
34820/// # ).build().await.unwrap();
34821///
34822/// # let client = hyper_util::client::legacy::Client::builder(
34823/// #     hyper_util::rt::TokioExecutor::new()
34824/// # )
34825/// # .build(
34826/// #     hyper_rustls::HttpsConnectorBuilder::new()
34827/// #         .with_native_roots()
34828/// #         .unwrap()
34829/// #         .https_or_http()
34830/// #         .enable_http1()
34831/// #         .build()
34832/// # );
34833/// # let mut hub = Dfareporting::new(client, auth);
34834/// // You can configure optional parameters by calling the respective setters at will, and
34835/// // execute the final call using `doit()`.
34836/// // Values shown here are possibly random and not representative !
34837/// let result = hub.creative_field_values().delete(-39, -34, -25)
34838///              .doit().await;
34839/// # }
34840/// ```
34841pub struct CreativeFieldValueDeleteCall<'a, C>
34842where
34843    C: 'a,
34844{
34845    hub: &'a Dfareporting<C>,
34846    _profile_id: i64,
34847    _creative_field_id: i64,
34848    _id: i64,
34849    _delegate: Option<&'a mut dyn common::Delegate>,
34850    _additional_params: HashMap<String, String>,
34851    _scopes: BTreeSet<String>,
34852}
34853
34854impl<'a, C> common::CallBuilder for CreativeFieldValueDeleteCall<'a, C> {}
34855
34856impl<'a, C> CreativeFieldValueDeleteCall<'a, C>
34857where
34858    C: common::Connector,
34859{
34860    /// Perform the operation you have build so far.
34861    pub async fn doit(mut self) -> common::Result<common::Response> {
34862        use std::borrow::Cow;
34863        use std::io::{Read, Seek};
34864
34865        use common::{url::Params, ToParts};
34866        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
34867
34868        let mut dd = common::DefaultDelegate;
34869        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
34870        dlg.begin(common::MethodInfo {
34871            id: "dfareporting.creativeFieldValues.delete",
34872            http_method: hyper::Method::DELETE,
34873        });
34874
34875        for &field in ["profileId", "creativeFieldId", "id"].iter() {
34876            if self._additional_params.contains_key(field) {
34877                dlg.finished(false);
34878                return Err(common::Error::FieldClash(field));
34879            }
34880        }
34881
34882        let mut params = Params::with_capacity(4 + self._additional_params.len());
34883        params.push("profileId", self._profile_id.to_string());
34884        params.push("creativeFieldId", self._creative_field_id.to_string());
34885        params.push("id", self._id.to_string());
34886
34887        params.extend(self._additional_params.iter());
34888
34889        let mut url = self.hub._base_url.clone()
34890            + "userprofiles/{profileId}/creativeFields/{creativeFieldId}/creativeFieldValues/{id}";
34891        if self._scopes.is_empty() {
34892            self._scopes
34893                .insert(Scope::Dfatrafficking.as_ref().to_string());
34894        }
34895
34896        #[allow(clippy::single_element_loop)]
34897        for &(find_this, param_name) in [
34898            ("{profileId}", "profileId"),
34899            ("{creativeFieldId}", "creativeFieldId"),
34900            ("{id}", "id"),
34901        ]
34902        .iter()
34903        {
34904            url = params.uri_replacement(url, param_name, find_this, false);
34905        }
34906        {
34907            let to_remove = ["id", "creativeFieldId", "profileId"];
34908            params.remove_params(&to_remove);
34909        }
34910
34911        let url = params.parse_with_url(&url);
34912
34913        loop {
34914            let token = match self
34915                .hub
34916                .auth
34917                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
34918                .await
34919            {
34920                Ok(token) => token,
34921                Err(e) => match dlg.token(e) {
34922                    Ok(token) => token,
34923                    Err(e) => {
34924                        dlg.finished(false);
34925                        return Err(common::Error::MissingToken(e));
34926                    }
34927                },
34928            };
34929            let mut req_result = {
34930                let client = &self.hub.client;
34931                dlg.pre_request();
34932                let mut req_builder = hyper::Request::builder()
34933                    .method(hyper::Method::DELETE)
34934                    .uri(url.as_str())
34935                    .header(USER_AGENT, self.hub._user_agent.clone());
34936
34937                if let Some(token) = token.as_ref() {
34938                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
34939                }
34940
34941                let request = req_builder
34942                    .header(CONTENT_LENGTH, 0_u64)
34943                    .body(common::to_body::<String>(None));
34944
34945                client.request(request.unwrap()).await
34946            };
34947
34948            match req_result {
34949                Err(err) => {
34950                    if let common::Retry::After(d) = dlg.http_error(&err) {
34951                        sleep(d).await;
34952                        continue;
34953                    }
34954                    dlg.finished(false);
34955                    return Err(common::Error::HttpError(err));
34956                }
34957                Ok(res) => {
34958                    let (mut parts, body) = res.into_parts();
34959                    let mut body = common::Body::new(body);
34960                    if !parts.status.is_success() {
34961                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34962                        let error = serde_json::from_str(&common::to_string(&bytes));
34963                        let response = common::to_response(parts, bytes.into());
34964
34965                        if let common::Retry::After(d) =
34966                            dlg.http_failure(&response, error.as_ref().ok())
34967                        {
34968                            sleep(d).await;
34969                            continue;
34970                        }
34971
34972                        dlg.finished(false);
34973
34974                        return Err(match error {
34975                            Ok(value) => common::Error::BadRequest(value),
34976                            _ => common::Error::Failure(response),
34977                        });
34978                    }
34979                    let response = common::Response::from_parts(parts, body);
34980
34981                    dlg.finished(true);
34982                    return Ok(response);
34983                }
34984            }
34985        }
34986    }
34987
34988    /// User profile ID associated with this request.
34989    ///
34990    /// Sets the *profile id* path property to the given value.
34991    ///
34992    /// Even though the property as already been set when instantiating this call,
34993    /// we provide this method for API completeness.
34994    pub fn profile_id(mut self, new_value: i64) -> CreativeFieldValueDeleteCall<'a, C> {
34995        self._profile_id = new_value;
34996        self
34997    }
34998    /// Creative field ID for this creative field value.
34999    ///
35000    /// Sets the *creative field id* path property to the given value.
35001    ///
35002    /// Even though the property as already been set when instantiating this call,
35003    /// we provide this method for API completeness.
35004    pub fn creative_field_id(mut self, new_value: i64) -> CreativeFieldValueDeleteCall<'a, C> {
35005        self._creative_field_id = new_value;
35006        self
35007    }
35008    /// Creative Field Value ID
35009    ///
35010    /// Sets the *id* path property to the given value.
35011    ///
35012    /// Even though the property as already been set when instantiating this call,
35013    /// we provide this method for API completeness.
35014    pub fn id(mut self, new_value: i64) -> CreativeFieldValueDeleteCall<'a, C> {
35015        self._id = new_value;
35016        self
35017    }
35018    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
35019    /// while executing the actual API request.
35020    ///
35021    /// ````text
35022    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
35023    /// ````
35024    ///
35025    /// Sets the *delegate* property to the given value.
35026    pub fn delegate(
35027        mut self,
35028        new_value: &'a mut dyn common::Delegate,
35029    ) -> CreativeFieldValueDeleteCall<'a, C> {
35030        self._delegate = Some(new_value);
35031        self
35032    }
35033
35034    /// Set any additional parameter of the query string used in the request.
35035    /// It should be used to set parameters which are not yet available through their own
35036    /// setters.
35037    ///
35038    /// Please note that this method must not be used to set any of the known parameters
35039    /// which have their own setter method. If done anyway, the request will fail.
35040    ///
35041    /// # Additional Parameters
35042    ///
35043    /// * *$.xgafv* (query-string) - V1 error format.
35044    /// * *access_token* (query-string) - OAuth access token.
35045    /// * *alt* (query-string) - Data format for response.
35046    /// * *callback* (query-string) - JSONP
35047    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
35048    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
35049    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
35050    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
35051    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
35052    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
35053    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
35054    pub fn param<T>(mut self, name: T, value: T) -> CreativeFieldValueDeleteCall<'a, C>
35055    where
35056        T: AsRef<str>,
35057    {
35058        self._additional_params
35059            .insert(name.as_ref().to_string(), value.as_ref().to_string());
35060        self
35061    }
35062
35063    /// Identifies the authorization scope for the method you are building.
35064    ///
35065    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
35066    /// [`Scope::Dfatrafficking`].
35067    ///
35068    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
35069    /// tokens for more than one scope.
35070    ///
35071    /// Usually there is more than one suitable scope to authorize an operation, some of which may
35072    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
35073    /// sufficient, a read-write scope will do as well.
35074    pub fn add_scope<St>(mut self, scope: St) -> CreativeFieldValueDeleteCall<'a, C>
35075    where
35076        St: AsRef<str>,
35077    {
35078        self._scopes.insert(String::from(scope.as_ref()));
35079        self
35080    }
35081    /// Identifies the authorization scope(s) for the method you are building.
35082    ///
35083    /// See [`Self::add_scope()`] for details.
35084    pub fn add_scopes<I, St>(mut self, scopes: I) -> CreativeFieldValueDeleteCall<'a, C>
35085    where
35086        I: IntoIterator<Item = St>,
35087        St: AsRef<str>,
35088    {
35089        self._scopes
35090            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
35091        self
35092    }
35093
35094    /// Removes all scopes, and no default scope will be used either.
35095    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
35096    /// for details).
35097    pub fn clear_scopes(mut self) -> CreativeFieldValueDeleteCall<'a, C> {
35098        self._scopes.clear();
35099        self
35100    }
35101}
35102
35103/// Gets one creative field value by ID.
35104///
35105/// A builder for the *get* method supported by a *creativeFieldValue* resource.
35106/// It is not used directly, but through a [`CreativeFieldValueMethods`] instance.
35107///
35108/// # Example
35109///
35110/// Instantiate a resource method builder
35111///
35112/// ```test_harness,no_run
35113/// # extern crate hyper;
35114/// # extern crate hyper_rustls;
35115/// # extern crate google_dfareporting3d3 as dfareporting3d3;
35116/// # async fn dox() {
35117/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
35118///
35119/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
35120/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
35121/// #     secret,
35122/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
35123/// # ).build().await.unwrap();
35124///
35125/// # let client = hyper_util::client::legacy::Client::builder(
35126/// #     hyper_util::rt::TokioExecutor::new()
35127/// # )
35128/// # .build(
35129/// #     hyper_rustls::HttpsConnectorBuilder::new()
35130/// #         .with_native_roots()
35131/// #         .unwrap()
35132/// #         .https_or_http()
35133/// #         .enable_http1()
35134/// #         .build()
35135/// # );
35136/// # let mut hub = Dfareporting::new(client, auth);
35137/// // You can configure optional parameters by calling the respective setters at will, and
35138/// // execute the final call using `doit()`.
35139/// // Values shown here are possibly random and not representative !
35140/// let result = hub.creative_field_values().get(-52, -84, -97)
35141///              .doit().await;
35142/// # }
35143/// ```
35144pub struct CreativeFieldValueGetCall<'a, C>
35145where
35146    C: 'a,
35147{
35148    hub: &'a Dfareporting<C>,
35149    _profile_id: i64,
35150    _creative_field_id: i64,
35151    _id: i64,
35152    _delegate: Option<&'a mut dyn common::Delegate>,
35153    _additional_params: HashMap<String, String>,
35154    _scopes: BTreeSet<String>,
35155}
35156
35157impl<'a, C> common::CallBuilder for CreativeFieldValueGetCall<'a, C> {}
35158
35159impl<'a, C> CreativeFieldValueGetCall<'a, C>
35160where
35161    C: common::Connector,
35162{
35163    /// Perform the operation you have build so far.
35164    pub async fn doit(mut self) -> common::Result<(common::Response, CreativeFieldValue)> {
35165        use std::borrow::Cow;
35166        use std::io::{Read, Seek};
35167
35168        use common::{url::Params, ToParts};
35169        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
35170
35171        let mut dd = common::DefaultDelegate;
35172        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
35173        dlg.begin(common::MethodInfo {
35174            id: "dfareporting.creativeFieldValues.get",
35175            http_method: hyper::Method::GET,
35176        });
35177
35178        for &field in ["alt", "profileId", "creativeFieldId", "id"].iter() {
35179            if self._additional_params.contains_key(field) {
35180                dlg.finished(false);
35181                return Err(common::Error::FieldClash(field));
35182            }
35183        }
35184
35185        let mut params = Params::with_capacity(5 + self._additional_params.len());
35186        params.push("profileId", self._profile_id.to_string());
35187        params.push("creativeFieldId", self._creative_field_id.to_string());
35188        params.push("id", self._id.to_string());
35189
35190        params.extend(self._additional_params.iter());
35191
35192        params.push("alt", "json");
35193        let mut url = self.hub._base_url.clone()
35194            + "userprofiles/{profileId}/creativeFields/{creativeFieldId}/creativeFieldValues/{id}";
35195        if self._scopes.is_empty() {
35196            self._scopes
35197                .insert(Scope::Dfatrafficking.as_ref().to_string());
35198        }
35199
35200        #[allow(clippy::single_element_loop)]
35201        for &(find_this, param_name) in [
35202            ("{profileId}", "profileId"),
35203            ("{creativeFieldId}", "creativeFieldId"),
35204            ("{id}", "id"),
35205        ]
35206        .iter()
35207        {
35208            url = params.uri_replacement(url, param_name, find_this, false);
35209        }
35210        {
35211            let to_remove = ["id", "creativeFieldId", "profileId"];
35212            params.remove_params(&to_remove);
35213        }
35214
35215        let url = params.parse_with_url(&url);
35216
35217        loop {
35218            let token = match self
35219                .hub
35220                .auth
35221                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
35222                .await
35223            {
35224                Ok(token) => token,
35225                Err(e) => match dlg.token(e) {
35226                    Ok(token) => token,
35227                    Err(e) => {
35228                        dlg.finished(false);
35229                        return Err(common::Error::MissingToken(e));
35230                    }
35231                },
35232            };
35233            let mut req_result = {
35234                let client = &self.hub.client;
35235                dlg.pre_request();
35236                let mut req_builder = hyper::Request::builder()
35237                    .method(hyper::Method::GET)
35238                    .uri(url.as_str())
35239                    .header(USER_AGENT, self.hub._user_agent.clone());
35240
35241                if let Some(token) = token.as_ref() {
35242                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
35243                }
35244
35245                let request = req_builder
35246                    .header(CONTENT_LENGTH, 0_u64)
35247                    .body(common::to_body::<String>(None));
35248
35249                client.request(request.unwrap()).await
35250            };
35251
35252            match req_result {
35253                Err(err) => {
35254                    if let common::Retry::After(d) = dlg.http_error(&err) {
35255                        sleep(d).await;
35256                        continue;
35257                    }
35258                    dlg.finished(false);
35259                    return Err(common::Error::HttpError(err));
35260                }
35261                Ok(res) => {
35262                    let (mut parts, body) = res.into_parts();
35263                    let mut body = common::Body::new(body);
35264                    if !parts.status.is_success() {
35265                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35266                        let error = serde_json::from_str(&common::to_string(&bytes));
35267                        let response = common::to_response(parts, bytes.into());
35268
35269                        if let common::Retry::After(d) =
35270                            dlg.http_failure(&response, error.as_ref().ok())
35271                        {
35272                            sleep(d).await;
35273                            continue;
35274                        }
35275
35276                        dlg.finished(false);
35277
35278                        return Err(match error {
35279                            Ok(value) => common::Error::BadRequest(value),
35280                            _ => common::Error::Failure(response),
35281                        });
35282                    }
35283                    let response = {
35284                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35285                        let encoded = common::to_string(&bytes);
35286                        match serde_json::from_str(&encoded) {
35287                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
35288                            Err(error) => {
35289                                dlg.response_json_decode_error(&encoded, &error);
35290                                return Err(common::Error::JsonDecodeError(
35291                                    encoded.to_string(),
35292                                    error,
35293                                ));
35294                            }
35295                        }
35296                    };
35297
35298                    dlg.finished(true);
35299                    return Ok(response);
35300                }
35301            }
35302        }
35303    }
35304
35305    /// User profile ID associated with this request.
35306    ///
35307    /// Sets the *profile id* path property to the given value.
35308    ///
35309    /// Even though the property as already been set when instantiating this call,
35310    /// we provide this method for API completeness.
35311    pub fn profile_id(mut self, new_value: i64) -> CreativeFieldValueGetCall<'a, C> {
35312        self._profile_id = new_value;
35313        self
35314    }
35315    /// Creative field ID for this creative field value.
35316    ///
35317    /// Sets the *creative field id* path property to the given value.
35318    ///
35319    /// Even though the property as already been set when instantiating this call,
35320    /// we provide this method for API completeness.
35321    pub fn creative_field_id(mut self, new_value: i64) -> CreativeFieldValueGetCall<'a, C> {
35322        self._creative_field_id = new_value;
35323        self
35324    }
35325    /// Creative Field Value ID
35326    ///
35327    /// Sets the *id* path property to the given value.
35328    ///
35329    /// Even though the property as already been set when instantiating this call,
35330    /// we provide this method for API completeness.
35331    pub fn id(mut self, new_value: i64) -> CreativeFieldValueGetCall<'a, C> {
35332        self._id = new_value;
35333        self
35334    }
35335    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
35336    /// while executing the actual API request.
35337    ///
35338    /// ````text
35339    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
35340    /// ````
35341    ///
35342    /// Sets the *delegate* property to the given value.
35343    pub fn delegate(
35344        mut self,
35345        new_value: &'a mut dyn common::Delegate,
35346    ) -> CreativeFieldValueGetCall<'a, C> {
35347        self._delegate = Some(new_value);
35348        self
35349    }
35350
35351    /// Set any additional parameter of the query string used in the request.
35352    /// It should be used to set parameters which are not yet available through their own
35353    /// setters.
35354    ///
35355    /// Please note that this method must not be used to set any of the known parameters
35356    /// which have their own setter method. If done anyway, the request will fail.
35357    ///
35358    /// # Additional Parameters
35359    ///
35360    /// * *$.xgafv* (query-string) - V1 error format.
35361    /// * *access_token* (query-string) - OAuth access token.
35362    /// * *alt* (query-string) - Data format for response.
35363    /// * *callback* (query-string) - JSONP
35364    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
35365    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
35366    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
35367    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
35368    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
35369    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
35370    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
35371    pub fn param<T>(mut self, name: T, value: T) -> CreativeFieldValueGetCall<'a, C>
35372    where
35373        T: AsRef<str>,
35374    {
35375        self._additional_params
35376            .insert(name.as_ref().to_string(), value.as_ref().to_string());
35377        self
35378    }
35379
35380    /// Identifies the authorization scope for the method you are building.
35381    ///
35382    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
35383    /// [`Scope::Dfatrafficking`].
35384    ///
35385    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
35386    /// tokens for more than one scope.
35387    ///
35388    /// Usually there is more than one suitable scope to authorize an operation, some of which may
35389    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
35390    /// sufficient, a read-write scope will do as well.
35391    pub fn add_scope<St>(mut self, scope: St) -> CreativeFieldValueGetCall<'a, C>
35392    where
35393        St: AsRef<str>,
35394    {
35395        self._scopes.insert(String::from(scope.as_ref()));
35396        self
35397    }
35398    /// Identifies the authorization scope(s) for the method you are building.
35399    ///
35400    /// See [`Self::add_scope()`] for details.
35401    pub fn add_scopes<I, St>(mut self, scopes: I) -> CreativeFieldValueGetCall<'a, C>
35402    where
35403        I: IntoIterator<Item = St>,
35404        St: AsRef<str>,
35405    {
35406        self._scopes
35407            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
35408        self
35409    }
35410
35411    /// Removes all scopes, and no default scope will be used either.
35412    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
35413    /// for details).
35414    pub fn clear_scopes(mut self) -> CreativeFieldValueGetCall<'a, C> {
35415        self._scopes.clear();
35416        self
35417    }
35418}
35419
35420/// Inserts a new creative field value.
35421///
35422/// A builder for the *insert* method supported by a *creativeFieldValue* resource.
35423/// It is not used directly, but through a [`CreativeFieldValueMethods`] instance.
35424///
35425/// # Example
35426///
35427/// Instantiate a resource method builder
35428///
35429/// ```test_harness,no_run
35430/// # extern crate hyper;
35431/// # extern crate hyper_rustls;
35432/// # extern crate google_dfareporting3d3 as dfareporting3d3;
35433/// use dfareporting3d3::api::CreativeFieldValue;
35434/// # async fn dox() {
35435/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
35436///
35437/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
35438/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
35439/// #     secret,
35440/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
35441/// # ).build().await.unwrap();
35442///
35443/// # let client = hyper_util::client::legacy::Client::builder(
35444/// #     hyper_util::rt::TokioExecutor::new()
35445/// # )
35446/// # .build(
35447/// #     hyper_rustls::HttpsConnectorBuilder::new()
35448/// #         .with_native_roots()
35449/// #         .unwrap()
35450/// #         .https_or_http()
35451/// #         .enable_http1()
35452/// #         .build()
35453/// # );
35454/// # let mut hub = Dfareporting::new(client, auth);
35455/// // As the method needs a request, you would usually fill it with the desired information
35456/// // into the respective structure. Some of the parts shown here might not be applicable !
35457/// // Values shown here are possibly random and not representative !
35458/// let mut req = CreativeFieldValue::default();
35459///
35460/// // You can configure optional parameters by calling the respective setters at will, and
35461/// // execute the final call using `doit()`.
35462/// // Values shown here are possibly random and not representative !
35463/// let result = hub.creative_field_values().insert(req, -37, -27)
35464///              .doit().await;
35465/// # }
35466/// ```
35467pub struct CreativeFieldValueInsertCall<'a, C>
35468where
35469    C: 'a,
35470{
35471    hub: &'a Dfareporting<C>,
35472    _request: CreativeFieldValue,
35473    _profile_id: i64,
35474    _creative_field_id: i64,
35475    _delegate: Option<&'a mut dyn common::Delegate>,
35476    _additional_params: HashMap<String, String>,
35477    _scopes: BTreeSet<String>,
35478}
35479
35480impl<'a, C> common::CallBuilder for CreativeFieldValueInsertCall<'a, C> {}
35481
35482impl<'a, C> CreativeFieldValueInsertCall<'a, C>
35483where
35484    C: common::Connector,
35485{
35486    /// Perform the operation you have build so far.
35487    pub async fn doit(mut self) -> common::Result<(common::Response, CreativeFieldValue)> {
35488        use std::borrow::Cow;
35489        use std::io::{Read, Seek};
35490
35491        use common::{url::Params, ToParts};
35492        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
35493
35494        let mut dd = common::DefaultDelegate;
35495        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
35496        dlg.begin(common::MethodInfo {
35497            id: "dfareporting.creativeFieldValues.insert",
35498            http_method: hyper::Method::POST,
35499        });
35500
35501        for &field in ["alt", "profileId", "creativeFieldId"].iter() {
35502            if self._additional_params.contains_key(field) {
35503                dlg.finished(false);
35504                return Err(common::Error::FieldClash(field));
35505            }
35506        }
35507
35508        let mut params = Params::with_capacity(5 + self._additional_params.len());
35509        params.push("profileId", self._profile_id.to_string());
35510        params.push("creativeFieldId", self._creative_field_id.to_string());
35511
35512        params.extend(self._additional_params.iter());
35513
35514        params.push("alt", "json");
35515        let mut url = self.hub._base_url.clone()
35516            + "userprofiles/{profileId}/creativeFields/{creativeFieldId}/creativeFieldValues";
35517        if self._scopes.is_empty() {
35518            self._scopes
35519                .insert(Scope::Dfatrafficking.as_ref().to_string());
35520        }
35521
35522        #[allow(clippy::single_element_loop)]
35523        for &(find_this, param_name) in [
35524            ("{profileId}", "profileId"),
35525            ("{creativeFieldId}", "creativeFieldId"),
35526        ]
35527        .iter()
35528        {
35529            url = params.uri_replacement(url, param_name, find_this, false);
35530        }
35531        {
35532            let to_remove = ["creativeFieldId", "profileId"];
35533            params.remove_params(&to_remove);
35534        }
35535
35536        let url = params.parse_with_url(&url);
35537
35538        let mut json_mime_type = mime::APPLICATION_JSON;
35539        let mut request_value_reader = {
35540            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
35541            common::remove_json_null_values(&mut value);
35542            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
35543            serde_json::to_writer(&mut dst, &value).unwrap();
35544            dst
35545        };
35546        let request_size = request_value_reader
35547            .seek(std::io::SeekFrom::End(0))
35548            .unwrap();
35549        request_value_reader
35550            .seek(std::io::SeekFrom::Start(0))
35551            .unwrap();
35552
35553        loop {
35554            let token = match self
35555                .hub
35556                .auth
35557                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
35558                .await
35559            {
35560                Ok(token) => token,
35561                Err(e) => match dlg.token(e) {
35562                    Ok(token) => token,
35563                    Err(e) => {
35564                        dlg.finished(false);
35565                        return Err(common::Error::MissingToken(e));
35566                    }
35567                },
35568            };
35569            request_value_reader
35570                .seek(std::io::SeekFrom::Start(0))
35571                .unwrap();
35572            let mut req_result = {
35573                let client = &self.hub.client;
35574                dlg.pre_request();
35575                let mut req_builder = hyper::Request::builder()
35576                    .method(hyper::Method::POST)
35577                    .uri(url.as_str())
35578                    .header(USER_AGENT, self.hub._user_agent.clone());
35579
35580                if let Some(token) = token.as_ref() {
35581                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
35582                }
35583
35584                let request = req_builder
35585                    .header(CONTENT_TYPE, json_mime_type.to_string())
35586                    .header(CONTENT_LENGTH, request_size as u64)
35587                    .body(common::to_body(
35588                        request_value_reader.get_ref().clone().into(),
35589                    ));
35590
35591                client.request(request.unwrap()).await
35592            };
35593
35594            match req_result {
35595                Err(err) => {
35596                    if let common::Retry::After(d) = dlg.http_error(&err) {
35597                        sleep(d).await;
35598                        continue;
35599                    }
35600                    dlg.finished(false);
35601                    return Err(common::Error::HttpError(err));
35602                }
35603                Ok(res) => {
35604                    let (mut parts, body) = res.into_parts();
35605                    let mut body = common::Body::new(body);
35606                    if !parts.status.is_success() {
35607                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35608                        let error = serde_json::from_str(&common::to_string(&bytes));
35609                        let response = common::to_response(parts, bytes.into());
35610
35611                        if let common::Retry::After(d) =
35612                            dlg.http_failure(&response, error.as_ref().ok())
35613                        {
35614                            sleep(d).await;
35615                            continue;
35616                        }
35617
35618                        dlg.finished(false);
35619
35620                        return Err(match error {
35621                            Ok(value) => common::Error::BadRequest(value),
35622                            _ => common::Error::Failure(response),
35623                        });
35624                    }
35625                    let response = {
35626                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35627                        let encoded = common::to_string(&bytes);
35628                        match serde_json::from_str(&encoded) {
35629                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
35630                            Err(error) => {
35631                                dlg.response_json_decode_error(&encoded, &error);
35632                                return Err(common::Error::JsonDecodeError(
35633                                    encoded.to_string(),
35634                                    error,
35635                                ));
35636                            }
35637                        }
35638                    };
35639
35640                    dlg.finished(true);
35641                    return Ok(response);
35642                }
35643            }
35644        }
35645    }
35646
35647    ///
35648    /// Sets the *request* property to the given value.
35649    ///
35650    /// Even though the property as already been set when instantiating this call,
35651    /// we provide this method for API completeness.
35652    pub fn request(mut self, new_value: CreativeFieldValue) -> CreativeFieldValueInsertCall<'a, C> {
35653        self._request = new_value;
35654        self
35655    }
35656    /// User profile ID associated with this request.
35657    ///
35658    /// Sets the *profile id* path property to the given value.
35659    ///
35660    /// Even though the property as already been set when instantiating this call,
35661    /// we provide this method for API completeness.
35662    pub fn profile_id(mut self, new_value: i64) -> CreativeFieldValueInsertCall<'a, C> {
35663        self._profile_id = new_value;
35664        self
35665    }
35666    /// Creative field ID for this creative field value.
35667    ///
35668    /// Sets the *creative field id* path property to the given value.
35669    ///
35670    /// Even though the property as already been set when instantiating this call,
35671    /// we provide this method for API completeness.
35672    pub fn creative_field_id(mut self, new_value: i64) -> CreativeFieldValueInsertCall<'a, C> {
35673        self._creative_field_id = new_value;
35674        self
35675    }
35676    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
35677    /// while executing the actual API request.
35678    ///
35679    /// ````text
35680    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
35681    /// ````
35682    ///
35683    /// Sets the *delegate* property to the given value.
35684    pub fn delegate(
35685        mut self,
35686        new_value: &'a mut dyn common::Delegate,
35687    ) -> CreativeFieldValueInsertCall<'a, C> {
35688        self._delegate = Some(new_value);
35689        self
35690    }
35691
35692    /// Set any additional parameter of the query string used in the request.
35693    /// It should be used to set parameters which are not yet available through their own
35694    /// setters.
35695    ///
35696    /// Please note that this method must not be used to set any of the known parameters
35697    /// which have their own setter method. If done anyway, the request will fail.
35698    ///
35699    /// # Additional Parameters
35700    ///
35701    /// * *$.xgafv* (query-string) - V1 error format.
35702    /// * *access_token* (query-string) - OAuth access token.
35703    /// * *alt* (query-string) - Data format for response.
35704    /// * *callback* (query-string) - JSONP
35705    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
35706    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
35707    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
35708    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
35709    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
35710    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
35711    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
35712    pub fn param<T>(mut self, name: T, value: T) -> CreativeFieldValueInsertCall<'a, C>
35713    where
35714        T: AsRef<str>,
35715    {
35716        self._additional_params
35717            .insert(name.as_ref().to_string(), value.as_ref().to_string());
35718        self
35719    }
35720
35721    /// Identifies the authorization scope for the method you are building.
35722    ///
35723    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
35724    /// [`Scope::Dfatrafficking`].
35725    ///
35726    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
35727    /// tokens for more than one scope.
35728    ///
35729    /// Usually there is more than one suitable scope to authorize an operation, some of which may
35730    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
35731    /// sufficient, a read-write scope will do as well.
35732    pub fn add_scope<St>(mut self, scope: St) -> CreativeFieldValueInsertCall<'a, C>
35733    where
35734        St: AsRef<str>,
35735    {
35736        self._scopes.insert(String::from(scope.as_ref()));
35737        self
35738    }
35739    /// Identifies the authorization scope(s) for the method you are building.
35740    ///
35741    /// See [`Self::add_scope()`] for details.
35742    pub fn add_scopes<I, St>(mut self, scopes: I) -> CreativeFieldValueInsertCall<'a, C>
35743    where
35744        I: IntoIterator<Item = St>,
35745        St: AsRef<str>,
35746    {
35747        self._scopes
35748            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
35749        self
35750    }
35751
35752    /// Removes all scopes, and no default scope will be used either.
35753    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
35754    /// for details).
35755    pub fn clear_scopes(mut self) -> CreativeFieldValueInsertCall<'a, C> {
35756        self._scopes.clear();
35757        self
35758    }
35759}
35760
35761/// Retrieves a list of creative field values, possibly filtered. This method supports paging.
35762///
35763/// A builder for the *list* method supported by a *creativeFieldValue* resource.
35764/// It is not used directly, but through a [`CreativeFieldValueMethods`] instance.
35765///
35766/// # Example
35767///
35768/// Instantiate a resource method builder
35769///
35770/// ```test_harness,no_run
35771/// # extern crate hyper;
35772/// # extern crate hyper_rustls;
35773/// # extern crate google_dfareporting3d3 as dfareporting3d3;
35774/// # async fn dox() {
35775/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
35776///
35777/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
35778/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
35779/// #     secret,
35780/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
35781/// # ).build().await.unwrap();
35782///
35783/// # let client = hyper_util::client::legacy::Client::builder(
35784/// #     hyper_util::rt::TokioExecutor::new()
35785/// # )
35786/// # .build(
35787/// #     hyper_rustls::HttpsConnectorBuilder::new()
35788/// #         .with_native_roots()
35789/// #         .unwrap()
35790/// #         .https_or_http()
35791/// #         .enable_http1()
35792/// #         .build()
35793/// # );
35794/// # let mut hub = Dfareporting::new(client, auth);
35795/// // You can configure optional parameters by calling the respective setters at will, and
35796/// // execute the final call using `doit()`.
35797/// // Values shown here are possibly random and not representative !
35798/// let result = hub.creative_field_values().list(-53, -76)
35799///              .sort_order("duo")
35800///              .sort_field("sadipscing")
35801///              .search_string("ut")
35802///              .page_token("rebum.")
35803///              .max_results(-70)
35804///              .add_ids(-63)
35805///              .doit().await;
35806/// # }
35807/// ```
35808pub struct CreativeFieldValueListCall<'a, C>
35809where
35810    C: 'a,
35811{
35812    hub: &'a Dfareporting<C>,
35813    _profile_id: i64,
35814    _creative_field_id: i64,
35815    _sort_order: Option<String>,
35816    _sort_field: Option<String>,
35817    _search_string: Option<String>,
35818    _page_token: Option<String>,
35819    _max_results: Option<i32>,
35820    _ids: Vec<i64>,
35821    _delegate: Option<&'a mut dyn common::Delegate>,
35822    _additional_params: HashMap<String, String>,
35823    _scopes: BTreeSet<String>,
35824}
35825
35826impl<'a, C> common::CallBuilder for CreativeFieldValueListCall<'a, C> {}
35827
35828impl<'a, C> CreativeFieldValueListCall<'a, C>
35829where
35830    C: common::Connector,
35831{
35832    /// Perform the operation you have build so far.
35833    pub async fn doit(
35834        mut self,
35835    ) -> common::Result<(common::Response, CreativeFieldValuesListResponse)> {
35836        use std::borrow::Cow;
35837        use std::io::{Read, Seek};
35838
35839        use common::{url::Params, ToParts};
35840        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
35841
35842        let mut dd = common::DefaultDelegate;
35843        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
35844        dlg.begin(common::MethodInfo {
35845            id: "dfareporting.creativeFieldValues.list",
35846            http_method: hyper::Method::GET,
35847        });
35848
35849        for &field in [
35850            "alt",
35851            "profileId",
35852            "creativeFieldId",
35853            "sortOrder",
35854            "sortField",
35855            "searchString",
35856            "pageToken",
35857            "maxResults",
35858            "ids",
35859        ]
35860        .iter()
35861        {
35862            if self._additional_params.contains_key(field) {
35863                dlg.finished(false);
35864                return Err(common::Error::FieldClash(field));
35865            }
35866        }
35867
35868        let mut params = Params::with_capacity(10 + self._additional_params.len());
35869        params.push("profileId", self._profile_id.to_string());
35870        params.push("creativeFieldId", self._creative_field_id.to_string());
35871        if let Some(value) = self._sort_order.as_ref() {
35872            params.push("sortOrder", value);
35873        }
35874        if let Some(value) = self._sort_field.as_ref() {
35875            params.push("sortField", value);
35876        }
35877        if let Some(value) = self._search_string.as_ref() {
35878            params.push("searchString", value);
35879        }
35880        if let Some(value) = self._page_token.as_ref() {
35881            params.push("pageToken", value);
35882        }
35883        if let Some(value) = self._max_results.as_ref() {
35884            params.push("maxResults", value.to_string());
35885        }
35886        if !self._ids.is_empty() {
35887            for f in self._ids.iter() {
35888                params.push("ids", f.to_string());
35889            }
35890        }
35891
35892        params.extend(self._additional_params.iter());
35893
35894        params.push("alt", "json");
35895        let mut url = self.hub._base_url.clone()
35896            + "userprofiles/{profileId}/creativeFields/{creativeFieldId}/creativeFieldValues";
35897        if self._scopes.is_empty() {
35898            self._scopes
35899                .insert(Scope::Dfatrafficking.as_ref().to_string());
35900        }
35901
35902        #[allow(clippy::single_element_loop)]
35903        for &(find_this, param_name) in [
35904            ("{profileId}", "profileId"),
35905            ("{creativeFieldId}", "creativeFieldId"),
35906        ]
35907        .iter()
35908        {
35909            url = params.uri_replacement(url, param_name, find_this, false);
35910        }
35911        {
35912            let to_remove = ["creativeFieldId", "profileId"];
35913            params.remove_params(&to_remove);
35914        }
35915
35916        let url = params.parse_with_url(&url);
35917
35918        loop {
35919            let token = match self
35920                .hub
35921                .auth
35922                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
35923                .await
35924            {
35925                Ok(token) => token,
35926                Err(e) => match dlg.token(e) {
35927                    Ok(token) => token,
35928                    Err(e) => {
35929                        dlg.finished(false);
35930                        return Err(common::Error::MissingToken(e));
35931                    }
35932                },
35933            };
35934            let mut req_result = {
35935                let client = &self.hub.client;
35936                dlg.pre_request();
35937                let mut req_builder = hyper::Request::builder()
35938                    .method(hyper::Method::GET)
35939                    .uri(url.as_str())
35940                    .header(USER_AGENT, self.hub._user_agent.clone());
35941
35942                if let Some(token) = token.as_ref() {
35943                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
35944                }
35945
35946                let request = req_builder
35947                    .header(CONTENT_LENGTH, 0_u64)
35948                    .body(common::to_body::<String>(None));
35949
35950                client.request(request.unwrap()).await
35951            };
35952
35953            match req_result {
35954                Err(err) => {
35955                    if let common::Retry::After(d) = dlg.http_error(&err) {
35956                        sleep(d).await;
35957                        continue;
35958                    }
35959                    dlg.finished(false);
35960                    return Err(common::Error::HttpError(err));
35961                }
35962                Ok(res) => {
35963                    let (mut parts, body) = res.into_parts();
35964                    let mut body = common::Body::new(body);
35965                    if !parts.status.is_success() {
35966                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35967                        let error = serde_json::from_str(&common::to_string(&bytes));
35968                        let response = common::to_response(parts, bytes.into());
35969
35970                        if let common::Retry::After(d) =
35971                            dlg.http_failure(&response, error.as_ref().ok())
35972                        {
35973                            sleep(d).await;
35974                            continue;
35975                        }
35976
35977                        dlg.finished(false);
35978
35979                        return Err(match error {
35980                            Ok(value) => common::Error::BadRequest(value),
35981                            _ => common::Error::Failure(response),
35982                        });
35983                    }
35984                    let response = {
35985                        let bytes = common::to_bytes(body).await.unwrap_or_default();
35986                        let encoded = common::to_string(&bytes);
35987                        match serde_json::from_str(&encoded) {
35988                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
35989                            Err(error) => {
35990                                dlg.response_json_decode_error(&encoded, &error);
35991                                return Err(common::Error::JsonDecodeError(
35992                                    encoded.to_string(),
35993                                    error,
35994                                ));
35995                            }
35996                        }
35997                    };
35998
35999                    dlg.finished(true);
36000                    return Ok(response);
36001                }
36002            }
36003        }
36004    }
36005
36006    /// User profile ID associated with this request.
36007    ///
36008    /// Sets the *profile id* path property to the given value.
36009    ///
36010    /// Even though the property as already been set when instantiating this call,
36011    /// we provide this method for API completeness.
36012    pub fn profile_id(mut self, new_value: i64) -> CreativeFieldValueListCall<'a, C> {
36013        self._profile_id = new_value;
36014        self
36015    }
36016    /// Creative field ID for this creative field value.
36017    ///
36018    /// Sets the *creative field id* path property to the given value.
36019    ///
36020    /// Even though the property as already been set when instantiating this call,
36021    /// we provide this method for API completeness.
36022    pub fn creative_field_id(mut self, new_value: i64) -> CreativeFieldValueListCall<'a, C> {
36023        self._creative_field_id = new_value;
36024        self
36025    }
36026    /// Order of sorted results.
36027    ///
36028    /// Sets the *sort order* query property to the given value.
36029    pub fn sort_order(mut self, new_value: &str) -> CreativeFieldValueListCall<'a, C> {
36030        self._sort_order = Some(new_value.to_string());
36031        self
36032    }
36033    /// Field by which to sort the list.
36034    ///
36035    /// Sets the *sort field* query property to the given value.
36036    pub fn sort_field(mut self, new_value: &str) -> CreativeFieldValueListCall<'a, C> {
36037        self._sort_field = Some(new_value.to_string());
36038        self
36039    }
36040    /// Allows searching for creative field values by their values. Wildcards (e.g. *) are not allowed.
36041    ///
36042    /// Sets the *search string* query property to the given value.
36043    pub fn search_string(mut self, new_value: &str) -> CreativeFieldValueListCall<'a, C> {
36044        self._search_string = Some(new_value.to_string());
36045        self
36046    }
36047    /// Value of the nextPageToken from the previous result page.
36048    ///
36049    /// Sets the *page token* query property to the given value.
36050    pub fn page_token(mut self, new_value: &str) -> CreativeFieldValueListCall<'a, C> {
36051        self._page_token = Some(new_value.to_string());
36052        self
36053    }
36054    /// Maximum number of results to return.
36055    ///
36056    /// Sets the *max results* query property to the given value.
36057    pub fn max_results(mut self, new_value: i32) -> CreativeFieldValueListCall<'a, C> {
36058        self._max_results = Some(new_value);
36059        self
36060    }
36061    /// Select only creative field values with these IDs.
36062    ///
36063    /// Append the given value to the *ids* query property.
36064    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
36065    pub fn add_ids(mut self, new_value: i64) -> CreativeFieldValueListCall<'a, C> {
36066        self._ids.push(new_value);
36067        self
36068    }
36069    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
36070    /// while executing the actual API request.
36071    ///
36072    /// ````text
36073    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
36074    /// ````
36075    ///
36076    /// Sets the *delegate* property to the given value.
36077    pub fn delegate(
36078        mut self,
36079        new_value: &'a mut dyn common::Delegate,
36080    ) -> CreativeFieldValueListCall<'a, C> {
36081        self._delegate = Some(new_value);
36082        self
36083    }
36084
36085    /// Set any additional parameter of the query string used in the request.
36086    /// It should be used to set parameters which are not yet available through their own
36087    /// setters.
36088    ///
36089    /// Please note that this method must not be used to set any of the known parameters
36090    /// which have their own setter method. If done anyway, the request will fail.
36091    ///
36092    /// # Additional Parameters
36093    ///
36094    /// * *$.xgafv* (query-string) - V1 error format.
36095    /// * *access_token* (query-string) - OAuth access token.
36096    /// * *alt* (query-string) - Data format for response.
36097    /// * *callback* (query-string) - JSONP
36098    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
36099    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
36100    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
36101    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
36102    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
36103    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
36104    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
36105    pub fn param<T>(mut self, name: T, value: T) -> CreativeFieldValueListCall<'a, C>
36106    where
36107        T: AsRef<str>,
36108    {
36109        self._additional_params
36110            .insert(name.as_ref().to_string(), value.as_ref().to_string());
36111        self
36112    }
36113
36114    /// Identifies the authorization scope for the method you are building.
36115    ///
36116    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
36117    /// [`Scope::Dfatrafficking`].
36118    ///
36119    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
36120    /// tokens for more than one scope.
36121    ///
36122    /// Usually there is more than one suitable scope to authorize an operation, some of which may
36123    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
36124    /// sufficient, a read-write scope will do as well.
36125    pub fn add_scope<St>(mut self, scope: St) -> CreativeFieldValueListCall<'a, C>
36126    where
36127        St: AsRef<str>,
36128    {
36129        self._scopes.insert(String::from(scope.as_ref()));
36130        self
36131    }
36132    /// Identifies the authorization scope(s) for the method you are building.
36133    ///
36134    /// See [`Self::add_scope()`] for details.
36135    pub fn add_scopes<I, St>(mut self, scopes: I) -> CreativeFieldValueListCall<'a, C>
36136    where
36137        I: IntoIterator<Item = St>,
36138        St: AsRef<str>,
36139    {
36140        self._scopes
36141            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
36142        self
36143    }
36144
36145    /// Removes all scopes, and no default scope will be used either.
36146    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
36147    /// for details).
36148    pub fn clear_scopes(mut self) -> CreativeFieldValueListCall<'a, C> {
36149        self._scopes.clear();
36150        self
36151    }
36152}
36153
36154/// Updates an existing creative field value. This method supports patch semantics.
36155///
36156/// A builder for the *patch* method supported by a *creativeFieldValue* resource.
36157/// It is not used directly, but through a [`CreativeFieldValueMethods`] instance.
36158///
36159/// # Example
36160///
36161/// Instantiate a resource method builder
36162///
36163/// ```test_harness,no_run
36164/// # extern crate hyper;
36165/// # extern crate hyper_rustls;
36166/// # extern crate google_dfareporting3d3 as dfareporting3d3;
36167/// use dfareporting3d3::api::CreativeFieldValue;
36168/// # async fn dox() {
36169/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
36170///
36171/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
36172/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
36173/// #     secret,
36174/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
36175/// # ).build().await.unwrap();
36176///
36177/// # let client = hyper_util::client::legacy::Client::builder(
36178/// #     hyper_util::rt::TokioExecutor::new()
36179/// # )
36180/// # .build(
36181/// #     hyper_rustls::HttpsConnectorBuilder::new()
36182/// #         .with_native_roots()
36183/// #         .unwrap()
36184/// #         .https_or_http()
36185/// #         .enable_http1()
36186/// #         .build()
36187/// # );
36188/// # let mut hub = Dfareporting::new(client, auth);
36189/// // As the method needs a request, you would usually fill it with the desired information
36190/// // into the respective structure. Some of the parts shown here might not be applicable !
36191/// // Values shown here are possibly random and not representative !
36192/// let mut req = CreativeFieldValue::default();
36193///
36194/// // You can configure optional parameters by calling the respective setters at will, and
36195/// // execute the final call using `doit()`.
36196/// // Values shown here are possibly random and not representative !
36197/// let result = hub.creative_field_values().patch(req, -95, -39, -10)
36198///              .doit().await;
36199/// # }
36200/// ```
36201pub struct CreativeFieldValuePatchCall<'a, C>
36202where
36203    C: 'a,
36204{
36205    hub: &'a Dfareporting<C>,
36206    _request: CreativeFieldValue,
36207    _profile_id: i64,
36208    _creative_field_id: i64,
36209    _id: i64,
36210    _delegate: Option<&'a mut dyn common::Delegate>,
36211    _additional_params: HashMap<String, String>,
36212    _scopes: BTreeSet<String>,
36213}
36214
36215impl<'a, C> common::CallBuilder for CreativeFieldValuePatchCall<'a, C> {}
36216
36217impl<'a, C> CreativeFieldValuePatchCall<'a, C>
36218where
36219    C: common::Connector,
36220{
36221    /// Perform the operation you have build so far.
36222    pub async fn doit(mut self) -> common::Result<(common::Response, CreativeFieldValue)> {
36223        use std::borrow::Cow;
36224        use std::io::{Read, Seek};
36225
36226        use common::{url::Params, ToParts};
36227        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
36228
36229        let mut dd = common::DefaultDelegate;
36230        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
36231        dlg.begin(common::MethodInfo {
36232            id: "dfareporting.creativeFieldValues.patch",
36233            http_method: hyper::Method::PATCH,
36234        });
36235
36236        for &field in ["alt", "profileId", "creativeFieldId", "id"].iter() {
36237            if self._additional_params.contains_key(field) {
36238                dlg.finished(false);
36239                return Err(common::Error::FieldClash(field));
36240            }
36241        }
36242
36243        let mut params = Params::with_capacity(6 + self._additional_params.len());
36244        params.push("profileId", self._profile_id.to_string());
36245        params.push("creativeFieldId", self._creative_field_id.to_string());
36246        params.push("id", self._id.to_string());
36247
36248        params.extend(self._additional_params.iter());
36249
36250        params.push("alt", "json");
36251        let mut url = self.hub._base_url.clone()
36252            + "userprofiles/{profileId}/creativeFields/{creativeFieldId}/creativeFieldValues";
36253        if self._scopes.is_empty() {
36254            self._scopes
36255                .insert(Scope::Dfatrafficking.as_ref().to_string());
36256        }
36257
36258        #[allow(clippy::single_element_loop)]
36259        for &(find_this, param_name) in [
36260            ("{profileId}", "profileId"),
36261            ("{creativeFieldId}", "creativeFieldId"),
36262        ]
36263        .iter()
36264        {
36265            url = params.uri_replacement(url, param_name, find_this, false);
36266        }
36267        {
36268            let to_remove = ["creativeFieldId", "profileId"];
36269            params.remove_params(&to_remove);
36270        }
36271
36272        let url = params.parse_with_url(&url);
36273
36274        let mut json_mime_type = mime::APPLICATION_JSON;
36275        let mut request_value_reader = {
36276            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
36277            common::remove_json_null_values(&mut value);
36278            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
36279            serde_json::to_writer(&mut dst, &value).unwrap();
36280            dst
36281        };
36282        let request_size = request_value_reader
36283            .seek(std::io::SeekFrom::End(0))
36284            .unwrap();
36285        request_value_reader
36286            .seek(std::io::SeekFrom::Start(0))
36287            .unwrap();
36288
36289        loop {
36290            let token = match self
36291                .hub
36292                .auth
36293                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
36294                .await
36295            {
36296                Ok(token) => token,
36297                Err(e) => match dlg.token(e) {
36298                    Ok(token) => token,
36299                    Err(e) => {
36300                        dlg.finished(false);
36301                        return Err(common::Error::MissingToken(e));
36302                    }
36303                },
36304            };
36305            request_value_reader
36306                .seek(std::io::SeekFrom::Start(0))
36307                .unwrap();
36308            let mut req_result = {
36309                let client = &self.hub.client;
36310                dlg.pre_request();
36311                let mut req_builder = hyper::Request::builder()
36312                    .method(hyper::Method::PATCH)
36313                    .uri(url.as_str())
36314                    .header(USER_AGENT, self.hub._user_agent.clone());
36315
36316                if let Some(token) = token.as_ref() {
36317                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
36318                }
36319
36320                let request = req_builder
36321                    .header(CONTENT_TYPE, json_mime_type.to_string())
36322                    .header(CONTENT_LENGTH, request_size as u64)
36323                    .body(common::to_body(
36324                        request_value_reader.get_ref().clone().into(),
36325                    ));
36326
36327                client.request(request.unwrap()).await
36328            };
36329
36330            match req_result {
36331                Err(err) => {
36332                    if let common::Retry::After(d) = dlg.http_error(&err) {
36333                        sleep(d).await;
36334                        continue;
36335                    }
36336                    dlg.finished(false);
36337                    return Err(common::Error::HttpError(err));
36338                }
36339                Ok(res) => {
36340                    let (mut parts, body) = res.into_parts();
36341                    let mut body = common::Body::new(body);
36342                    if !parts.status.is_success() {
36343                        let bytes = common::to_bytes(body).await.unwrap_or_default();
36344                        let error = serde_json::from_str(&common::to_string(&bytes));
36345                        let response = common::to_response(parts, bytes.into());
36346
36347                        if let common::Retry::After(d) =
36348                            dlg.http_failure(&response, error.as_ref().ok())
36349                        {
36350                            sleep(d).await;
36351                            continue;
36352                        }
36353
36354                        dlg.finished(false);
36355
36356                        return Err(match error {
36357                            Ok(value) => common::Error::BadRequest(value),
36358                            _ => common::Error::Failure(response),
36359                        });
36360                    }
36361                    let response = {
36362                        let bytes = common::to_bytes(body).await.unwrap_or_default();
36363                        let encoded = common::to_string(&bytes);
36364                        match serde_json::from_str(&encoded) {
36365                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
36366                            Err(error) => {
36367                                dlg.response_json_decode_error(&encoded, &error);
36368                                return Err(common::Error::JsonDecodeError(
36369                                    encoded.to_string(),
36370                                    error,
36371                                ));
36372                            }
36373                        }
36374                    };
36375
36376                    dlg.finished(true);
36377                    return Ok(response);
36378                }
36379            }
36380        }
36381    }
36382
36383    ///
36384    /// Sets the *request* property to the given value.
36385    ///
36386    /// Even though the property as already been set when instantiating this call,
36387    /// we provide this method for API completeness.
36388    pub fn request(mut self, new_value: CreativeFieldValue) -> CreativeFieldValuePatchCall<'a, C> {
36389        self._request = new_value;
36390        self
36391    }
36392    /// User profile ID associated with this request.
36393    ///
36394    /// Sets the *profile id* path property to the given value.
36395    ///
36396    /// Even though the property as already been set when instantiating this call,
36397    /// we provide this method for API completeness.
36398    pub fn profile_id(mut self, new_value: i64) -> CreativeFieldValuePatchCall<'a, C> {
36399        self._profile_id = new_value;
36400        self
36401    }
36402    /// CreativeField ID.
36403    ///
36404    /// Sets the *creative field id* path property to the given value.
36405    ///
36406    /// Even though the property as already been set when instantiating this call,
36407    /// we provide this method for API completeness.
36408    pub fn creative_field_id(mut self, new_value: i64) -> CreativeFieldValuePatchCall<'a, C> {
36409        self._creative_field_id = new_value;
36410        self
36411    }
36412    /// CreativeFieldValue ID.
36413    ///
36414    /// Sets the *id* query property to the given value.
36415    ///
36416    /// Even though the property as already been set when instantiating this call,
36417    /// we provide this method for API completeness.
36418    pub fn id(mut self, new_value: i64) -> CreativeFieldValuePatchCall<'a, C> {
36419        self._id = new_value;
36420        self
36421    }
36422    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
36423    /// while executing the actual API request.
36424    ///
36425    /// ````text
36426    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
36427    /// ````
36428    ///
36429    /// Sets the *delegate* property to the given value.
36430    pub fn delegate(
36431        mut self,
36432        new_value: &'a mut dyn common::Delegate,
36433    ) -> CreativeFieldValuePatchCall<'a, C> {
36434        self._delegate = Some(new_value);
36435        self
36436    }
36437
36438    /// Set any additional parameter of the query string used in the request.
36439    /// It should be used to set parameters which are not yet available through their own
36440    /// setters.
36441    ///
36442    /// Please note that this method must not be used to set any of the known parameters
36443    /// which have their own setter method. If done anyway, the request will fail.
36444    ///
36445    /// # Additional Parameters
36446    ///
36447    /// * *$.xgafv* (query-string) - V1 error format.
36448    /// * *access_token* (query-string) - OAuth access token.
36449    /// * *alt* (query-string) - Data format for response.
36450    /// * *callback* (query-string) - JSONP
36451    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
36452    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
36453    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
36454    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
36455    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
36456    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
36457    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
36458    pub fn param<T>(mut self, name: T, value: T) -> CreativeFieldValuePatchCall<'a, C>
36459    where
36460        T: AsRef<str>,
36461    {
36462        self._additional_params
36463            .insert(name.as_ref().to_string(), value.as_ref().to_string());
36464        self
36465    }
36466
36467    /// Identifies the authorization scope for the method you are building.
36468    ///
36469    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
36470    /// [`Scope::Dfatrafficking`].
36471    ///
36472    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
36473    /// tokens for more than one scope.
36474    ///
36475    /// Usually there is more than one suitable scope to authorize an operation, some of which may
36476    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
36477    /// sufficient, a read-write scope will do as well.
36478    pub fn add_scope<St>(mut self, scope: St) -> CreativeFieldValuePatchCall<'a, C>
36479    where
36480        St: AsRef<str>,
36481    {
36482        self._scopes.insert(String::from(scope.as_ref()));
36483        self
36484    }
36485    /// Identifies the authorization scope(s) for the method you are building.
36486    ///
36487    /// See [`Self::add_scope()`] for details.
36488    pub fn add_scopes<I, St>(mut self, scopes: I) -> CreativeFieldValuePatchCall<'a, C>
36489    where
36490        I: IntoIterator<Item = St>,
36491        St: AsRef<str>,
36492    {
36493        self._scopes
36494            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
36495        self
36496    }
36497
36498    /// Removes all scopes, and no default scope will be used either.
36499    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
36500    /// for details).
36501    pub fn clear_scopes(mut self) -> CreativeFieldValuePatchCall<'a, C> {
36502        self._scopes.clear();
36503        self
36504    }
36505}
36506
36507/// Updates an existing creative field value.
36508///
36509/// A builder for the *update* method supported by a *creativeFieldValue* resource.
36510/// It is not used directly, but through a [`CreativeFieldValueMethods`] instance.
36511///
36512/// # Example
36513///
36514/// Instantiate a resource method builder
36515///
36516/// ```test_harness,no_run
36517/// # extern crate hyper;
36518/// # extern crate hyper_rustls;
36519/// # extern crate google_dfareporting3d3 as dfareporting3d3;
36520/// use dfareporting3d3::api::CreativeFieldValue;
36521/// # async fn dox() {
36522/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
36523///
36524/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
36525/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
36526/// #     secret,
36527/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
36528/// # ).build().await.unwrap();
36529///
36530/// # let client = hyper_util::client::legacy::Client::builder(
36531/// #     hyper_util::rt::TokioExecutor::new()
36532/// # )
36533/// # .build(
36534/// #     hyper_rustls::HttpsConnectorBuilder::new()
36535/// #         .with_native_roots()
36536/// #         .unwrap()
36537/// #         .https_or_http()
36538/// #         .enable_http1()
36539/// #         .build()
36540/// # );
36541/// # let mut hub = Dfareporting::new(client, auth);
36542/// // As the method needs a request, you would usually fill it with the desired information
36543/// // into the respective structure. Some of the parts shown here might not be applicable !
36544/// // Values shown here are possibly random and not representative !
36545/// let mut req = CreativeFieldValue::default();
36546///
36547/// // You can configure optional parameters by calling the respective setters at will, and
36548/// // execute the final call using `doit()`.
36549/// // Values shown here are possibly random and not representative !
36550/// let result = hub.creative_field_values().update(req, -74, -56)
36551///              .doit().await;
36552/// # }
36553/// ```
36554pub struct CreativeFieldValueUpdateCall<'a, C>
36555where
36556    C: 'a,
36557{
36558    hub: &'a Dfareporting<C>,
36559    _request: CreativeFieldValue,
36560    _profile_id: i64,
36561    _creative_field_id: i64,
36562    _delegate: Option<&'a mut dyn common::Delegate>,
36563    _additional_params: HashMap<String, String>,
36564    _scopes: BTreeSet<String>,
36565}
36566
36567impl<'a, C> common::CallBuilder for CreativeFieldValueUpdateCall<'a, C> {}
36568
36569impl<'a, C> CreativeFieldValueUpdateCall<'a, C>
36570where
36571    C: common::Connector,
36572{
36573    /// Perform the operation you have build so far.
36574    pub async fn doit(mut self) -> common::Result<(common::Response, CreativeFieldValue)> {
36575        use std::borrow::Cow;
36576        use std::io::{Read, Seek};
36577
36578        use common::{url::Params, ToParts};
36579        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
36580
36581        let mut dd = common::DefaultDelegate;
36582        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
36583        dlg.begin(common::MethodInfo {
36584            id: "dfareporting.creativeFieldValues.update",
36585            http_method: hyper::Method::PUT,
36586        });
36587
36588        for &field in ["alt", "profileId", "creativeFieldId"].iter() {
36589            if self._additional_params.contains_key(field) {
36590                dlg.finished(false);
36591                return Err(common::Error::FieldClash(field));
36592            }
36593        }
36594
36595        let mut params = Params::with_capacity(5 + self._additional_params.len());
36596        params.push("profileId", self._profile_id.to_string());
36597        params.push("creativeFieldId", self._creative_field_id.to_string());
36598
36599        params.extend(self._additional_params.iter());
36600
36601        params.push("alt", "json");
36602        let mut url = self.hub._base_url.clone()
36603            + "userprofiles/{profileId}/creativeFields/{creativeFieldId}/creativeFieldValues";
36604        if self._scopes.is_empty() {
36605            self._scopes
36606                .insert(Scope::Dfatrafficking.as_ref().to_string());
36607        }
36608
36609        #[allow(clippy::single_element_loop)]
36610        for &(find_this, param_name) in [
36611            ("{profileId}", "profileId"),
36612            ("{creativeFieldId}", "creativeFieldId"),
36613        ]
36614        .iter()
36615        {
36616            url = params.uri_replacement(url, param_name, find_this, false);
36617        }
36618        {
36619            let to_remove = ["creativeFieldId", "profileId"];
36620            params.remove_params(&to_remove);
36621        }
36622
36623        let url = params.parse_with_url(&url);
36624
36625        let mut json_mime_type = mime::APPLICATION_JSON;
36626        let mut request_value_reader = {
36627            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
36628            common::remove_json_null_values(&mut value);
36629            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
36630            serde_json::to_writer(&mut dst, &value).unwrap();
36631            dst
36632        };
36633        let request_size = request_value_reader
36634            .seek(std::io::SeekFrom::End(0))
36635            .unwrap();
36636        request_value_reader
36637            .seek(std::io::SeekFrom::Start(0))
36638            .unwrap();
36639
36640        loop {
36641            let token = match self
36642                .hub
36643                .auth
36644                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
36645                .await
36646            {
36647                Ok(token) => token,
36648                Err(e) => match dlg.token(e) {
36649                    Ok(token) => token,
36650                    Err(e) => {
36651                        dlg.finished(false);
36652                        return Err(common::Error::MissingToken(e));
36653                    }
36654                },
36655            };
36656            request_value_reader
36657                .seek(std::io::SeekFrom::Start(0))
36658                .unwrap();
36659            let mut req_result = {
36660                let client = &self.hub.client;
36661                dlg.pre_request();
36662                let mut req_builder = hyper::Request::builder()
36663                    .method(hyper::Method::PUT)
36664                    .uri(url.as_str())
36665                    .header(USER_AGENT, self.hub._user_agent.clone());
36666
36667                if let Some(token) = token.as_ref() {
36668                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
36669                }
36670
36671                let request = req_builder
36672                    .header(CONTENT_TYPE, json_mime_type.to_string())
36673                    .header(CONTENT_LENGTH, request_size as u64)
36674                    .body(common::to_body(
36675                        request_value_reader.get_ref().clone().into(),
36676                    ));
36677
36678                client.request(request.unwrap()).await
36679            };
36680
36681            match req_result {
36682                Err(err) => {
36683                    if let common::Retry::After(d) = dlg.http_error(&err) {
36684                        sleep(d).await;
36685                        continue;
36686                    }
36687                    dlg.finished(false);
36688                    return Err(common::Error::HttpError(err));
36689                }
36690                Ok(res) => {
36691                    let (mut parts, body) = res.into_parts();
36692                    let mut body = common::Body::new(body);
36693                    if !parts.status.is_success() {
36694                        let bytes = common::to_bytes(body).await.unwrap_or_default();
36695                        let error = serde_json::from_str(&common::to_string(&bytes));
36696                        let response = common::to_response(parts, bytes.into());
36697
36698                        if let common::Retry::After(d) =
36699                            dlg.http_failure(&response, error.as_ref().ok())
36700                        {
36701                            sleep(d).await;
36702                            continue;
36703                        }
36704
36705                        dlg.finished(false);
36706
36707                        return Err(match error {
36708                            Ok(value) => common::Error::BadRequest(value),
36709                            _ => common::Error::Failure(response),
36710                        });
36711                    }
36712                    let response = {
36713                        let bytes = common::to_bytes(body).await.unwrap_or_default();
36714                        let encoded = common::to_string(&bytes);
36715                        match serde_json::from_str(&encoded) {
36716                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
36717                            Err(error) => {
36718                                dlg.response_json_decode_error(&encoded, &error);
36719                                return Err(common::Error::JsonDecodeError(
36720                                    encoded.to_string(),
36721                                    error,
36722                                ));
36723                            }
36724                        }
36725                    };
36726
36727                    dlg.finished(true);
36728                    return Ok(response);
36729                }
36730            }
36731        }
36732    }
36733
36734    ///
36735    /// Sets the *request* property to the given value.
36736    ///
36737    /// Even though the property as already been set when instantiating this call,
36738    /// we provide this method for API completeness.
36739    pub fn request(mut self, new_value: CreativeFieldValue) -> CreativeFieldValueUpdateCall<'a, C> {
36740        self._request = new_value;
36741        self
36742    }
36743    /// User profile ID associated with this request.
36744    ///
36745    /// Sets the *profile id* path property to the given value.
36746    ///
36747    /// Even though the property as already been set when instantiating this call,
36748    /// we provide this method for API completeness.
36749    pub fn profile_id(mut self, new_value: i64) -> CreativeFieldValueUpdateCall<'a, C> {
36750        self._profile_id = new_value;
36751        self
36752    }
36753    /// Creative field ID for this creative field value.
36754    ///
36755    /// Sets the *creative field id* path property to the given value.
36756    ///
36757    /// Even though the property as already been set when instantiating this call,
36758    /// we provide this method for API completeness.
36759    pub fn creative_field_id(mut self, new_value: i64) -> CreativeFieldValueUpdateCall<'a, C> {
36760        self._creative_field_id = new_value;
36761        self
36762    }
36763    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
36764    /// while executing the actual API request.
36765    ///
36766    /// ````text
36767    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
36768    /// ````
36769    ///
36770    /// Sets the *delegate* property to the given value.
36771    pub fn delegate(
36772        mut self,
36773        new_value: &'a mut dyn common::Delegate,
36774    ) -> CreativeFieldValueUpdateCall<'a, C> {
36775        self._delegate = Some(new_value);
36776        self
36777    }
36778
36779    /// Set any additional parameter of the query string used in the request.
36780    /// It should be used to set parameters which are not yet available through their own
36781    /// setters.
36782    ///
36783    /// Please note that this method must not be used to set any of the known parameters
36784    /// which have their own setter method. If done anyway, the request will fail.
36785    ///
36786    /// # Additional Parameters
36787    ///
36788    /// * *$.xgafv* (query-string) - V1 error format.
36789    /// * *access_token* (query-string) - OAuth access token.
36790    /// * *alt* (query-string) - Data format for response.
36791    /// * *callback* (query-string) - JSONP
36792    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
36793    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
36794    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
36795    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
36796    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
36797    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
36798    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
36799    pub fn param<T>(mut self, name: T, value: T) -> CreativeFieldValueUpdateCall<'a, C>
36800    where
36801        T: AsRef<str>,
36802    {
36803        self._additional_params
36804            .insert(name.as_ref().to_string(), value.as_ref().to_string());
36805        self
36806    }
36807
36808    /// Identifies the authorization scope for the method you are building.
36809    ///
36810    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
36811    /// [`Scope::Dfatrafficking`].
36812    ///
36813    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
36814    /// tokens for more than one scope.
36815    ///
36816    /// Usually there is more than one suitable scope to authorize an operation, some of which may
36817    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
36818    /// sufficient, a read-write scope will do as well.
36819    pub fn add_scope<St>(mut self, scope: St) -> CreativeFieldValueUpdateCall<'a, C>
36820    where
36821        St: AsRef<str>,
36822    {
36823        self._scopes.insert(String::from(scope.as_ref()));
36824        self
36825    }
36826    /// Identifies the authorization scope(s) for the method you are building.
36827    ///
36828    /// See [`Self::add_scope()`] for details.
36829    pub fn add_scopes<I, St>(mut self, scopes: I) -> CreativeFieldValueUpdateCall<'a, C>
36830    where
36831        I: IntoIterator<Item = St>,
36832        St: AsRef<str>,
36833    {
36834        self._scopes
36835            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
36836        self
36837    }
36838
36839    /// Removes all scopes, and no default scope will be used either.
36840    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
36841    /// for details).
36842    pub fn clear_scopes(mut self) -> CreativeFieldValueUpdateCall<'a, C> {
36843        self._scopes.clear();
36844        self
36845    }
36846}
36847
36848/// Deletes an existing creative field.
36849///
36850/// A builder for the *delete* method supported by a *creativeField* resource.
36851/// It is not used directly, but through a [`CreativeFieldMethods`] instance.
36852///
36853/// # Example
36854///
36855/// Instantiate a resource method builder
36856///
36857/// ```test_harness,no_run
36858/// # extern crate hyper;
36859/// # extern crate hyper_rustls;
36860/// # extern crate google_dfareporting3d3 as dfareporting3d3;
36861/// # async fn dox() {
36862/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
36863///
36864/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
36865/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
36866/// #     secret,
36867/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
36868/// # ).build().await.unwrap();
36869///
36870/// # let client = hyper_util::client::legacy::Client::builder(
36871/// #     hyper_util::rt::TokioExecutor::new()
36872/// # )
36873/// # .build(
36874/// #     hyper_rustls::HttpsConnectorBuilder::new()
36875/// #         .with_native_roots()
36876/// #         .unwrap()
36877/// #         .https_or_http()
36878/// #         .enable_http1()
36879/// #         .build()
36880/// # );
36881/// # let mut hub = Dfareporting::new(client, auth);
36882/// // You can configure optional parameters by calling the respective setters at will, and
36883/// // execute the final call using `doit()`.
36884/// // Values shown here are possibly random and not representative !
36885/// let result = hub.creative_fields().delete(-33, -59)
36886///              .doit().await;
36887/// # }
36888/// ```
36889pub struct CreativeFieldDeleteCall<'a, C>
36890where
36891    C: 'a,
36892{
36893    hub: &'a Dfareporting<C>,
36894    _profile_id: i64,
36895    _id: i64,
36896    _delegate: Option<&'a mut dyn common::Delegate>,
36897    _additional_params: HashMap<String, String>,
36898    _scopes: BTreeSet<String>,
36899}
36900
36901impl<'a, C> common::CallBuilder for CreativeFieldDeleteCall<'a, C> {}
36902
36903impl<'a, C> CreativeFieldDeleteCall<'a, C>
36904where
36905    C: common::Connector,
36906{
36907    /// Perform the operation you have build so far.
36908    pub async fn doit(mut self) -> common::Result<common::Response> {
36909        use std::borrow::Cow;
36910        use std::io::{Read, Seek};
36911
36912        use common::{url::Params, ToParts};
36913        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
36914
36915        let mut dd = common::DefaultDelegate;
36916        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
36917        dlg.begin(common::MethodInfo {
36918            id: "dfareporting.creativeFields.delete",
36919            http_method: hyper::Method::DELETE,
36920        });
36921
36922        for &field in ["profileId", "id"].iter() {
36923            if self._additional_params.contains_key(field) {
36924                dlg.finished(false);
36925                return Err(common::Error::FieldClash(field));
36926            }
36927        }
36928
36929        let mut params = Params::with_capacity(3 + self._additional_params.len());
36930        params.push("profileId", self._profile_id.to_string());
36931        params.push("id", self._id.to_string());
36932
36933        params.extend(self._additional_params.iter());
36934
36935        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creativeFields/{id}";
36936        if self._scopes.is_empty() {
36937            self._scopes
36938                .insert(Scope::Dfatrafficking.as_ref().to_string());
36939        }
36940
36941        #[allow(clippy::single_element_loop)]
36942        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
36943            url = params.uri_replacement(url, param_name, find_this, false);
36944        }
36945        {
36946            let to_remove = ["id", "profileId"];
36947            params.remove_params(&to_remove);
36948        }
36949
36950        let url = params.parse_with_url(&url);
36951
36952        loop {
36953            let token = match self
36954                .hub
36955                .auth
36956                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
36957                .await
36958            {
36959                Ok(token) => token,
36960                Err(e) => match dlg.token(e) {
36961                    Ok(token) => token,
36962                    Err(e) => {
36963                        dlg.finished(false);
36964                        return Err(common::Error::MissingToken(e));
36965                    }
36966                },
36967            };
36968            let mut req_result = {
36969                let client = &self.hub.client;
36970                dlg.pre_request();
36971                let mut req_builder = hyper::Request::builder()
36972                    .method(hyper::Method::DELETE)
36973                    .uri(url.as_str())
36974                    .header(USER_AGENT, self.hub._user_agent.clone());
36975
36976                if let Some(token) = token.as_ref() {
36977                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
36978                }
36979
36980                let request = req_builder
36981                    .header(CONTENT_LENGTH, 0_u64)
36982                    .body(common::to_body::<String>(None));
36983
36984                client.request(request.unwrap()).await
36985            };
36986
36987            match req_result {
36988                Err(err) => {
36989                    if let common::Retry::After(d) = dlg.http_error(&err) {
36990                        sleep(d).await;
36991                        continue;
36992                    }
36993                    dlg.finished(false);
36994                    return Err(common::Error::HttpError(err));
36995                }
36996                Ok(res) => {
36997                    let (mut parts, body) = res.into_parts();
36998                    let mut body = common::Body::new(body);
36999                    if !parts.status.is_success() {
37000                        let bytes = common::to_bytes(body).await.unwrap_or_default();
37001                        let error = serde_json::from_str(&common::to_string(&bytes));
37002                        let response = common::to_response(parts, bytes.into());
37003
37004                        if let common::Retry::After(d) =
37005                            dlg.http_failure(&response, error.as_ref().ok())
37006                        {
37007                            sleep(d).await;
37008                            continue;
37009                        }
37010
37011                        dlg.finished(false);
37012
37013                        return Err(match error {
37014                            Ok(value) => common::Error::BadRequest(value),
37015                            _ => common::Error::Failure(response),
37016                        });
37017                    }
37018                    let response = common::Response::from_parts(parts, body);
37019
37020                    dlg.finished(true);
37021                    return Ok(response);
37022                }
37023            }
37024        }
37025    }
37026
37027    /// User profile ID associated with this request.
37028    ///
37029    /// Sets the *profile id* path property to the given value.
37030    ///
37031    /// Even though the property as already been set when instantiating this call,
37032    /// we provide this method for API completeness.
37033    pub fn profile_id(mut self, new_value: i64) -> CreativeFieldDeleteCall<'a, C> {
37034        self._profile_id = new_value;
37035        self
37036    }
37037    /// Creative Field ID
37038    ///
37039    /// Sets the *id* path property to the given value.
37040    ///
37041    /// Even though the property as already been set when instantiating this call,
37042    /// we provide this method for API completeness.
37043    pub fn id(mut self, new_value: i64) -> CreativeFieldDeleteCall<'a, C> {
37044        self._id = new_value;
37045        self
37046    }
37047    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
37048    /// while executing the actual API request.
37049    ///
37050    /// ````text
37051    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
37052    /// ````
37053    ///
37054    /// Sets the *delegate* property to the given value.
37055    pub fn delegate(
37056        mut self,
37057        new_value: &'a mut dyn common::Delegate,
37058    ) -> CreativeFieldDeleteCall<'a, C> {
37059        self._delegate = Some(new_value);
37060        self
37061    }
37062
37063    /// Set any additional parameter of the query string used in the request.
37064    /// It should be used to set parameters which are not yet available through their own
37065    /// setters.
37066    ///
37067    /// Please note that this method must not be used to set any of the known parameters
37068    /// which have their own setter method. If done anyway, the request will fail.
37069    ///
37070    /// # Additional Parameters
37071    ///
37072    /// * *$.xgafv* (query-string) - V1 error format.
37073    /// * *access_token* (query-string) - OAuth access token.
37074    /// * *alt* (query-string) - Data format for response.
37075    /// * *callback* (query-string) - JSONP
37076    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
37077    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
37078    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
37079    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
37080    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
37081    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
37082    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
37083    pub fn param<T>(mut self, name: T, value: T) -> CreativeFieldDeleteCall<'a, C>
37084    where
37085        T: AsRef<str>,
37086    {
37087        self._additional_params
37088            .insert(name.as_ref().to_string(), value.as_ref().to_string());
37089        self
37090    }
37091
37092    /// Identifies the authorization scope for the method you are building.
37093    ///
37094    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
37095    /// [`Scope::Dfatrafficking`].
37096    ///
37097    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
37098    /// tokens for more than one scope.
37099    ///
37100    /// Usually there is more than one suitable scope to authorize an operation, some of which may
37101    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
37102    /// sufficient, a read-write scope will do as well.
37103    pub fn add_scope<St>(mut self, scope: St) -> CreativeFieldDeleteCall<'a, C>
37104    where
37105        St: AsRef<str>,
37106    {
37107        self._scopes.insert(String::from(scope.as_ref()));
37108        self
37109    }
37110    /// Identifies the authorization scope(s) for the method you are building.
37111    ///
37112    /// See [`Self::add_scope()`] for details.
37113    pub fn add_scopes<I, St>(mut self, scopes: I) -> CreativeFieldDeleteCall<'a, C>
37114    where
37115        I: IntoIterator<Item = St>,
37116        St: AsRef<str>,
37117    {
37118        self._scopes
37119            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
37120        self
37121    }
37122
37123    /// Removes all scopes, and no default scope will be used either.
37124    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
37125    /// for details).
37126    pub fn clear_scopes(mut self) -> CreativeFieldDeleteCall<'a, C> {
37127        self._scopes.clear();
37128        self
37129    }
37130}
37131
37132/// Gets one creative field by ID.
37133///
37134/// A builder for the *get* method supported by a *creativeField* resource.
37135/// It is not used directly, but through a [`CreativeFieldMethods`] instance.
37136///
37137/// # Example
37138///
37139/// Instantiate a resource method builder
37140///
37141/// ```test_harness,no_run
37142/// # extern crate hyper;
37143/// # extern crate hyper_rustls;
37144/// # extern crate google_dfareporting3d3 as dfareporting3d3;
37145/// # async fn dox() {
37146/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
37147///
37148/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
37149/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
37150/// #     secret,
37151/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
37152/// # ).build().await.unwrap();
37153///
37154/// # let client = hyper_util::client::legacy::Client::builder(
37155/// #     hyper_util::rt::TokioExecutor::new()
37156/// # )
37157/// # .build(
37158/// #     hyper_rustls::HttpsConnectorBuilder::new()
37159/// #         .with_native_roots()
37160/// #         .unwrap()
37161/// #         .https_or_http()
37162/// #         .enable_http1()
37163/// #         .build()
37164/// # );
37165/// # let mut hub = Dfareporting::new(client, auth);
37166/// // You can configure optional parameters by calling the respective setters at will, and
37167/// // execute the final call using `doit()`.
37168/// // Values shown here are possibly random and not representative !
37169/// let result = hub.creative_fields().get(-66, -27)
37170///              .doit().await;
37171/// # }
37172/// ```
37173pub struct CreativeFieldGetCall<'a, C>
37174where
37175    C: 'a,
37176{
37177    hub: &'a Dfareporting<C>,
37178    _profile_id: i64,
37179    _id: i64,
37180    _delegate: Option<&'a mut dyn common::Delegate>,
37181    _additional_params: HashMap<String, String>,
37182    _scopes: BTreeSet<String>,
37183}
37184
37185impl<'a, C> common::CallBuilder for CreativeFieldGetCall<'a, C> {}
37186
37187impl<'a, C> CreativeFieldGetCall<'a, C>
37188where
37189    C: common::Connector,
37190{
37191    /// Perform the operation you have build so far.
37192    pub async fn doit(mut self) -> common::Result<(common::Response, CreativeField)> {
37193        use std::borrow::Cow;
37194        use std::io::{Read, Seek};
37195
37196        use common::{url::Params, ToParts};
37197        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
37198
37199        let mut dd = common::DefaultDelegate;
37200        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
37201        dlg.begin(common::MethodInfo {
37202            id: "dfareporting.creativeFields.get",
37203            http_method: hyper::Method::GET,
37204        });
37205
37206        for &field in ["alt", "profileId", "id"].iter() {
37207            if self._additional_params.contains_key(field) {
37208                dlg.finished(false);
37209                return Err(common::Error::FieldClash(field));
37210            }
37211        }
37212
37213        let mut params = Params::with_capacity(4 + self._additional_params.len());
37214        params.push("profileId", self._profile_id.to_string());
37215        params.push("id", self._id.to_string());
37216
37217        params.extend(self._additional_params.iter());
37218
37219        params.push("alt", "json");
37220        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creativeFields/{id}";
37221        if self._scopes.is_empty() {
37222            self._scopes
37223                .insert(Scope::Dfatrafficking.as_ref().to_string());
37224        }
37225
37226        #[allow(clippy::single_element_loop)]
37227        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
37228            url = params.uri_replacement(url, param_name, find_this, false);
37229        }
37230        {
37231            let to_remove = ["id", "profileId"];
37232            params.remove_params(&to_remove);
37233        }
37234
37235        let url = params.parse_with_url(&url);
37236
37237        loop {
37238            let token = match self
37239                .hub
37240                .auth
37241                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
37242                .await
37243            {
37244                Ok(token) => token,
37245                Err(e) => match dlg.token(e) {
37246                    Ok(token) => token,
37247                    Err(e) => {
37248                        dlg.finished(false);
37249                        return Err(common::Error::MissingToken(e));
37250                    }
37251                },
37252            };
37253            let mut req_result = {
37254                let client = &self.hub.client;
37255                dlg.pre_request();
37256                let mut req_builder = hyper::Request::builder()
37257                    .method(hyper::Method::GET)
37258                    .uri(url.as_str())
37259                    .header(USER_AGENT, self.hub._user_agent.clone());
37260
37261                if let Some(token) = token.as_ref() {
37262                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
37263                }
37264
37265                let request = req_builder
37266                    .header(CONTENT_LENGTH, 0_u64)
37267                    .body(common::to_body::<String>(None));
37268
37269                client.request(request.unwrap()).await
37270            };
37271
37272            match req_result {
37273                Err(err) => {
37274                    if let common::Retry::After(d) = dlg.http_error(&err) {
37275                        sleep(d).await;
37276                        continue;
37277                    }
37278                    dlg.finished(false);
37279                    return Err(common::Error::HttpError(err));
37280                }
37281                Ok(res) => {
37282                    let (mut parts, body) = res.into_parts();
37283                    let mut body = common::Body::new(body);
37284                    if !parts.status.is_success() {
37285                        let bytes = common::to_bytes(body).await.unwrap_or_default();
37286                        let error = serde_json::from_str(&common::to_string(&bytes));
37287                        let response = common::to_response(parts, bytes.into());
37288
37289                        if let common::Retry::After(d) =
37290                            dlg.http_failure(&response, error.as_ref().ok())
37291                        {
37292                            sleep(d).await;
37293                            continue;
37294                        }
37295
37296                        dlg.finished(false);
37297
37298                        return Err(match error {
37299                            Ok(value) => common::Error::BadRequest(value),
37300                            _ => common::Error::Failure(response),
37301                        });
37302                    }
37303                    let response = {
37304                        let bytes = common::to_bytes(body).await.unwrap_or_default();
37305                        let encoded = common::to_string(&bytes);
37306                        match serde_json::from_str(&encoded) {
37307                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
37308                            Err(error) => {
37309                                dlg.response_json_decode_error(&encoded, &error);
37310                                return Err(common::Error::JsonDecodeError(
37311                                    encoded.to_string(),
37312                                    error,
37313                                ));
37314                            }
37315                        }
37316                    };
37317
37318                    dlg.finished(true);
37319                    return Ok(response);
37320                }
37321            }
37322        }
37323    }
37324
37325    /// User profile ID associated with this request.
37326    ///
37327    /// Sets the *profile id* path property to the given value.
37328    ///
37329    /// Even though the property as already been set when instantiating this call,
37330    /// we provide this method for API completeness.
37331    pub fn profile_id(mut self, new_value: i64) -> CreativeFieldGetCall<'a, C> {
37332        self._profile_id = new_value;
37333        self
37334    }
37335    /// Creative Field ID
37336    ///
37337    /// Sets the *id* path property to the given value.
37338    ///
37339    /// Even though the property as already been set when instantiating this call,
37340    /// we provide this method for API completeness.
37341    pub fn id(mut self, new_value: i64) -> CreativeFieldGetCall<'a, C> {
37342        self._id = new_value;
37343        self
37344    }
37345    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
37346    /// while executing the actual API request.
37347    ///
37348    /// ````text
37349    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
37350    /// ````
37351    ///
37352    /// Sets the *delegate* property to the given value.
37353    pub fn delegate(
37354        mut self,
37355        new_value: &'a mut dyn common::Delegate,
37356    ) -> CreativeFieldGetCall<'a, C> {
37357        self._delegate = Some(new_value);
37358        self
37359    }
37360
37361    /// Set any additional parameter of the query string used in the request.
37362    /// It should be used to set parameters which are not yet available through their own
37363    /// setters.
37364    ///
37365    /// Please note that this method must not be used to set any of the known parameters
37366    /// which have their own setter method. If done anyway, the request will fail.
37367    ///
37368    /// # Additional Parameters
37369    ///
37370    /// * *$.xgafv* (query-string) - V1 error format.
37371    /// * *access_token* (query-string) - OAuth access token.
37372    /// * *alt* (query-string) - Data format for response.
37373    /// * *callback* (query-string) - JSONP
37374    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
37375    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
37376    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
37377    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
37378    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
37379    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
37380    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
37381    pub fn param<T>(mut self, name: T, value: T) -> CreativeFieldGetCall<'a, C>
37382    where
37383        T: AsRef<str>,
37384    {
37385        self._additional_params
37386            .insert(name.as_ref().to_string(), value.as_ref().to_string());
37387        self
37388    }
37389
37390    /// Identifies the authorization scope for the method you are building.
37391    ///
37392    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
37393    /// [`Scope::Dfatrafficking`].
37394    ///
37395    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
37396    /// tokens for more than one scope.
37397    ///
37398    /// Usually there is more than one suitable scope to authorize an operation, some of which may
37399    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
37400    /// sufficient, a read-write scope will do as well.
37401    pub fn add_scope<St>(mut self, scope: St) -> CreativeFieldGetCall<'a, C>
37402    where
37403        St: AsRef<str>,
37404    {
37405        self._scopes.insert(String::from(scope.as_ref()));
37406        self
37407    }
37408    /// Identifies the authorization scope(s) for the method you are building.
37409    ///
37410    /// See [`Self::add_scope()`] for details.
37411    pub fn add_scopes<I, St>(mut self, scopes: I) -> CreativeFieldGetCall<'a, C>
37412    where
37413        I: IntoIterator<Item = St>,
37414        St: AsRef<str>,
37415    {
37416        self._scopes
37417            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
37418        self
37419    }
37420
37421    /// Removes all scopes, and no default scope will be used either.
37422    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
37423    /// for details).
37424    pub fn clear_scopes(mut self) -> CreativeFieldGetCall<'a, C> {
37425        self._scopes.clear();
37426        self
37427    }
37428}
37429
37430/// Inserts a new creative field.
37431///
37432/// A builder for the *insert* method supported by a *creativeField* resource.
37433/// It is not used directly, but through a [`CreativeFieldMethods`] instance.
37434///
37435/// # Example
37436///
37437/// Instantiate a resource method builder
37438///
37439/// ```test_harness,no_run
37440/// # extern crate hyper;
37441/// # extern crate hyper_rustls;
37442/// # extern crate google_dfareporting3d3 as dfareporting3d3;
37443/// use dfareporting3d3::api::CreativeField;
37444/// # async fn dox() {
37445/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
37446///
37447/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
37448/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
37449/// #     secret,
37450/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
37451/// # ).build().await.unwrap();
37452///
37453/// # let client = hyper_util::client::legacy::Client::builder(
37454/// #     hyper_util::rt::TokioExecutor::new()
37455/// # )
37456/// # .build(
37457/// #     hyper_rustls::HttpsConnectorBuilder::new()
37458/// #         .with_native_roots()
37459/// #         .unwrap()
37460/// #         .https_or_http()
37461/// #         .enable_http1()
37462/// #         .build()
37463/// # );
37464/// # let mut hub = Dfareporting::new(client, auth);
37465/// // As the method needs a request, you would usually fill it with the desired information
37466/// // into the respective structure. Some of the parts shown here might not be applicable !
37467/// // Values shown here are possibly random and not representative !
37468/// let mut req = CreativeField::default();
37469///
37470/// // You can configure optional parameters by calling the respective setters at will, and
37471/// // execute the final call using `doit()`.
37472/// // Values shown here are possibly random and not representative !
37473/// let result = hub.creative_fields().insert(req, -88)
37474///              .doit().await;
37475/// # }
37476/// ```
37477pub struct CreativeFieldInsertCall<'a, C>
37478where
37479    C: 'a,
37480{
37481    hub: &'a Dfareporting<C>,
37482    _request: CreativeField,
37483    _profile_id: i64,
37484    _delegate: Option<&'a mut dyn common::Delegate>,
37485    _additional_params: HashMap<String, String>,
37486    _scopes: BTreeSet<String>,
37487}
37488
37489impl<'a, C> common::CallBuilder for CreativeFieldInsertCall<'a, C> {}
37490
37491impl<'a, C> CreativeFieldInsertCall<'a, C>
37492where
37493    C: common::Connector,
37494{
37495    /// Perform the operation you have build so far.
37496    pub async fn doit(mut self) -> common::Result<(common::Response, CreativeField)> {
37497        use std::borrow::Cow;
37498        use std::io::{Read, Seek};
37499
37500        use common::{url::Params, ToParts};
37501        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
37502
37503        let mut dd = common::DefaultDelegate;
37504        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
37505        dlg.begin(common::MethodInfo {
37506            id: "dfareporting.creativeFields.insert",
37507            http_method: hyper::Method::POST,
37508        });
37509
37510        for &field in ["alt", "profileId"].iter() {
37511            if self._additional_params.contains_key(field) {
37512                dlg.finished(false);
37513                return Err(common::Error::FieldClash(field));
37514            }
37515        }
37516
37517        let mut params = Params::with_capacity(4 + self._additional_params.len());
37518        params.push("profileId", self._profile_id.to_string());
37519
37520        params.extend(self._additional_params.iter());
37521
37522        params.push("alt", "json");
37523        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creativeFields";
37524        if self._scopes.is_empty() {
37525            self._scopes
37526                .insert(Scope::Dfatrafficking.as_ref().to_string());
37527        }
37528
37529        #[allow(clippy::single_element_loop)]
37530        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
37531            url = params.uri_replacement(url, param_name, find_this, false);
37532        }
37533        {
37534            let to_remove = ["profileId"];
37535            params.remove_params(&to_remove);
37536        }
37537
37538        let url = params.parse_with_url(&url);
37539
37540        let mut json_mime_type = mime::APPLICATION_JSON;
37541        let mut request_value_reader = {
37542            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
37543            common::remove_json_null_values(&mut value);
37544            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
37545            serde_json::to_writer(&mut dst, &value).unwrap();
37546            dst
37547        };
37548        let request_size = request_value_reader
37549            .seek(std::io::SeekFrom::End(0))
37550            .unwrap();
37551        request_value_reader
37552            .seek(std::io::SeekFrom::Start(0))
37553            .unwrap();
37554
37555        loop {
37556            let token = match self
37557                .hub
37558                .auth
37559                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
37560                .await
37561            {
37562                Ok(token) => token,
37563                Err(e) => match dlg.token(e) {
37564                    Ok(token) => token,
37565                    Err(e) => {
37566                        dlg.finished(false);
37567                        return Err(common::Error::MissingToken(e));
37568                    }
37569                },
37570            };
37571            request_value_reader
37572                .seek(std::io::SeekFrom::Start(0))
37573                .unwrap();
37574            let mut req_result = {
37575                let client = &self.hub.client;
37576                dlg.pre_request();
37577                let mut req_builder = hyper::Request::builder()
37578                    .method(hyper::Method::POST)
37579                    .uri(url.as_str())
37580                    .header(USER_AGENT, self.hub._user_agent.clone());
37581
37582                if let Some(token) = token.as_ref() {
37583                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
37584                }
37585
37586                let request = req_builder
37587                    .header(CONTENT_TYPE, json_mime_type.to_string())
37588                    .header(CONTENT_LENGTH, request_size as u64)
37589                    .body(common::to_body(
37590                        request_value_reader.get_ref().clone().into(),
37591                    ));
37592
37593                client.request(request.unwrap()).await
37594            };
37595
37596            match req_result {
37597                Err(err) => {
37598                    if let common::Retry::After(d) = dlg.http_error(&err) {
37599                        sleep(d).await;
37600                        continue;
37601                    }
37602                    dlg.finished(false);
37603                    return Err(common::Error::HttpError(err));
37604                }
37605                Ok(res) => {
37606                    let (mut parts, body) = res.into_parts();
37607                    let mut body = common::Body::new(body);
37608                    if !parts.status.is_success() {
37609                        let bytes = common::to_bytes(body).await.unwrap_or_default();
37610                        let error = serde_json::from_str(&common::to_string(&bytes));
37611                        let response = common::to_response(parts, bytes.into());
37612
37613                        if let common::Retry::After(d) =
37614                            dlg.http_failure(&response, error.as_ref().ok())
37615                        {
37616                            sleep(d).await;
37617                            continue;
37618                        }
37619
37620                        dlg.finished(false);
37621
37622                        return Err(match error {
37623                            Ok(value) => common::Error::BadRequest(value),
37624                            _ => common::Error::Failure(response),
37625                        });
37626                    }
37627                    let response = {
37628                        let bytes = common::to_bytes(body).await.unwrap_or_default();
37629                        let encoded = common::to_string(&bytes);
37630                        match serde_json::from_str(&encoded) {
37631                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
37632                            Err(error) => {
37633                                dlg.response_json_decode_error(&encoded, &error);
37634                                return Err(common::Error::JsonDecodeError(
37635                                    encoded.to_string(),
37636                                    error,
37637                                ));
37638                            }
37639                        }
37640                    };
37641
37642                    dlg.finished(true);
37643                    return Ok(response);
37644                }
37645            }
37646        }
37647    }
37648
37649    ///
37650    /// Sets the *request* property to the given value.
37651    ///
37652    /// Even though the property as already been set when instantiating this call,
37653    /// we provide this method for API completeness.
37654    pub fn request(mut self, new_value: CreativeField) -> CreativeFieldInsertCall<'a, C> {
37655        self._request = new_value;
37656        self
37657    }
37658    /// User profile ID associated with this request.
37659    ///
37660    /// Sets the *profile id* path property to the given value.
37661    ///
37662    /// Even though the property as already been set when instantiating this call,
37663    /// we provide this method for API completeness.
37664    pub fn profile_id(mut self, new_value: i64) -> CreativeFieldInsertCall<'a, C> {
37665        self._profile_id = new_value;
37666        self
37667    }
37668    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
37669    /// while executing the actual API request.
37670    ///
37671    /// ````text
37672    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
37673    /// ````
37674    ///
37675    /// Sets the *delegate* property to the given value.
37676    pub fn delegate(
37677        mut self,
37678        new_value: &'a mut dyn common::Delegate,
37679    ) -> CreativeFieldInsertCall<'a, C> {
37680        self._delegate = Some(new_value);
37681        self
37682    }
37683
37684    /// Set any additional parameter of the query string used in the request.
37685    /// It should be used to set parameters which are not yet available through their own
37686    /// setters.
37687    ///
37688    /// Please note that this method must not be used to set any of the known parameters
37689    /// which have their own setter method. If done anyway, the request will fail.
37690    ///
37691    /// # Additional Parameters
37692    ///
37693    /// * *$.xgafv* (query-string) - V1 error format.
37694    /// * *access_token* (query-string) - OAuth access token.
37695    /// * *alt* (query-string) - Data format for response.
37696    /// * *callback* (query-string) - JSONP
37697    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
37698    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
37699    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
37700    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
37701    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
37702    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
37703    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
37704    pub fn param<T>(mut self, name: T, value: T) -> CreativeFieldInsertCall<'a, C>
37705    where
37706        T: AsRef<str>,
37707    {
37708        self._additional_params
37709            .insert(name.as_ref().to_string(), value.as_ref().to_string());
37710        self
37711    }
37712
37713    /// Identifies the authorization scope for the method you are building.
37714    ///
37715    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
37716    /// [`Scope::Dfatrafficking`].
37717    ///
37718    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
37719    /// tokens for more than one scope.
37720    ///
37721    /// Usually there is more than one suitable scope to authorize an operation, some of which may
37722    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
37723    /// sufficient, a read-write scope will do as well.
37724    pub fn add_scope<St>(mut self, scope: St) -> CreativeFieldInsertCall<'a, C>
37725    where
37726        St: AsRef<str>,
37727    {
37728        self._scopes.insert(String::from(scope.as_ref()));
37729        self
37730    }
37731    /// Identifies the authorization scope(s) for the method you are building.
37732    ///
37733    /// See [`Self::add_scope()`] for details.
37734    pub fn add_scopes<I, St>(mut self, scopes: I) -> CreativeFieldInsertCall<'a, C>
37735    where
37736        I: IntoIterator<Item = St>,
37737        St: AsRef<str>,
37738    {
37739        self._scopes
37740            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
37741        self
37742    }
37743
37744    /// Removes all scopes, and no default scope will be used either.
37745    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
37746    /// for details).
37747    pub fn clear_scopes(mut self) -> CreativeFieldInsertCall<'a, C> {
37748        self._scopes.clear();
37749        self
37750    }
37751}
37752
37753/// Retrieves a list of creative fields, possibly filtered. This method supports paging.
37754///
37755/// A builder for the *list* method supported by a *creativeField* resource.
37756/// It is not used directly, but through a [`CreativeFieldMethods`] instance.
37757///
37758/// # Example
37759///
37760/// Instantiate a resource method builder
37761///
37762/// ```test_harness,no_run
37763/// # extern crate hyper;
37764/// # extern crate hyper_rustls;
37765/// # extern crate google_dfareporting3d3 as dfareporting3d3;
37766/// # async fn dox() {
37767/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
37768///
37769/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
37770/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
37771/// #     secret,
37772/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
37773/// # ).build().await.unwrap();
37774///
37775/// # let client = hyper_util::client::legacy::Client::builder(
37776/// #     hyper_util::rt::TokioExecutor::new()
37777/// # )
37778/// # .build(
37779/// #     hyper_rustls::HttpsConnectorBuilder::new()
37780/// #         .with_native_roots()
37781/// #         .unwrap()
37782/// #         .https_or_http()
37783/// #         .enable_http1()
37784/// #         .build()
37785/// # );
37786/// # let mut hub = Dfareporting::new(client, auth);
37787/// // You can configure optional parameters by calling the respective setters at will, and
37788/// // execute the final call using `doit()`.
37789/// // Values shown here are possibly random and not representative !
37790/// let result = hub.creative_fields().list(-14)
37791///              .sort_order("Stet")
37792///              .sort_field("aliquyam")
37793///              .search_string("ut")
37794///              .page_token("sit")
37795///              .max_results(-26)
37796///              .add_ids(-16)
37797///              .add_advertiser_ids(-19)
37798///              .doit().await;
37799/// # }
37800/// ```
37801pub struct CreativeFieldListCall<'a, C>
37802where
37803    C: 'a,
37804{
37805    hub: &'a Dfareporting<C>,
37806    _profile_id: i64,
37807    _sort_order: Option<String>,
37808    _sort_field: Option<String>,
37809    _search_string: Option<String>,
37810    _page_token: Option<String>,
37811    _max_results: Option<i32>,
37812    _ids: Vec<i64>,
37813    _advertiser_ids: Vec<i64>,
37814    _delegate: Option<&'a mut dyn common::Delegate>,
37815    _additional_params: HashMap<String, String>,
37816    _scopes: BTreeSet<String>,
37817}
37818
37819impl<'a, C> common::CallBuilder for CreativeFieldListCall<'a, C> {}
37820
37821impl<'a, C> CreativeFieldListCall<'a, C>
37822where
37823    C: common::Connector,
37824{
37825    /// Perform the operation you have build so far.
37826    pub async fn doit(mut self) -> common::Result<(common::Response, CreativeFieldsListResponse)> {
37827        use std::borrow::Cow;
37828        use std::io::{Read, Seek};
37829
37830        use common::{url::Params, ToParts};
37831        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
37832
37833        let mut dd = common::DefaultDelegate;
37834        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
37835        dlg.begin(common::MethodInfo {
37836            id: "dfareporting.creativeFields.list",
37837            http_method: hyper::Method::GET,
37838        });
37839
37840        for &field in [
37841            "alt",
37842            "profileId",
37843            "sortOrder",
37844            "sortField",
37845            "searchString",
37846            "pageToken",
37847            "maxResults",
37848            "ids",
37849            "advertiserIds",
37850        ]
37851        .iter()
37852        {
37853            if self._additional_params.contains_key(field) {
37854                dlg.finished(false);
37855                return Err(common::Error::FieldClash(field));
37856            }
37857        }
37858
37859        let mut params = Params::with_capacity(10 + self._additional_params.len());
37860        params.push("profileId", self._profile_id.to_string());
37861        if let Some(value) = self._sort_order.as_ref() {
37862            params.push("sortOrder", value);
37863        }
37864        if let Some(value) = self._sort_field.as_ref() {
37865            params.push("sortField", value);
37866        }
37867        if let Some(value) = self._search_string.as_ref() {
37868            params.push("searchString", value);
37869        }
37870        if let Some(value) = self._page_token.as_ref() {
37871            params.push("pageToken", value);
37872        }
37873        if let Some(value) = self._max_results.as_ref() {
37874            params.push("maxResults", value.to_string());
37875        }
37876        if !self._ids.is_empty() {
37877            for f in self._ids.iter() {
37878                params.push("ids", f.to_string());
37879            }
37880        }
37881        if !self._advertiser_ids.is_empty() {
37882            for f in self._advertiser_ids.iter() {
37883                params.push("advertiserIds", f.to_string());
37884            }
37885        }
37886
37887        params.extend(self._additional_params.iter());
37888
37889        params.push("alt", "json");
37890        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creativeFields";
37891        if self._scopes.is_empty() {
37892            self._scopes
37893                .insert(Scope::Dfatrafficking.as_ref().to_string());
37894        }
37895
37896        #[allow(clippy::single_element_loop)]
37897        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
37898            url = params.uri_replacement(url, param_name, find_this, false);
37899        }
37900        {
37901            let to_remove = ["profileId"];
37902            params.remove_params(&to_remove);
37903        }
37904
37905        let url = params.parse_with_url(&url);
37906
37907        loop {
37908            let token = match self
37909                .hub
37910                .auth
37911                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
37912                .await
37913            {
37914                Ok(token) => token,
37915                Err(e) => match dlg.token(e) {
37916                    Ok(token) => token,
37917                    Err(e) => {
37918                        dlg.finished(false);
37919                        return Err(common::Error::MissingToken(e));
37920                    }
37921                },
37922            };
37923            let mut req_result = {
37924                let client = &self.hub.client;
37925                dlg.pre_request();
37926                let mut req_builder = hyper::Request::builder()
37927                    .method(hyper::Method::GET)
37928                    .uri(url.as_str())
37929                    .header(USER_AGENT, self.hub._user_agent.clone());
37930
37931                if let Some(token) = token.as_ref() {
37932                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
37933                }
37934
37935                let request = req_builder
37936                    .header(CONTENT_LENGTH, 0_u64)
37937                    .body(common::to_body::<String>(None));
37938
37939                client.request(request.unwrap()).await
37940            };
37941
37942            match req_result {
37943                Err(err) => {
37944                    if let common::Retry::After(d) = dlg.http_error(&err) {
37945                        sleep(d).await;
37946                        continue;
37947                    }
37948                    dlg.finished(false);
37949                    return Err(common::Error::HttpError(err));
37950                }
37951                Ok(res) => {
37952                    let (mut parts, body) = res.into_parts();
37953                    let mut body = common::Body::new(body);
37954                    if !parts.status.is_success() {
37955                        let bytes = common::to_bytes(body).await.unwrap_or_default();
37956                        let error = serde_json::from_str(&common::to_string(&bytes));
37957                        let response = common::to_response(parts, bytes.into());
37958
37959                        if let common::Retry::After(d) =
37960                            dlg.http_failure(&response, error.as_ref().ok())
37961                        {
37962                            sleep(d).await;
37963                            continue;
37964                        }
37965
37966                        dlg.finished(false);
37967
37968                        return Err(match error {
37969                            Ok(value) => common::Error::BadRequest(value),
37970                            _ => common::Error::Failure(response),
37971                        });
37972                    }
37973                    let response = {
37974                        let bytes = common::to_bytes(body).await.unwrap_or_default();
37975                        let encoded = common::to_string(&bytes);
37976                        match serde_json::from_str(&encoded) {
37977                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
37978                            Err(error) => {
37979                                dlg.response_json_decode_error(&encoded, &error);
37980                                return Err(common::Error::JsonDecodeError(
37981                                    encoded.to_string(),
37982                                    error,
37983                                ));
37984                            }
37985                        }
37986                    };
37987
37988                    dlg.finished(true);
37989                    return Ok(response);
37990                }
37991            }
37992        }
37993    }
37994
37995    /// User profile ID associated with this request.
37996    ///
37997    /// Sets the *profile id* path property to the given value.
37998    ///
37999    /// Even though the property as already been set when instantiating this call,
38000    /// we provide this method for API completeness.
38001    pub fn profile_id(mut self, new_value: i64) -> CreativeFieldListCall<'a, C> {
38002        self._profile_id = new_value;
38003        self
38004    }
38005    /// Order of sorted results.
38006    ///
38007    /// Sets the *sort order* query property to the given value.
38008    pub fn sort_order(mut self, new_value: &str) -> CreativeFieldListCall<'a, C> {
38009        self._sort_order = Some(new_value.to_string());
38010        self
38011    }
38012    /// Field by which to sort the list.
38013    ///
38014    /// Sets the *sort field* query property to the given value.
38015    pub fn sort_field(mut self, new_value: &str) -> CreativeFieldListCall<'a, C> {
38016        self._sort_field = Some(new_value.to_string());
38017        self
38018    }
38019    /// Allows searching for creative fields by name or ID. Wildcards (*) are allowed. For example, "creativefield*2015" will return creative fields with names like "creativefield June 2015", "creativefield April 2015", or simply "creativefield 2015". Most of the searches also add wild-cards implicitly at the start and the end of the search string. For example, a search string of "creativefield" will match creative fields with the name "my creativefield", "creativefield 2015", or simply "creativefield".
38020    ///
38021    /// Sets the *search string* query property to the given value.
38022    pub fn search_string(mut self, new_value: &str) -> CreativeFieldListCall<'a, C> {
38023        self._search_string = Some(new_value.to_string());
38024        self
38025    }
38026    /// Value of the nextPageToken from the previous result page.
38027    ///
38028    /// Sets the *page token* query property to the given value.
38029    pub fn page_token(mut self, new_value: &str) -> CreativeFieldListCall<'a, C> {
38030        self._page_token = Some(new_value.to_string());
38031        self
38032    }
38033    /// Maximum number of results to return.
38034    ///
38035    /// Sets the *max results* query property to the given value.
38036    pub fn max_results(mut self, new_value: i32) -> CreativeFieldListCall<'a, C> {
38037        self._max_results = Some(new_value);
38038        self
38039    }
38040    /// Select only creative fields with these IDs.
38041    ///
38042    /// Append the given value to the *ids* query property.
38043    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
38044    pub fn add_ids(mut self, new_value: i64) -> CreativeFieldListCall<'a, C> {
38045        self._ids.push(new_value);
38046        self
38047    }
38048    /// Select only creative fields that belong to these advertisers.
38049    ///
38050    /// Append the given value to the *advertiser ids* query property.
38051    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
38052    pub fn add_advertiser_ids(mut self, new_value: i64) -> CreativeFieldListCall<'a, C> {
38053        self._advertiser_ids.push(new_value);
38054        self
38055    }
38056    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
38057    /// while executing the actual API request.
38058    ///
38059    /// ````text
38060    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
38061    /// ````
38062    ///
38063    /// Sets the *delegate* property to the given value.
38064    pub fn delegate(
38065        mut self,
38066        new_value: &'a mut dyn common::Delegate,
38067    ) -> CreativeFieldListCall<'a, C> {
38068        self._delegate = Some(new_value);
38069        self
38070    }
38071
38072    /// Set any additional parameter of the query string used in the request.
38073    /// It should be used to set parameters which are not yet available through their own
38074    /// setters.
38075    ///
38076    /// Please note that this method must not be used to set any of the known parameters
38077    /// which have their own setter method. If done anyway, the request will fail.
38078    ///
38079    /// # Additional Parameters
38080    ///
38081    /// * *$.xgafv* (query-string) - V1 error format.
38082    /// * *access_token* (query-string) - OAuth access token.
38083    /// * *alt* (query-string) - Data format for response.
38084    /// * *callback* (query-string) - JSONP
38085    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
38086    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
38087    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
38088    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
38089    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
38090    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
38091    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
38092    pub fn param<T>(mut self, name: T, value: T) -> CreativeFieldListCall<'a, C>
38093    where
38094        T: AsRef<str>,
38095    {
38096        self._additional_params
38097            .insert(name.as_ref().to_string(), value.as_ref().to_string());
38098        self
38099    }
38100
38101    /// Identifies the authorization scope for the method you are building.
38102    ///
38103    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
38104    /// [`Scope::Dfatrafficking`].
38105    ///
38106    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
38107    /// tokens for more than one scope.
38108    ///
38109    /// Usually there is more than one suitable scope to authorize an operation, some of which may
38110    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
38111    /// sufficient, a read-write scope will do as well.
38112    pub fn add_scope<St>(mut self, scope: St) -> CreativeFieldListCall<'a, C>
38113    where
38114        St: AsRef<str>,
38115    {
38116        self._scopes.insert(String::from(scope.as_ref()));
38117        self
38118    }
38119    /// Identifies the authorization scope(s) for the method you are building.
38120    ///
38121    /// See [`Self::add_scope()`] for details.
38122    pub fn add_scopes<I, St>(mut self, scopes: I) -> CreativeFieldListCall<'a, C>
38123    where
38124        I: IntoIterator<Item = St>,
38125        St: AsRef<str>,
38126    {
38127        self._scopes
38128            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
38129        self
38130    }
38131
38132    /// Removes all scopes, and no default scope will be used either.
38133    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
38134    /// for details).
38135    pub fn clear_scopes(mut self) -> CreativeFieldListCall<'a, C> {
38136        self._scopes.clear();
38137        self
38138    }
38139}
38140
38141/// Updates an existing creative field. This method supports patch semantics.
38142///
38143/// A builder for the *patch* method supported by a *creativeField* resource.
38144/// It is not used directly, but through a [`CreativeFieldMethods`] instance.
38145///
38146/// # Example
38147///
38148/// Instantiate a resource method builder
38149///
38150/// ```test_harness,no_run
38151/// # extern crate hyper;
38152/// # extern crate hyper_rustls;
38153/// # extern crate google_dfareporting3d3 as dfareporting3d3;
38154/// use dfareporting3d3::api::CreativeField;
38155/// # async fn dox() {
38156/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
38157///
38158/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
38159/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
38160/// #     secret,
38161/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
38162/// # ).build().await.unwrap();
38163///
38164/// # let client = hyper_util::client::legacy::Client::builder(
38165/// #     hyper_util::rt::TokioExecutor::new()
38166/// # )
38167/// # .build(
38168/// #     hyper_rustls::HttpsConnectorBuilder::new()
38169/// #         .with_native_roots()
38170/// #         .unwrap()
38171/// #         .https_or_http()
38172/// #         .enable_http1()
38173/// #         .build()
38174/// # );
38175/// # let mut hub = Dfareporting::new(client, auth);
38176/// // As the method needs a request, you would usually fill it with the desired information
38177/// // into the respective structure. Some of the parts shown here might not be applicable !
38178/// // Values shown here are possibly random and not representative !
38179/// let mut req = CreativeField::default();
38180///
38181/// // You can configure optional parameters by calling the respective setters at will, and
38182/// // execute the final call using `doit()`.
38183/// // Values shown here are possibly random and not representative !
38184/// let result = hub.creative_fields().patch(req, -96, -19)
38185///              .doit().await;
38186/// # }
38187/// ```
38188pub struct CreativeFieldPatchCall<'a, C>
38189where
38190    C: 'a,
38191{
38192    hub: &'a Dfareporting<C>,
38193    _request: CreativeField,
38194    _profile_id: i64,
38195    _id: i64,
38196    _delegate: Option<&'a mut dyn common::Delegate>,
38197    _additional_params: HashMap<String, String>,
38198    _scopes: BTreeSet<String>,
38199}
38200
38201impl<'a, C> common::CallBuilder for CreativeFieldPatchCall<'a, C> {}
38202
38203impl<'a, C> CreativeFieldPatchCall<'a, C>
38204where
38205    C: common::Connector,
38206{
38207    /// Perform the operation you have build so far.
38208    pub async fn doit(mut self) -> common::Result<(common::Response, CreativeField)> {
38209        use std::borrow::Cow;
38210        use std::io::{Read, Seek};
38211
38212        use common::{url::Params, ToParts};
38213        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
38214
38215        let mut dd = common::DefaultDelegate;
38216        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
38217        dlg.begin(common::MethodInfo {
38218            id: "dfareporting.creativeFields.patch",
38219            http_method: hyper::Method::PATCH,
38220        });
38221
38222        for &field in ["alt", "profileId", "id"].iter() {
38223            if self._additional_params.contains_key(field) {
38224                dlg.finished(false);
38225                return Err(common::Error::FieldClash(field));
38226            }
38227        }
38228
38229        let mut params = Params::with_capacity(5 + self._additional_params.len());
38230        params.push("profileId", self._profile_id.to_string());
38231        params.push("id", self._id.to_string());
38232
38233        params.extend(self._additional_params.iter());
38234
38235        params.push("alt", "json");
38236        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creativeFields";
38237        if self._scopes.is_empty() {
38238            self._scopes
38239                .insert(Scope::Dfatrafficking.as_ref().to_string());
38240        }
38241
38242        #[allow(clippy::single_element_loop)]
38243        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
38244            url = params.uri_replacement(url, param_name, find_this, false);
38245        }
38246        {
38247            let to_remove = ["profileId"];
38248            params.remove_params(&to_remove);
38249        }
38250
38251        let url = params.parse_with_url(&url);
38252
38253        let mut json_mime_type = mime::APPLICATION_JSON;
38254        let mut request_value_reader = {
38255            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
38256            common::remove_json_null_values(&mut value);
38257            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
38258            serde_json::to_writer(&mut dst, &value).unwrap();
38259            dst
38260        };
38261        let request_size = request_value_reader
38262            .seek(std::io::SeekFrom::End(0))
38263            .unwrap();
38264        request_value_reader
38265            .seek(std::io::SeekFrom::Start(0))
38266            .unwrap();
38267
38268        loop {
38269            let token = match self
38270                .hub
38271                .auth
38272                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
38273                .await
38274            {
38275                Ok(token) => token,
38276                Err(e) => match dlg.token(e) {
38277                    Ok(token) => token,
38278                    Err(e) => {
38279                        dlg.finished(false);
38280                        return Err(common::Error::MissingToken(e));
38281                    }
38282                },
38283            };
38284            request_value_reader
38285                .seek(std::io::SeekFrom::Start(0))
38286                .unwrap();
38287            let mut req_result = {
38288                let client = &self.hub.client;
38289                dlg.pre_request();
38290                let mut req_builder = hyper::Request::builder()
38291                    .method(hyper::Method::PATCH)
38292                    .uri(url.as_str())
38293                    .header(USER_AGENT, self.hub._user_agent.clone());
38294
38295                if let Some(token) = token.as_ref() {
38296                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
38297                }
38298
38299                let request = req_builder
38300                    .header(CONTENT_TYPE, json_mime_type.to_string())
38301                    .header(CONTENT_LENGTH, request_size as u64)
38302                    .body(common::to_body(
38303                        request_value_reader.get_ref().clone().into(),
38304                    ));
38305
38306                client.request(request.unwrap()).await
38307            };
38308
38309            match req_result {
38310                Err(err) => {
38311                    if let common::Retry::After(d) = dlg.http_error(&err) {
38312                        sleep(d).await;
38313                        continue;
38314                    }
38315                    dlg.finished(false);
38316                    return Err(common::Error::HttpError(err));
38317                }
38318                Ok(res) => {
38319                    let (mut parts, body) = res.into_parts();
38320                    let mut body = common::Body::new(body);
38321                    if !parts.status.is_success() {
38322                        let bytes = common::to_bytes(body).await.unwrap_or_default();
38323                        let error = serde_json::from_str(&common::to_string(&bytes));
38324                        let response = common::to_response(parts, bytes.into());
38325
38326                        if let common::Retry::After(d) =
38327                            dlg.http_failure(&response, error.as_ref().ok())
38328                        {
38329                            sleep(d).await;
38330                            continue;
38331                        }
38332
38333                        dlg.finished(false);
38334
38335                        return Err(match error {
38336                            Ok(value) => common::Error::BadRequest(value),
38337                            _ => common::Error::Failure(response),
38338                        });
38339                    }
38340                    let response = {
38341                        let bytes = common::to_bytes(body).await.unwrap_or_default();
38342                        let encoded = common::to_string(&bytes);
38343                        match serde_json::from_str(&encoded) {
38344                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
38345                            Err(error) => {
38346                                dlg.response_json_decode_error(&encoded, &error);
38347                                return Err(common::Error::JsonDecodeError(
38348                                    encoded.to_string(),
38349                                    error,
38350                                ));
38351                            }
38352                        }
38353                    };
38354
38355                    dlg.finished(true);
38356                    return Ok(response);
38357                }
38358            }
38359        }
38360    }
38361
38362    ///
38363    /// Sets the *request* property to the given value.
38364    ///
38365    /// Even though the property as already been set when instantiating this call,
38366    /// we provide this method for API completeness.
38367    pub fn request(mut self, new_value: CreativeField) -> CreativeFieldPatchCall<'a, C> {
38368        self._request = new_value;
38369        self
38370    }
38371    /// User profile ID associated with this request.
38372    ///
38373    /// Sets the *profile id* path property to the given value.
38374    ///
38375    /// Even though the property as already been set when instantiating this call,
38376    /// we provide this method for API completeness.
38377    pub fn profile_id(mut self, new_value: i64) -> CreativeFieldPatchCall<'a, C> {
38378        self._profile_id = new_value;
38379        self
38380    }
38381    /// CreativeField ID.
38382    ///
38383    /// Sets the *id* query property to the given value.
38384    ///
38385    /// Even though the property as already been set when instantiating this call,
38386    /// we provide this method for API completeness.
38387    pub fn id(mut self, new_value: i64) -> CreativeFieldPatchCall<'a, C> {
38388        self._id = new_value;
38389        self
38390    }
38391    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
38392    /// while executing the actual API request.
38393    ///
38394    /// ````text
38395    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
38396    /// ````
38397    ///
38398    /// Sets the *delegate* property to the given value.
38399    pub fn delegate(
38400        mut self,
38401        new_value: &'a mut dyn common::Delegate,
38402    ) -> CreativeFieldPatchCall<'a, C> {
38403        self._delegate = Some(new_value);
38404        self
38405    }
38406
38407    /// Set any additional parameter of the query string used in the request.
38408    /// It should be used to set parameters which are not yet available through their own
38409    /// setters.
38410    ///
38411    /// Please note that this method must not be used to set any of the known parameters
38412    /// which have their own setter method. If done anyway, the request will fail.
38413    ///
38414    /// # Additional Parameters
38415    ///
38416    /// * *$.xgafv* (query-string) - V1 error format.
38417    /// * *access_token* (query-string) - OAuth access token.
38418    /// * *alt* (query-string) - Data format for response.
38419    /// * *callback* (query-string) - JSONP
38420    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
38421    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
38422    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
38423    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
38424    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
38425    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
38426    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
38427    pub fn param<T>(mut self, name: T, value: T) -> CreativeFieldPatchCall<'a, C>
38428    where
38429        T: AsRef<str>,
38430    {
38431        self._additional_params
38432            .insert(name.as_ref().to_string(), value.as_ref().to_string());
38433        self
38434    }
38435
38436    /// Identifies the authorization scope for the method you are building.
38437    ///
38438    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
38439    /// [`Scope::Dfatrafficking`].
38440    ///
38441    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
38442    /// tokens for more than one scope.
38443    ///
38444    /// Usually there is more than one suitable scope to authorize an operation, some of which may
38445    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
38446    /// sufficient, a read-write scope will do as well.
38447    pub fn add_scope<St>(mut self, scope: St) -> CreativeFieldPatchCall<'a, C>
38448    where
38449        St: AsRef<str>,
38450    {
38451        self._scopes.insert(String::from(scope.as_ref()));
38452        self
38453    }
38454    /// Identifies the authorization scope(s) for the method you are building.
38455    ///
38456    /// See [`Self::add_scope()`] for details.
38457    pub fn add_scopes<I, St>(mut self, scopes: I) -> CreativeFieldPatchCall<'a, C>
38458    where
38459        I: IntoIterator<Item = St>,
38460        St: AsRef<str>,
38461    {
38462        self._scopes
38463            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
38464        self
38465    }
38466
38467    /// Removes all scopes, and no default scope will be used either.
38468    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
38469    /// for details).
38470    pub fn clear_scopes(mut self) -> CreativeFieldPatchCall<'a, C> {
38471        self._scopes.clear();
38472        self
38473    }
38474}
38475
38476/// Updates an existing creative field.
38477///
38478/// A builder for the *update* method supported by a *creativeField* resource.
38479/// It is not used directly, but through a [`CreativeFieldMethods`] instance.
38480///
38481/// # Example
38482///
38483/// Instantiate a resource method builder
38484///
38485/// ```test_harness,no_run
38486/// # extern crate hyper;
38487/// # extern crate hyper_rustls;
38488/// # extern crate google_dfareporting3d3 as dfareporting3d3;
38489/// use dfareporting3d3::api::CreativeField;
38490/// # async fn dox() {
38491/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
38492///
38493/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
38494/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
38495/// #     secret,
38496/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
38497/// # ).build().await.unwrap();
38498///
38499/// # let client = hyper_util::client::legacy::Client::builder(
38500/// #     hyper_util::rt::TokioExecutor::new()
38501/// # )
38502/// # .build(
38503/// #     hyper_rustls::HttpsConnectorBuilder::new()
38504/// #         .with_native_roots()
38505/// #         .unwrap()
38506/// #         .https_or_http()
38507/// #         .enable_http1()
38508/// #         .build()
38509/// # );
38510/// # let mut hub = Dfareporting::new(client, auth);
38511/// // As the method needs a request, you would usually fill it with the desired information
38512/// // into the respective structure. Some of the parts shown here might not be applicable !
38513/// // Values shown here are possibly random and not representative !
38514/// let mut req = CreativeField::default();
38515///
38516/// // You can configure optional parameters by calling the respective setters at will, and
38517/// // execute the final call using `doit()`.
38518/// // Values shown here are possibly random and not representative !
38519/// let result = hub.creative_fields().update(req, -30)
38520///              .doit().await;
38521/// # }
38522/// ```
38523pub struct CreativeFieldUpdateCall<'a, C>
38524where
38525    C: 'a,
38526{
38527    hub: &'a Dfareporting<C>,
38528    _request: CreativeField,
38529    _profile_id: i64,
38530    _delegate: Option<&'a mut dyn common::Delegate>,
38531    _additional_params: HashMap<String, String>,
38532    _scopes: BTreeSet<String>,
38533}
38534
38535impl<'a, C> common::CallBuilder for CreativeFieldUpdateCall<'a, C> {}
38536
38537impl<'a, C> CreativeFieldUpdateCall<'a, C>
38538where
38539    C: common::Connector,
38540{
38541    /// Perform the operation you have build so far.
38542    pub async fn doit(mut self) -> common::Result<(common::Response, CreativeField)> {
38543        use std::borrow::Cow;
38544        use std::io::{Read, Seek};
38545
38546        use common::{url::Params, ToParts};
38547        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
38548
38549        let mut dd = common::DefaultDelegate;
38550        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
38551        dlg.begin(common::MethodInfo {
38552            id: "dfareporting.creativeFields.update",
38553            http_method: hyper::Method::PUT,
38554        });
38555
38556        for &field in ["alt", "profileId"].iter() {
38557            if self._additional_params.contains_key(field) {
38558                dlg.finished(false);
38559                return Err(common::Error::FieldClash(field));
38560            }
38561        }
38562
38563        let mut params = Params::with_capacity(4 + self._additional_params.len());
38564        params.push("profileId", self._profile_id.to_string());
38565
38566        params.extend(self._additional_params.iter());
38567
38568        params.push("alt", "json");
38569        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creativeFields";
38570        if self._scopes.is_empty() {
38571            self._scopes
38572                .insert(Scope::Dfatrafficking.as_ref().to_string());
38573        }
38574
38575        #[allow(clippy::single_element_loop)]
38576        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
38577            url = params.uri_replacement(url, param_name, find_this, false);
38578        }
38579        {
38580            let to_remove = ["profileId"];
38581            params.remove_params(&to_remove);
38582        }
38583
38584        let url = params.parse_with_url(&url);
38585
38586        let mut json_mime_type = mime::APPLICATION_JSON;
38587        let mut request_value_reader = {
38588            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
38589            common::remove_json_null_values(&mut value);
38590            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
38591            serde_json::to_writer(&mut dst, &value).unwrap();
38592            dst
38593        };
38594        let request_size = request_value_reader
38595            .seek(std::io::SeekFrom::End(0))
38596            .unwrap();
38597        request_value_reader
38598            .seek(std::io::SeekFrom::Start(0))
38599            .unwrap();
38600
38601        loop {
38602            let token = match self
38603                .hub
38604                .auth
38605                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
38606                .await
38607            {
38608                Ok(token) => token,
38609                Err(e) => match dlg.token(e) {
38610                    Ok(token) => token,
38611                    Err(e) => {
38612                        dlg.finished(false);
38613                        return Err(common::Error::MissingToken(e));
38614                    }
38615                },
38616            };
38617            request_value_reader
38618                .seek(std::io::SeekFrom::Start(0))
38619                .unwrap();
38620            let mut req_result = {
38621                let client = &self.hub.client;
38622                dlg.pre_request();
38623                let mut req_builder = hyper::Request::builder()
38624                    .method(hyper::Method::PUT)
38625                    .uri(url.as_str())
38626                    .header(USER_AGENT, self.hub._user_agent.clone());
38627
38628                if let Some(token) = token.as_ref() {
38629                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
38630                }
38631
38632                let request = req_builder
38633                    .header(CONTENT_TYPE, json_mime_type.to_string())
38634                    .header(CONTENT_LENGTH, request_size as u64)
38635                    .body(common::to_body(
38636                        request_value_reader.get_ref().clone().into(),
38637                    ));
38638
38639                client.request(request.unwrap()).await
38640            };
38641
38642            match req_result {
38643                Err(err) => {
38644                    if let common::Retry::After(d) = dlg.http_error(&err) {
38645                        sleep(d).await;
38646                        continue;
38647                    }
38648                    dlg.finished(false);
38649                    return Err(common::Error::HttpError(err));
38650                }
38651                Ok(res) => {
38652                    let (mut parts, body) = res.into_parts();
38653                    let mut body = common::Body::new(body);
38654                    if !parts.status.is_success() {
38655                        let bytes = common::to_bytes(body).await.unwrap_or_default();
38656                        let error = serde_json::from_str(&common::to_string(&bytes));
38657                        let response = common::to_response(parts, bytes.into());
38658
38659                        if let common::Retry::After(d) =
38660                            dlg.http_failure(&response, error.as_ref().ok())
38661                        {
38662                            sleep(d).await;
38663                            continue;
38664                        }
38665
38666                        dlg.finished(false);
38667
38668                        return Err(match error {
38669                            Ok(value) => common::Error::BadRequest(value),
38670                            _ => common::Error::Failure(response),
38671                        });
38672                    }
38673                    let response = {
38674                        let bytes = common::to_bytes(body).await.unwrap_or_default();
38675                        let encoded = common::to_string(&bytes);
38676                        match serde_json::from_str(&encoded) {
38677                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
38678                            Err(error) => {
38679                                dlg.response_json_decode_error(&encoded, &error);
38680                                return Err(common::Error::JsonDecodeError(
38681                                    encoded.to_string(),
38682                                    error,
38683                                ));
38684                            }
38685                        }
38686                    };
38687
38688                    dlg.finished(true);
38689                    return Ok(response);
38690                }
38691            }
38692        }
38693    }
38694
38695    ///
38696    /// Sets the *request* property to the given value.
38697    ///
38698    /// Even though the property as already been set when instantiating this call,
38699    /// we provide this method for API completeness.
38700    pub fn request(mut self, new_value: CreativeField) -> CreativeFieldUpdateCall<'a, C> {
38701        self._request = new_value;
38702        self
38703    }
38704    /// User profile ID associated with this request.
38705    ///
38706    /// Sets the *profile id* path property to the given value.
38707    ///
38708    /// Even though the property as already been set when instantiating this call,
38709    /// we provide this method for API completeness.
38710    pub fn profile_id(mut self, new_value: i64) -> CreativeFieldUpdateCall<'a, C> {
38711        self._profile_id = new_value;
38712        self
38713    }
38714    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
38715    /// while executing the actual API request.
38716    ///
38717    /// ````text
38718    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
38719    /// ````
38720    ///
38721    /// Sets the *delegate* property to the given value.
38722    pub fn delegate(
38723        mut self,
38724        new_value: &'a mut dyn common::Delegate,
38725    ) -> CreativeFieldUpdateCall<'a, C> {
38726        self._delegate = Some(new_value);
38727        self
38728    }
38729
38730    /// Set any additional parameter of the query string used in the request.
38731    /// It should be used to set parameters which are not yet available through their own
38732    /// setters.
38733    ///
38734    /// Please note that this method must not be used to set any of the known parameters
38735    /// which have their own setter method. If done anyway, the request will fail.
38736    ///
38737    /// # Additional Parameters
38738    ///
38739    /// * *$.xgafv* (query-string) - V1 error format.
38740    /// * *access_token* (query-string) - OAuth access token.
38741    /// * *alt* (query-string) - Data format for response.
38742    /// * *callback* (query-string) - JSONP
38743    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
38744    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
38745    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
38746    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
38747    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
38748    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
38749    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
38750    pub fn param<T>(mut self, name: T, value: T) -> CreativeFieldUpdateCall<'a, C>
38751    where
38752        T: AsRef<str>,
38753    {
38754        self._additional_params
38755            .insert(name.as_ref().to_string(), value.as_ref().to_string());
38756        self
38757    }
38758
38759    /// Identifies the authorization scope for the method you are building.
38760    ///
38761    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
38762    /// [`Scope::Dfatrafficking`].
38763    ///
38764    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
38765    /// tokens for more than one scope.
38766    ///
38767    /// Usually there is more than one suitable scope to authorize an operation, some of which may
38768    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
38769    /// sufficient, a read-write scope will do as well.
38770    pub fn add_scope<St>(mut self, scope: St) -> CreativeFieldUpdateCall<'a, C>
38771    where
38772        St: AsRef<str>,
38773    {
38774        self._scopes.insert(String::from(scope.as_ref()));
38775        self
38776    }
38777    /// Identifies the authorization scope(s) for the method you are building.
38778    ///
38779    /// See [`Self::add_scope()`] for details.
38780    pub fn add_scopes<I, St>(mut self, scopes: I) -> CreativeFieldUpdateCall<'a, C>
38781    where
38782        I: IntoIterator<Item = St>,
38783        St: AsRef<str>,
38784    {
38785        self._scopes
38786            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
38787        self
38788    }
38789
38790    /// Removes all scopes, and no default scope will be used either.
38791    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
38792    /// for details).
38793    pub fn clear_scopes(mut self) -> CreativeFieldUpdateCall<'a, C> {
38794        self._scopes.clear();
38795        self
38796    }
38797}
38798
38799/// Gets one creative group by ID.
38800///
38801/// A builder for the *get* method supported by a *creativeGroup* resource.
38802/// It is not used directly, but through a [`CreativeGroupMethods`] instance.
38803///
38804/// # Example
38805///
38806/// Instantiate a resource method builder
38807///
38808/// ```test_harness,no_run
38809/// # extern crate hyper;
38810/// # extern crate hyper_rustls;
38811/// # extern crate google_dfareporting3d3 as dfareporting3d3;
38812/// # async fn dox() {
38813/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
38814///
38815/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
38816/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
38817/// #     secret,
38818/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
38819/// # ).build().await.unwrap();
38820///
38821/// # let client = hyper_util::client::legacy::Client::builder(
38822/// #     hyper_util::rt::TokioExecutor::new()
38823/// # )
38824/// # .build(
38825/// #     hyper_rustls::HttpsConnectorBuilder::new()
38826/// #         .with_native_roots()
38827/// #         .unwrap()
38828/// #         .https_or_http()
38829/// #         .enable_http1()
38830/// #         .build()
38831/// # );
38832/// # let mut hub = Dfareporting::new(client, auth);
38833/// // You can configure optional parameters by calling the respective setters at will, and
38834/// // execute the final call using `doit()`.
38835/// // Values shown here are possibly random and not representative !
38836/// let result = hub.creative_groups().get(-38, -64)
38837///              .doit().await;
38838/// # }
38839/// ```
38840pub struct CreativeGroupGetCall<'a, C>
38841where
38842    C: 'a,
38843{
38844    hub: &'a Dfareporting<C>,
38845    _profile_id: i64,
38846    _id: i64,
38847    _delegate: Option<&'a mut dyn common::Delegate>,
38848    _additional_params: HashMap<String, String>,
38849    _scopes: BTreeSet<String>,
38850}
38851
38852impl<'a, C> common::CallBuilder for CreativeGroupGetCall<'a, C> {}
38853
38854impl<'a, C> CreativeGroupGetCall<'a, C>
38855where
38856    C: common::Connector,
38857{
38858    /// Perform the operation you have build so far.
38859    pub async fn doit(mut self) -> common::Result<(common::Response, CreativeGroup)> {
38860        use std::borrow::Cow;
38861        use std::io::{Read, Seek};
38862
38863        use common::{url::Params, ToParts};
38864        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
38865
38866        let mut dd = common::DefaultDelegate;
38867        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
38868        dlg.begin(common::MethodInfo {
38869            id: "dfareporting.creativeGroups.get",
38870            http_method: hyper::Method::GET,
38871        });
38872
38873        for &field in ["alt", "profileId", "id"].iter() {
38874            if self._additional_params.contains_key(field) {
38875                dlg.finished(false);
38876                return Err(common::Error::FieldClash(field));
38877            }
38878        }
38879
38880        let mut params = Params::with_capacity(4 + self._additional_params.len());
38881        params.push("profileId", self._profile_id.to_string());
38882        params.push("id", self._id.to_string());
38883
38884        params.extend(self._additional_params.iter());
38885
38886        params.push("alt", "json");
38887        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creativeGroups/{id}";
38888        if self._scopes.is_empty() {
38889            self._scopes
38890                .insert(Scope::Dfatrafficking.as_ref().to_string());
38891        }
38892
38893        #[allow(clippy::single_element_loop)]
38894        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
38895            url = params.uri_replacement(url, param_name, find_this, false);
38896        }
38897        {
38898            let to_remove = ["id", "profileId"];
38899            params.remove_params(&to_remove);
38900        }
38901
38902        let url = params.parse_with_url(&url);
38903
38904        loop {
38905            let token = match self
38906                .hub
38907                .auth
38908                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
38909                .await
38910            {
38911                Ok(token) => token,
38912                Err(e) => match dlg.token(e) {
38913                    Ok(token) => token,
38914                    Err(e) => {
38915                        dlg.finished(false);
38916                        return Err(common::Error::MissingToken(e));
38917                    }
38918                },
38919            };
38920            let mut req_result = {
38921                let client = &self.hub.client;
38922                dlg.pre_request();
38923                let mut req_builder = hyper::Request::builder()
38924                    .method(hyper::Method::GET)
38925                    .uri(url.as_str())
38926                    .header(USER_AGENT, self.hub._user_agent.clone());
38927
38928                if let Some(token) = token.as_ref() {
38929                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
38930                }
38931
38932                let request = req_builder
38933                    .header(CONTENT_LENGTH, 0_u64)
38934                    .body(common::to_body::<String>(None));
38935
38936                client.request(request.unwrap()).await
38937            };
38938
38939            match req_result {
38940                Err(err) => {
38941                    if let common::Retry::After(d) = dlg.http_error(&err) {
38942                        sleep(d).await;
38943                        continue;
38944                    }
38945                    dlg.finished(false);
38946                    return Err(common::Error::HttpError(err));
38947                }
38948                Ok(res) => {
38949                    let (mut parts, body) = res.into_parts();
38950                    let mut body = common::Body::new(body);
38951                    if !parts.status.is_success() {
38952                        let bytes = common::to_bytes(body).await.unwrap_or_default();
38953                        let error = serde_json::from_str(&common::to_string(&bytes));
38954                        let response = common::to_response(parts, bytes.into());
38955
38956                        if let common::Retry::After(d) =
38957                            dlg.http_failure(&response, error.as_ref().ok())
38958                        {
38959                            sleep(d).await;
38960                            continue;
38961                        }
38962
38963                        dlg.finished(false);
38964
38965                        return Err(match error {
38966                            Ok(value) => common::Error::BadRequest(value),
38967                            _ => common::Error::Failure(response),
38968                        });
38969                    }
38970                    let response = {
38971                        let bytes = common::to_bytes(body).await.unwrap_or_default();
38972                        let encoded = common::to_string(&bytes);
38973                        match serde_json::from_str(&encoded) {
38974                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
38975                            Err(error) => {
38976                                dlg.response_json_decode_error(&encoded, &error);
38977                                return Err(common::Error::JsonDecodeError(
38978                                    encoded.to_string(),
38979                                    error,
38980                                ));
38981                            }
38982                        }
38983                    };
38984
38985                    dlg.finished(true);
38986                    return Ok(response);
38987                }
38988            }
38989        }
38990    }
38991
38992    /// User profile ID associated with this request.
38993    ///
38994    /// Sets the *profile id* path property to the given value.
38995    ///
38996    /// Even though the property as already been set when instantiating this call,
38997    /// we provide this method for API completeness.
38998    pub fn profile_id(mut self, new_value: i64) -> CreativeGroupGetCall<'a, C> {
38999        self._profile_id = new_value;
39000        self
39001    }
39002    /// Creative group ID.
39003    ///
39004    /// Sets the *id* path property to the given value.
39005    ///
39006    /// Even though the property as already been set when instantiating this call,
39007    /// we provide this method for API completeness.
39008    pub fn id(mut self, new_value: i64) -> CreativeGroupGetCall<'a, C> {
39009        self._id = new_value;
39010        self
39011    }
39012    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
39013    /// while executing the actual API request.
39014    ///
39015    /// ````text
39016    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
39017    /// ````
39018    ///
39019    /// Sets the *delegate* property to the given value.
39020    pub fn delegate(
39021        mut self,
39022        new_value: &'a mut dyn common::Delegate,
39023    ) -> CreativeGroupGetCall<'a, C> {
39024        self._delegate = Some(new_value);
39025        self
39026    }
39027
39028    /// Set any additional parameter of the query string used in the request.
39029    /// It should be used to set parameters which are not yet available through their own
39030    /// setters.
39031    ///
39032    /// Please note that this method must not be used to set any of the known parameters
39033    /// which have their own setter method. If done anyway, the request will fail.
39034    ///
39035    /// # Additional Parameters
39036    ///
39037    /// * *$.xgafv* (query-string) - V1 error format.
39038    /// * *access_token* (query-string) - OAuth access token.
39039    /// * *alt* (query-string) - Data format for response.
39040    /// * *callback* (query-string) - JSONP
39041    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
39042    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
39043    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
39044    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
39045    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
39046    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
39047    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
39048    pub fn param<T>(mut self, name: T, value: T) -> CreativeGroupGetCall<'a, C>
39049    where
39050        T: AsRef<str>,
39051    {
39052        self._additional_params
39053            .insert(name.as_ref().to_string(), value.as_ref().to_string());
39054        self
39055    }
39056
39057    /// Identifies the authorization scope for the method you are building.
39058    ///
39059    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
39060    /// [`Scope::Dfatrafficking`].
39061    ///
39062    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
39063    /// tokens for more than one scope.
39064    ///
39065    /// Usually there is more than one suitable scope to authorize an operation, some of which may
39066    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
39067    /// sufficient, a read-write scope will do as well.
39068    pub fn add_scope<St>(mut self, scope: St) -> CreativeGroupGetCall<'a, C>
39069    where
39070        St: AsRef<str>,
39071    {
39072        self._scopes.insert(String::from(scope.as_ref()));
39073        self
39074    }
39075    /// Identifies the authorization scope(s) for the method you are building.
39076    ///
39077    /// See [`Self::add_scope()`] for details.
39078    pub fn add_scopes<I, St>(mut self, scopes: I) -> CreativeGroupGetCall<'a, C>
39079    where
39080        I: IntoIterator<Item = St>,
39081        St: AsRef<str>,
39082    {
39083        self._scopes
39084            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
39085        self
39086    }
39087
39088    /// Removes all scopes, and no default scope will be used either.
39089    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
39090    /// for details).
39091    pub fn clear_scopes(mut self) -> CreativeGroupGetCall<'a, C> {
39092        self._scopes.clear();
39093        self
39094    }
39095}
39096
39097/// Inserts a new creative group.
39098///
39099/// A builder for the *insert* method supported by a *creativeGroup* resource.
39100/// It is not used directly, but through a [`CreativeGroupMethods`] instance.
39101///
39102/// # Example
39103///
39104/// Instantiate a resource method builder
39105///
39106/// ```test_harness,no_run
39107/// # extern crate hyper;
39108/// # extern crate hyper_rustls;
39109/// # extern crate google_dfareporting3d3 as dfareporting3d3;
39110/// use dfareporting3d3::api::CreativeGroup;
39111/// # async fn dox() {
39112/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
39113///
39114/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
39115/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
39116/// #     secret,
39117/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
39118/// # ).build().await.unwrap();
39119///
39120/// # let client = hyper_util::client::legacy::Client::builder(
39121/// #     hyper_util::rt::TokioExecutor::new()
39122/// # )
39123/// # .build(
39124/// #     hyper_rustls::HttpsConnectorBuilder::new()
39125/// #         .with_native_roots()
39126/// #         .unwrap()
39127/// #         .https_or_http()
39128/// #         .enable_http1()
39129/// #         .build()
39130/// # );
39131/// # let mut hub = Dfareporting::new(client, auth);
39132/// // As the method needs a request, you would usually fill it with the desired information
39133/// // into the respective structure. Some of the parts shown here might not be applicable !
39134/// // Values shown here are possibly random and not representative !
39135/// let mut req = CreativeGroup::default();
39136///
39137/// // You can configure optional parameters by calling the respective setters at will, and
39138/// // execute the final call using `doit()`.
39139/// // Values shown here are possibly random and not representative !
39140/// let result = hub.creative_groups().insert(req, -99)
39141///              .doit().await;
39142/// # }
39143/// ```
39144pub struct CreativeGroupInsertCall<'a, C>
39145where
39146    C: 'a,
39147{
39148    hub: &'a Dfareporting<C>,
39149    _request: CreativeGroup,
39150    _profile_id: i64,
39151    _delegate: Option<&'a mut dyn common::Delegate>,
39152    _additional_params: HashMap<String, String>,
39153    _scopes: BTreeSet<String>,
39154}
39155
39156impl<'a, C> common::CallBuilder for CreativeGroupInsertCall<'a, C> {}
39157
39158impl<'a, C> CreativeGroupInsertCall<'a, C>
39159where
39160    C: common::Connector,
39161{
39162    /// Perform the operation you have build so far.
39163    pub async fn doit(mut self) -> common::Result<(common::Response, CreativeGroup)> {
39164        use std::borrow::Cow;
39165        use std::io::{Read, Seek};
39166
39167        use common::{url::Params, ToParts};
39168        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
39169
39170        let mut dd = common::DefaultDelegate;
39171        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
39172        dlg.begin(common::MethodInfo {
39173            id: "dfareporting.creativeGroups.insert",
39174            http_method: hyper::Method::POST,
39175        });
39176
39177        for &field in ["alt", "profileId"].iter() {
39178            if self._additional_params.contains_key(field) {
39179                dlg.finished(false);
39180                return Err(common::Error::FieldClash(field));
39181            }
39182        }
39183
39184        let mut params = Params::with_capacity(4 + self._additional_params.len());
39185        params.push("profileId", self._profile_id.to_string());
39186
39187        params.extend(self._additional_params.iter());
39188
39189        params.push("alt", "json");
39190        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creativeGroups";
39191        if self._scopes.is_empty() {
39192            self._scopes
39193                .insert(Scope::Dfatrafficking.as_ref().to_string());
39194        }
39195
39196        #[allow(clippy::single_element_loop)]
39197        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
39198            url = params.uri_replacement(url, param_name, find_this, false);
39199        }
39200        {
39201            let to_remove = ["profileId"];
39202            params.remove_params(&to_remove);
39203        }
39204
39205        let url = params.parse_with_url(&url);
39206
39207        let mut json_mime_type = mime::APPLICATION_JSON;
39208        let mut request_value_reader = {
39209            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
39210            common::remove_json_null_values(&mut value);
39211            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
39212            serde_json::to_writer(&mut dst, &value).unwrap();
39213            dst
39214        };
39215        let request_size = request_value_reader
39216            .seek(std::io::SeekFrom::End(0))
39217            .unwrap();
39218        request_value_reader
39219            .seek(std::io::SeekFrom::Start(0))
39220            .unwrap();
39221
39222        loop {
39223            let token = match self
39224                .hub
39225                .auth
39226                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
39227                .await
39228            {
39229                Ok(token) => token,
39230                Err(e) => match dlg.token(e) {
39231                    Ok(token) => token,
39232                    Err(e) => {
39233                        dlg.finished(false);
39234                        return Err(common::Error::MissingToken(e));
39235                    }
39236                },
39237            };
39238            request_value_reader
39239                .seek(std::io::SeekFrom::Start(0))
39240                .unwrap();
39241            let mut req_result = {
39242                let client = &self.hub.client;
39243                dlg.pre_request();
39244                let mut req_builder = hyper::Request::builder()
39245                    .method(hyper::Method::POST)
39246                    .uri(url.as_str())
39247                    .header(USER_AGENT, self.hub._user_agent.clone());
39248
39249                if let Some(token) = token.as_ref() {
39250                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
39251                }
39252
39253                let request = req_builder
39254                    .header(CONTENT_TYPE, json_mime_type.to_string())
39255                    .header(CONTENT_LENGTH, request_size as u64)
39256                    .body(common::to_body(
39257                        request_value_reader.get_ref().clone().into(),
39258                    ));
39259
39260                client.request(request.unwrap()).await
39261            };
39262
39263            match req_result {
39264                Err(err) => {
39265                    if let common::Retry::After(d) = dlg.http_error(&err) {
39266                        sleep(d).await;
39267                        continue;
39268                    }
39269                    dlg.finished(false);
39270                    return Err(common::Error::HttpError(err));
39271                }
39272                Ok(res) => {
39273                    let (mut parts, body) = res.into_parts();
39274                    let mut body = common::Body::new(body);
39275                    if !parts.status.is_success() {
39276                        let bytes = common::to_bytes(body).await.unwrap_or_default();
39277                        let error = serde_json::from_str(&common::to_string(&bytes));
39278                        let response = common::to_response(parts, bytes.into());
39279
39280                        if let common::Retry::After(d) =
39281                            dlg.http_failure(&response, error.as_ref().ok())
39282                        {
39283                            sleep(d).await;
39284                            continue;
39285                        }
39286
39287                        dlg.finished(false);
39288
39289                        return Err(match error {
39290                            Ok(value) => common::Error::BadRequest(value),
39291                            _ => common::Error::Failure(response),
39292                        });
39293                    }
39294                    let response = {
39295                        let bytes = common::to_bytes(body).await.unwrap_or_default();
39296                        let encoded = common::to_string(&bytes);
39297                        match serde_json::from_str(&encoded) {
39298                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
39299                            Err(error) => {
39300                                dlg.response_json_decode_error(&encoded, &error);
39301                                return Err(common::Error::JsonDecodeError(
39302                                    encoded.to_string(),
39303                                    error,
39304                                ));
39305                            }
39306                        }
39307                    };
39308
39309                    dlg.finished(true);
39310                    return Ok(response);
39311                }
39312            }
39313        }
39314    }
39315
39316    ///
39317    /// Sets the *request* property to the given value.
39318    ///
39319    /// Even though the property as already been set when instantiating this call,
39320    /// we provide this method for API completeness.
39321    pub fn request(mut self, new_value: CreativeGroup) -> CreativeGroupInsertCall<'a, C> {
39322        self._request = new_value;
39323        self
39324    }
39325    /// User profile ID associated with this request.
39326    ///
39327    /// Sets the *profile id* path property to the given value.
39328    ///
39329    /// Even though the property as already been set when instantiating this call,
39330    /// we provide this method for API completeness.
39331    pub fn profile_id(mut self, new_value: i64) -> CreativeGroupInsertCall<'a, C> {
39332        self._profile_id = new_value;
39333        self
39334    }
39335    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
39336    /// while executing the actual API request.
39337    ///
39338    /// ````text
39339    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
39340    /// ````
39341    ///
39342    /// Sets the *delegate* property to the given value.
39343    pub fn delegate(
39344        mut self,
39345        new_value: &'a mut dyn common::Delegate,
39346    ) -> CreativeGroupInsertCall<'a, C> {
39347        self._delegate = Some(new_value);
39348        self
39349    }
39350
39351    /// Set any additional parameter of the query string used in the request.
39352    /// It should be used to set parameters which are not yet available through their own
39353    /// setters.
39354    ///
39355    /// Please note that this method must not be used to set any of the known parameters
39356    /// which have their own setter method. If done anyway, the request will fail.
39357    ///
39358    /// # Additional Parameters
39359    ///
39360    /// * *$.xgafv* (query-string) - V1 error format.
39361    /// * *access_token* (query-string) - OAuth access token.
39362    /// * *alt* (query-string) - Data format for response.
39363    /// * *callback* (query-string) - JSONP
39364    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
39365    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
39366    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
39367    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
39368    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
39369    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
39370    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
39371    pub fn param<T>(mut self, name: T, value: T) -> CreativeGroupInsertCall<'a, C>
39372    where
39373        T: AsRef<str>,
39374    {
39375        self._additional_params
39376            .insert(name.as_ref().to_string(), value.as_ref().to_string());
39377        self
39378    }
39379
39380    /// Identifies the authorization scope for the method you are building.
39381    ///
39382    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
39383    /// [`Scope::Dfatrafficking`].
39384    ///
39385    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
39386    /// tokens for more than one scope.
39387    ///
39388    /// Usually there is more than one suitable scope to authorize an operation, some of which may
39389    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
39390    /// sufficient, a read-write scope will do as well.
39391    pub fn add_scope<St>(mut self, scope: St) -> CreativeGroupInsertCall<'a, C>
39392    where
39393        St: AsRef<str>,
39394    {
39395        self._scopes.insert(String::from(scope.as_ref()));
39396        self
39397    }
39398    /// Identifies the authorization scope(s) for the method you are building.
39399    ///
39400    /// See [`Self::add_scope()`] for details.
39401    pub fn add_scopes<I, St>(mut self, scopes: I) -> CreativeGroupInsertCall<'a, C>
39402    where
39403        I: IntoIterator<Item = St>,
39404        St: AsRef<str>,
39405    {
39406        self._scopes
39407            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
39408        self
39409    }
39410
39411    /// Removes all scopes, and no default scope will be used either.
39412    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
39413    /// for details).
39414    pub fn clear_scopes(mut self) -> CreativeGroupInsertCall<'a, C> {
39415        self._scopes.clear();
39416        self
39417    }
39418}
39419
39420/// Retrieves a list of creative groups, possibly filtered. This method supports paging.
39421///
39422/// A builder for the *list* method supported by a *creativeGroup* resource.
39423/// It is not used directly, but through a [`CreativeGroupMethods`] instance.
39424///
39425/// # Example
39426///
39427/// Instantiate a resource method builder
39428///
39429/// ```test_harness,no_run
39430/// # extern crate hyper;
39431/// # extern crate hyper_rustls;
39432/// # extern crate google_dfareporting3d3 as dfareporting3d3;
39433/// # async fn dox() {
39434/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
39435///
39436/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
39437/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
39438/// #     secret,
39439/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
39440/// # ).build().await.unwrap();
39441///
39442/// # let client = hyper_util::client::legacy::Client::builder(
39443/// #     hyper_util::rt::TokioExecutor::new()
39444/// # )
39445/// # .build(
39446/// #     hyper_rustls::HttpsConnectorBuilder::new()
39447/// #         .with_native_roots()
39448/// #         .unwrap()
39449/// #         .https_or_http()
39450/// #         .enable_http1()
39451/// #         .build()
39452/// # );
39453/// # let mut hub = Dfareporting::new(client, auth);
39454/// // You can configure optional parameters by calling the respective setters at will, and
39455/// // execute the final call using `doit()`.
39456/// // Values shown here are possibly random and not representative !
39457/// let result = hub.creative_groups().list(-82)
39458///              .sort_order("magna")
39459///              .sort_field("diam")
39460///              .search_string("nonumy")
39461///              .page_token("et")
39462///              .max_results(-8)
39463///              .add_ids(-23)
39464///              .group_number(-39)
39465///              .add_advertiser_ids(-43)
39466///              .doit().await;
39467/// # }
39468/// ```
39469pub struct CreativeGroupListCall<'a, C>
39470where
39471    C: 'a,
39472{
39473    hub: &'a Dfareporting<C>,
39474    _profile_id: i64,
39475    _sort_order: Option<String>,
39476    _sort_field: Option<String>,
39477    _search_string: Option<String>,
39478    _page_token: Option<String>,
39479    _max_results: Option<i32>,
39480    _ids: Vec<i64>,
39481    _group_number: Option<i32>,
39482    _advertiser_ids: Vec<i64>,
39483    _delegate: Option<&'a mut dyn common::Delegate>,
39484    _additional_params: HashMap<String, String>,
39485    _scopes: BTreeSet<String>,
39486}
39487
39488impl<'a, C> common::CallBuilder for CreativeGroupListCall<'a, C> {}
39489
39490impl<'a, C> CreativeGroupListCall<'a, C>
39491where
39492    C: common::Connector,
39493{
39494    /// Perform the operation you have build so far.
39495    pub async fn doit(mut self) -> common::Result<(common::Response, CreativeGroupsListResponse)> {
39496        use std::borrow::Cow;
39497        use std::io::{Read, Seek};
39498
39499        use common::{url::Params, ToParts};
39500        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
39501
39502        let mut dd = common::DefaultDelegate;
39503        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
39504        dlg.begin(common::MethodInfo {
39505            id: "dfareporting.creativeGroups.list",
39506            http_method: hyper::Method::GET,
39507        });
39508
39509        for &field in [
39510            "alt",
39511            "profileId",
39512            "sortOrder",
39513            "sortField",
39514            "searchString",
39515            "pageToken",
39516            "maxResults",
39517            "ids",
39518            "groupNumber",
39519            "advertiserIds",
39520        ]
39521        .iter()
39522        {
39523            if self._additional_params.contains_key(field) {
39524                dlg.finished(false);
39525                return Err(common::Error::FieldClash(field));
39526            }
39527        }
39528
39529        let mut params = Params::with_capacity(11 + self._additional_params.len());
39530        params.push("profileId", self._profile_id.to_string());
39531        if let Some(value) = self._sort_order.as_ref() {
39532            params.push("sortOrder", value);
39533        }
39534        if let Some(value) = self._sort_field.as_ref() {
39535            params.push("sortField", value);
39536        }
39537        if let Some(value) = self._search_string.as_ref() {
39538            params.push("searchString", value);
39539        }
39540        if let Some(value) = self._page_token.as_ref() {
39541            params.push("pageToken", value);
39542        }
39543        if let Some(value) = self._max_results.as_ref() {
39544            params.push("maxResults", value.to_string());
39545        }
39546        if !self._ids.is_empty() {
39547            for f in self._ids.iter() {
39548                params.push("ids", f.to_string());
39549            }
39550        }
39551        if let Some(value) = self._group_number.as_ref() {
39552            params.push("groupNumber", value.to_string());
39553        }
39554        if !self._advertiser_ids.is_empty() {
39555            for f in self._advertiser_ids.iter() {
39556                params.push("advertiserIds", f.to_string());
39557            }
39558        }
39559
39560        params.extend(self._additional_params.iter());
39561
39562        params.push("alt", "json");
39563        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creativeGroups";
39564        if self._scopes.is_empty() {
39565            self._scopes
39566                .insert(Scope::Dfatrafficking.as_ref().to_string());
39567        }
39568
39569        #[allow(clippy::single_element_loop)]
39570        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
39571            url = params.uri_replacement(url, param_name, find_this, false);
39572        }
39573        {
39574            let to_remove = ["profileId"];
39575            params.remove_params(&to_remove);
39576        }
39577
39578        let url = params.parse_with_url(&url);
39579
39580        loop {
39581            let token = match self
39582                .hub
39583                .auth
39584                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
39585                .await
39586            {
39587                Ok(token) => token,
39588                Err(e) => match dlg.token(e) {
39589                    Ok(token) => token,
39590                    Err(e) => {
39591                        dlg.finished(false);
39592                        return Err(common::Error::MissingToken(e));
39593                    }
39594                },
39595            };
39596            let mut req_result = {
39597                let client = &self.hub.client;
39598                dlg.pre_request();
39599                let mut req_builder = hyper::Request::builder()
39600                    .method(hyper::Method::GET)
39601                    .uri(url.as_str())
39602                    .header(USER_AGENT, self.hub._user_agent.clone());
39603
39604                if let Some(token) = token.as_ref() {
39605                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
39606                }
39607
39608                let request = req_builder
39609                    .header(CONTENT_LENGTH, 0_u64)
39610                    .body(common::to_body::<String>(None));
39611
39612                client.request(request.unwrap()).await
39613            };
39614
39615            match req_result {
39616                Err(err) => {
39617                    if let common::Retry::After(d) = dlg.http_error(&err) {
39618                        sleep(d).await;
39619                        continue;
39620                    }
39621                    dlg.finished(false);
39622                    return Err(common::Error::HttpError(err));
39623                }
39624                Ok(res) => {
39625                    let (mut parts, body) = res.into_parts();
39626                    let mut body = common::Body::new(body);
39627                    if !parts.status.is_success() {
39628                        let bytes = common::to_bytes(body).await.unwrap_or_default();
39629                        let error = serde_json::from_str(&common::to_string(&bytes));
39630                        let response = common::to_response(parts, bytes.into());
39631
39632                        if let common::Retry::After(d) =
39633                            dlg.http_failure(&response, error.as_ref().ok())
39634                        {
39635                            sleep(d).await;
39636                            continue;
39637                        }
39638
39639                        dlg.finished(false);
39640
39641                        return Err(match error {
39642                            Ok(value) => common::Error::BadRequest(value),
39643                            _ => common::Error::Failure(response),
39644                        });
39645                    }
39646                    let response = {
39647                        let bytes = common::to_bytes(body).await.unwrap_or_default();
39648                        let encoded = common::to_string(&bytes);
39649                        match serde_json::from_str(&encoded) {
39650                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
39651                            Err(error) => {
39652                                dlg.response_json_decode_error(&encoded, &error);
39653                                return Err(common::Error::JsonDecodeError(
39654                                    encoded.to_string(),
39655                                    error,
39656                                ));
39657                            }
39658                        }
39659                    };
39660
39661                    dlg.finished(true);
39662                    return Ok(response);
39663                }
39664            }
39665        }
39666    }
39667
39668    /// User profile ID associated with this request.
39669    ///
39670    /// Sets the *profile id* path property to the given value.
39671    ///
39672    /// Even though the property as already been set when instantiating this call,
39673    /// we provide this method for API completeness.
39674    pub fn profile_id(mut self, new_value: i64) -> CreativeGroupListCall<'a, C> {
39675        self._profile_id = new_value;
39676        self
39677    }
39678    /// Order of sorted results.
39679    ///
39680    /// Sets the *sort order* query property to the given value.
39681    pub fn sort_order(mut self, new_value: &str) -> CreativeGroupListCall<'a, C> {
39682        self._sort_order = Some(new_value.to_string());
39683        self
39684    }
39685    /// Field by which to sort the list.
39686    ///
39687    /// Sets the *sort field* query property to the given value.
39688    pub fn sort_field(mut self, new_value: &str) -> CreativeGroupListCall<'a, C> {
39689        self._sort_field = Some(new_value.to_string());
39690        self
39691    }
39692    /// Allows searching for creative groups by name or ID. Wildcards (*) are allowed. For example, "creativegroup*2015" will return creative groups with names like "creativegroup June 2015", "creativegroup April 2015", or simply "creativegroup 2015". Most of the searches also add wild-cards implicitly at the start and the end of the search string. For example, a search string of "creativegroup" will match creative groups with the name "my creativegroup", "creativegroup 2015", or simply "creativegroup".
39693    ///
39694    /// Sets the *search string* query property to the given value.
39695    pub fn search_string(mut self, new_value: &str) -> CreativeGroupListCall<'a, C> {
39696        self._search_string = Some(new_value.to_string());
39697        self
39698    }
39699    /// Value of the nextPageToken from the previous result page.
39700    ///
39701    /// Sets the *page token* query property to the given value.
39702    pub fn page_token(mut self, new_value: &str) -> CreativeGroupListCall<'a, C> {
39703        self._page_token = Some(new_value.to_string());
39704        self
39705    }
39706    /// Maximum number of results to return.
39707    ///
39708    /// Sets the *max results* query property to the given value.
39709    pub fn max_results(mut self, new_value: i32) -> CreativeGroupListCall<'a, C> {
39710        self._max_results = Some(new_value);
39711        self
39712    }
39713    /// Select only creative groups with these IDs.
39714    ///
39715    /// Append the given value to the *ids* query property.
39716    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
39717    pub fn add_ids(mut self, new_value: i64) -> CreativeGroupListCall<'a, C> {
39718        self._ids.push(new_value);
39719        self
39720    }
39721    /// Select only creative groups that belong to this subgroup.
39722    ///
39723    /// Sets the *group number* query property to the given value.
39724    pub fn group_number(mut self, new_value: i32) -> CreativeGroupListCall<'a, C> {
39725        self._group_number = Some(new_value);
39726        self
39727    }
39728    /// Select only creative groups that belong to these advertisers.
39729    ///
39730    /// Append the given value to the *advertiser ids* query property.
39731    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
39732    pub fn add_advertiser_ids(mut self, new_value: i64) -> CreativeGroupListCall<'a, C> {
39733        self._advertiser_ids.push(new_value);
39734        self
39735    }
39736    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
39737    /// while executing the actual API request.
39738    ///
39739    /// ````text
39740    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
39741    /// ````
39742    ///
39743    /// Sets the *delegate* property to the given value.
39744    pub fn delegate(
39745        mut self,
39746        new_value: &'a mut dyn common::Delegate,
39747    ) -> CreativeGroupListCall<'a, C> {
39748        self._delegate = Some(new_value);
39749        self
39750    }
39751
39752    /// Set any additional parameter of the query string used in the request.
39753    /// It should be used to set parameters which are not yet available through their own
39754    /// setters.
39755    ///
39756    /// Please note that this method must not be used to set any of the known parameters
39757    /// which have their own setter method. If done anyway, the request will fail.
39758    ///
39759    /// # Additional Parameters
39760    ///
39761    /// * *$.xgafv* (query-string) - V1 error format.
39762    /// * *access_token* (query-string) - OAuth access token.
39763    /// * *alt* (query-string) - Data format for response.
39764    /// * *callback* (query-string) - JSONP
39765    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
39766    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
39767    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
39768    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
39769    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
39770    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
39771    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
39772    pub fn param<T>(mut self, name: T, value: T) -> CreativeGroupListCall<'a, C>
39773    where
39774        T: AsRef<str>,
39775    {
39776        self._additional_params
39777            .insert(name.as_ref().to_string(), value.as_ref().to_string());
39778        self
39779    }
39780
39781    /// Identifies the authorization scope for the method you are building.
39782    ///
39783    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
39784    /// [`Scope::Dfatrafficking`].
39785    ///
39786    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
39787    /// tokens for more than one scope.
39788    ///
39789    /// Usually there is more than one suitable scope to authorize an operation, some of which may
39790    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
39791    /// sufficient, a read-write scope will do as well.
39792    pub fn add_scope<St>(mut self, scope: St) -> CreativeGroupListCall<'a, C>
39793    where
39794        St: AsRef<str>,
39795    {
39796        self._scopes.insert(String::from(scope.as_ref()));
39797        self
39798    }
39799    /// Identifies the authorization scope(s) for the method you are building.
39800    ///
39801    /// See [`Self::add_scope()`] for details.
39802    pub fn add_scopes<I, St>(mut self, scopes: I) -> CreativeGroupListCall<'a, C>
39803    where
39804        I: IntoIterator<Item = St>,
39805        St: AsRef<str>,
39806    {
39807        self._scopes
39808            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
39809        self
39810    }
39811
39812    /// Removes all scopes, and no default scope will be used either.
39813    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
39814    /// for details).
39815    pub fn clear_scopes(mut self) -> CreativeGroupListCall<'a, C> {
39816        self._scopes.clear();
39817        self
39818    }
39819}
39820
39821/// Updates an existing creative group. This method supports patch semantics.
39822///
39823/// A builder for the *patch* method supported by a *creativeGroup* resource.
39824/// It is not used directly, but through a [`CreativeGroupMethods`] instance.
39825///
39826/// # Example
39827///
39828/// Instantiate a resource method builder
39829///
39830/// ```test_harness,no_run
39831/// # extern crate hyper;
39832/// # extern crate hyper_rustls;
39833/// # extern crate google_dfareporting3d3 as dfareporting3d3;
39834/// use dfareporting3d3::api::CreativeGroup;
39835/// # async fn dox() {
39836/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
39837///
39838/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
39839/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
39840/// #     secret,
39841/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
39842/// # ).build().await.unwrap();
39843///
39844/// # let client = hyper_util::client::legacy::Client::builder(
39845/// #     hyper_util::rt::TokioExecutor::new()
39846/// # )
39847/// # .build(
39848/// #     hyper_rustls::HttpsConnectorBuilder::new()
39849/// #         .with_native_roots()
39850/// #         .unwrap()
39851/// #         .https_or_http()
39852/// #         .enable_http1()
39853/// #         .build()
39854/// # );
39855/// # let mut hub = Dfareporting::new(client, auth);
39856/// // As the method needs a request, you would usually fill it with the desired information
39857/// // into the respective structure. Some of the parts shown here might not be applicable !
39858/// // Values shown here are possibly random and not representative !
39859/// let mut req = CreativeGroup::default();
39860///
39861/// // You can configure optional parameters by calling the respective setters at will, and
39862/// // execute the final call using `doit()`.
39863/// // Values shown here are possibly random and not representative !
39864/// let result = hub.creative_groups().patch(req, -7, -9)
39865///              .doit().await;
39866/// # }
39867/// ```
39868pub struct CreativeGroupPatchCall<'a, C>
39869where
39870    C: 'a,
39871{
39872    hub: &'a Dfareporting<C>,
39873    _request: CreativeGroup,
39874    _profile_id: i64,
39875    _id: i64,
39876    _delegate: Option<&'a mut dyn common::Delegate>,
39877    _additional_params: HashMap<String, String>,
39878    _scopes: BTreeSet<String>,
39879}
39880
39881impl<'a, C> common::CallBuilder for CreativeGroupPatchCall<'a, C> {}
39882
39883impl<'a, C> CreativeGroupPatchCall<'a, C>
39884where
39885    C: common::Connector,
39886{
39887    /// Perform the operation you have build so far.
39888    pub async fn doit(mut self) -> common::Result<(common::Response, CreativeGroup)> {
39889        use std::borrow::Cow;
39890        use std::io::{Read, Seek};
39891
39892        use common::{url::Params, ToParts};
39893        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
39894
39895        let mut dd = common::DefaultDelegate;
39896        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
39897        dlg.begin(common::MethodInfo {
39898            id: "dfareporting.creativeGroups.patch",
39899            http_method: hyper::Method::PATCH,
39900        });
39901
39902        for &field in ["alt", "profileId", "id"].iter() {
39903            if self._additional_params.contains_key(field) {
39904                dlg.finished(false);
39905                return Err(common::Error::FieldClash(field));
39906            }
39907        }
39908
39909        let mut params = Params::with_capacity(5 + self._additional_params.len());
39910        params.push("profileId", self._profile_id.to_string());
39911        params.push("id", self._id.to_string());
39912
39913        params.extend(self._additional_params.iter());
39914
39915        params.push("alt", "json");
39916        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creativeGroups";
39917        if self._scopes.is_empty() {
39918            self._scopes
39919                .insert(Scope::Dfatrafficking.as_ref().to_string());
39920        }
39921
39922        #[allow(clippy::single_element_loop)]
39923        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
39924            url = params.uri_replacement(url, param_name, find_this, false);
39925        }
39926        {
39927            let to_remove = ["profileId"];
39928            params.remove_params(&to_remove);
39929        }
39930
39931        let url = params.parse_with_url(&url);
39932
39933        let mut json_mime_type = mime::APPLICATION_JSON;
39934        let mut request_value_reader = {
39935            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
39936            common::remove_json_null_values(&mut value);
39937            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
39938            serde_json::to_writer(&mut dst, &value).unwrap();
39939            dst
39940        };
39941        let request_size = request_value_reader
39942            .seek(std::io::SeekFrom::End(0))
39943            .unwrap();
39944        request_value_reader
39945            .seek(std::io::SeekFrom::Start(0))
39946            .unwrap();
39947
39948        loop {
39949            let token = match self
39950                .hub
39951                .auth
39952                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
39953                .await
39954            {
39955                Ok(token) => token,
39956                Err(e) => match dlg.token(e) {
39957                    Ok(token) => token,
39958                    Err(e) => {
39959                        dlg.finished(false);
39960                        return Err(common::Error::MissingToken(e));
39961                    }
39962                },
39963            };
39964            request_value_reader
39965                .seek(std::io::SeekFrom::Start(0))
39966                .unwrap();
39967            let mut req_result = {
39968                let client = &self.hub.client;
39969                dlg.pre_request();
39970                let mut req_builder = hyper::Request::builder()
39971                    .method(hyper::Method::PATCH)
39972                    .uri(url.as_str())
39973                    .header(USER_AGENT, self.hub._user_agent.clone());
39974
39975                if let Some(token) = token.as_ref() {
39976                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
39977                }
39978
39979                let request = req_builder
39980                    .header(CONTENT_TYPE, json_mime_type.to_string())
39981                    .header(CONTENT_LENGTH, request_size as u64)
39982                    .body(common::to_body(
39983                        request_value_reader.get_ref().clone().into(),
39984                    ));
39985
39986                client.request(request.unwrap()).await
39987            };
39988
39989            match req_result {
39990                Err(err) => {
39991                    if let common::Retry::After(d) = dlg.http_error(&err) {
39992                        sleep(d).await;
39993                        continue;
39994                    }
39995                    dlg.finished(false);
39996                    return Err(common::Error::HttpError(err));
39997                }
39998                Ok(res) => {
39999                    let (mut parts, body) = res.into_parts();
40000                    let mut body = common::Body::new(body);
40001                    if !parts.status.is_success() {
40002                        let bytes = common::to_bytes(body).await.unwrap_or_default();
40003                        let error = serde_json::from_str(&common::to_string(&bytes));
40004                        let response = common::to_response(parts, bytes.into());
40005
40006                        if let common::Retry::After(d) =
40007                            dlg.http_failure(&response, error.as_ref().ok())
40008                        {
40009                            sleep(d).await;
40010                            continue;
40011                        }
40012
40013                        dlg.finished(false);
40014
40015                        return Err(match error {
40016                            Ok(value) => common::Error::BadRequest(value),
40017                            _ => common::Error::Failure(response),
40018                        });
40019                    }
40020                    let response = {
40021                        let bytes = common::to_bytes(body).await.unwrap_or_default();
40022                        let encoded = common::to_string(&bytes);
40023                        match serde_json::from_str(&encoded) {
40024                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
40025                            Err(error) => {
40026                                dlg.response_json_decode_error(&encoded, &error);
40027                                return Err(common::Error::JsonDecodeError(
40028                                    encoded.to_string(),
40029                                    error,
40030                                ));
40031                            }
40032                        }
40033                    };
40034
40035                    dlg.finished(true);
40036                    return Ok(response);
40037                }
40038            }
40039        }
40040    }
40041
40042    ///
40043    /// Sets the *request* property to the given value.
40044    ///
40045    /// Even though the property as already been set when instantiating this call,
40046    /// we provide this method for API completeness.
40047    pub fn request(mut self, new_value: CreativeGroup) -> CreativeGroupPatchCall<'a, C> {
40048        self._request = new_value;
40049        self
40050    }
40051    /// User profile ID associated with this request.
40052    ///
40053    /// Sets the *profile id* path property to the given value.
40054    ///
40055    /// Even though the property as already been set when instantiating this call,
40056    /// we provide this method for API completeness.
40057    pub fn profile_id(mut self, new_value: i64) -> CreativeGroupPatchCall<'a, C> {
40058        self._profile_id = new_value;
40059        self
40060    }
40061    /// CreativeGroup ID.
40062    ///
40063    /// Sets the *id* query property to the given value.
40064    ///
40065    /// Even though the property as already been set when instantiating this call,
40066    /// we provide this method for API completeness.
40067    pub fn id(mut self, new_value: i64) -> CreativeGroupPatchCall<'a, C> {
40068        self._id = new_value;
40069        self
40070    }
40071    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
40072    /// while executing the actual API request.
40073    ///
40074    /// ````text
40075    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
40076    /// ````
40077    ///
40078    /// Sets the *delegate* property to the given value.
40079    pub fn delegate(
40080        mut self,
40081        new_value: &'a mut dyn common::Delegate,
40082    ) -> CreativeGroupPatchCall<'a, C> {
40083        self._delegate = Some(new_value);
40084        self
40085    }
40086
40087    /// Set any additional parameter of the query string used in the request.
40088    /// It should be used to set parameters which are not yet available through their own
40089    /// setters.
40090    ///
40091    /// Please note that this method must not be used to set any of the known parameters
40092    /// which have their own setter method. If done anyway, the request will fail.
40093    ///
40094    /// # Additional Parameters
40095    ///
40096    /// * *$.xgafv* (query-string) - V1 error format.
40097    /// * *access_token* (query-string) - OAuth access token.
40098    /// * *alt* (query-string) - Data format for response.
40099    /// * *callback* (query-string) - JSONP
40100    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
40101    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
40102    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
40103    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
40104    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
40105    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
40106    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
40107    pub fn param<T>(mut self, name: T, value: T) -> CreativeGroupPatchCall<'a, C>
40108    where
40109        T: AsRef<str>,
40110    {
40111        self._additional_params
40112            .insert(name.as_ref().to_string(), value.as_ref().to_string());
40113        self
40114    }
40115
40116    /// Identifies the authorization scope for the method you are building.
40117    ///
40118    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
40119    /// [`Scope::Dfatrafficking`].
40120    ///
40121    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
40122    /// tokens for more than one scope.
40123    ///
40124    /// Usually there is more than one suitable scope to authorize an operation, some of which may
40125    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
40126    /// sufficient, a read-write scope will do as well.
40127    pub fn add_scope<St>(mut self, scope: St) -> CreativeGroupPatchCall<'a, C>
40128    where
40129        St: AsRef<str>,
40130    {
40131        self._scopes.insert(String::from(scope.as_ref()));
40132        self
40133    }
40134    /// Identifies the authorization scope(s) for the method you are building.
40135    ///
40136    /// See [`Self::add_scope()`] for details.
40137    pub fn add_scopes<I, St>(mut self, scopes: I) -> CreativeGroupPatchCall<'a, C>
40138    where
40139        I: IntoIterator<Item = St>,
40140        St: AsRef<str>,
40141    {
40142        self._scopes
40143            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
40144        self
40145    }
40146
40147    /// Removes all scopes, and no default scope will be used either.
40148    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
40149    /// for details).
40150    pub fn clear_scopes(mut self) -> CreativeGroupPatchCall<'a, C> {
40151        self._scopes.clear();
40152        self
40153    }
40154}
40155
40156/// Updates an existing creative group.
40157///
40158/// A builder for the *update* method supported by a *creativeGroup* resource.
40159/// It is not used directly, but through a [`CreativeGroupMethods`] instance.
40160///
40161/// # Example
40162///
40163/// Instantiate a resource method builder
40164///
40165/// ```test_harness,no_run
40166/// # extern crate hyper;
40167/// # extern crate hyper_rustls;
40168/// # extern crate google_dfareporting3d3 as dfareporting3d3;
40169/// use dfareporting3d3::api::CreativeGroup;
40170/// # async fn dox() {
40171/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
40172///
40173/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
40174/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
40175/// #     secret,
40176/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
40177/// # ).build().await.unwrap();
40178///
40179/// # let client = hyper_util::client::legacy::Client::builder(
40180/// #     hyper_util::rt::TokioExecutor::new()
40181/// # )
40182/// # .build(
40183/// #     hyper_rustls::HttpsConnectorBuilder::new()
40184/// #         .with_native_roots()
40185/// #         .unwrap()
40186/// #         .https_or_http()
40187/// #         .enable_http1()
40188/// #         .build()
40189/// # );
40190/// # let mut hub = Dfareporting::new(client, auth);
40191/// // As the method needs a request, you would usually fill it with the desired information
40192/// // into the respective structure. Some of the parts shown here might not be applicable !
40193/// // Values shown here are possibly random and not representative !
40194/// let mut req = CreativeGroup::default();
40195///
40196/// // You can configure optional parameters by calling the respective setters at will, and
40197/// // execute the final call using `doit()`.
40198/// // Values shown here are possibly random and not representative !
40199/// let result = hub.creative_groups().update(req, -99)
40200///              .doit().await;
40201/// # }
40202/// ```
40203pub struct CreativeGroupUpdateCall<'a, C>
40204where
40205    C: 'a,
40206{
40207    hub: &'a Dfareporting<C>,
40208    _request: CreativeGroup,
40209    _profile_id: i64,
40210    _delegate: Option<&'a mut dyn common::Delegate>,
40211    _additional_params: HashMap<String, String>,
40212    _scopes: BTreeSet<String>,
40213}
40214
40215impl<'a, C> common::CallBuilder for CreativeGroupUpdateCall<'a, C> {}
40216
40217impl<'a, C> CreativeGroupUpdateCall<'a, C>
40218where
40219    C: common::Connector,
40220{
40221    /// Perform the operation you have build so far.
40222    pub async fn doit(mut self) -> common::Result<(common::Response, CreativeGroup)> {
40223        use std::borrow::Cow;
40224        use std::io::{Read, Seek};
40225
40226        use common::{url::Params, ToParts};
40227        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
40228
40229        let mut dd = common::DefaultDelegate;
40230        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
40231        dlg.begin(common::MethodInfo {
40232            id: "dfareporting.creativeGroups.update",
40233            http_method: hyper::Method::PUT,
40234        });
40235
40236        for &field in ["alt", "profileId"].iter() {
40237            if self._additional_params.contains_key(field) {
40238                dlg.finished(false);
40239                return Err(common::Error::FieldClash(field));
40240            }
40241        }
40242
40243        let mut params = Params::with_capacity(4 + self._additional_params.len());
40244        params.push("profileId", self._profile_id.to_string());
40245
40246        params.extend(self._additional_params.iter());
40247
40248        params.push("alt", "json");
40249        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creativeGroups";
40250        if self._scopes.is_empty() {
40251            self._scopes
40252                .insert(Scope::Dfatrafficking.as_ref().to_string());
40253        }
40254
40255        #[allow(clippy::single_element_loop)]
40256        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
40257            url = params.uri_replacement(url, param_name, find_this, false);
40258        }
40259        {
40260            let to_remove = ["profileId"];
40261            params.remove_params(&to_remove);
40262        }
40263
40264        let url = params.parse_with_url(&url);
40265
40266        let mut json_mime_type = mime::APPLICATION_JSON;
40267        let mut request_value_reader = {
40268            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
40269            common::remove_json_null_values(&mut value);
40270            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
40271            serde_json::to_writer(&mut dst, &value).unwrap();
40272            dst
40273        };
40274        let request_size = request_value_reader
40275            .seek(std::io::SeekFrom::End(0))
40276            .unwrap();
40277        request_value_reader
40278            .seek(std::io::SeekFrom::Start(0))
40279            .unwrap();
40280
40281        loop {
40282            let token = match self
40283                .hub
40284                .auth
40285                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
40286                .await
40287            {
40288                Ok(token) => token,
40289                Err(e) => match dlg.token(e) {
40290                    Ok(token) => token,
40291                    Err(e) => {
40292                        dlg.finished(false);
40293                        return Err(common::Error::MissingToken(e));
40294                    }
40295                },
40296            };
40297            request_value_reader
40298                .seek(std::io::SeekFrom::Start(0))
40299                .unwrap();
40300            let mut req_result = {
40301                let client = &self.hub.client;
40302                dlg.pre_request();
40303                let mut req_builder = hyper::Request::builder()
40304                    .method(hyper::Method::PUT)
40305                    .uri(url.as_str())
40306                    .header(USER_AGENT, self.hub._user_agent.clone());
40307
40308                if let Some(token) = token.as_ref() {
40309                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
40310                }
40311
40312                let request = req_builder
40313                    .header(CONTENT_TYPE, json_mime_type.to_string())
40314                    .header(CONTENT_LENGTH, request_size as u64)
40315                    .body(common::to_body(
40316                        request_value_reader.get_ref().clone().into(),
40317                    ));
40318
40319                client.request(request.unwrap()).await
40320            };
40321
40322            match req_result {
40323                Err(err) => {
40324                    if let common::Retry::After(d) = dlg.http_error(&err) {
40325                        sleep(d).await;
40326                        continue;
40327                    }
40328                    dlg.finished(false);
40329                    return Err(common::Error::HttpError(err));
40330                }
40331                Ok(res) => {
40332                    let (mut parts, body) = res.into_parts();
40333                    let mut body = common::Body::new(body);
40334                    if !parts.status.is_success() {
40335                        let bytes = common::to_bytes(body).await.unwrap_or_default();
40336                        let error = serde_json::from_str(&common::to_string(&bytes));
40337                        let response = common::to_response(parts, bytes.into());
40338
40339                        if let common::Retry::After(d) =
40340                            dlg.http_failure(&response, error.as_ref().ok())
40341                        {
40342                            sleep(d).await;
40343                            continue;
40344                        }
40345
40346                        dlg.finished(false);
40347
40348                        return Err(match error {
40349                            Ok(value) => common::Error::BadRequest(value),
40350                            _ => common::Error::Failure(response),
40351                        });
40352                    }
40353                    let response = {
40354                        let bytes = common::to_bytes(body).await.unwrap_or_default();
40355                        let encoded = common::to_string(&bytes);
40356                        match serde_json::from_str(&encoded) {
40357                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
40358                            Err(error) => {
40359                                dlg.response_json_decode_error(&encoded, &error);
40360                                return Err(common::Error::JsonDecodeError(
40361                                    encoded.to_string(),
40362                                    error,
40363                                ));
40364                            }
40365                        }
40366                    };
40367
40368                    dlg.finished(true);
40369                    return Ok(response);
40370                }
40371            }
40372        }
40373    }
40374
40375    ///
40376    /// Sets the *request* property to the given value.
40377    ///
40378    /// Even though the property as already been set when instantiating this call,
40379    /// we provide this method for API completeness.
40380    pub fn request(mut self, new_value: CreativeGroup) -> CreativeGroupUpdateCall<'a, C> {
40381        self._request = new_value;
40382        self
40383    }
40384    /// User profile ID associated with this request.
40385    ///
40386    /// Sets the *profile id* path property to the given value.
40387    ///
40388    /// Even though the property as already been set when instantiating this call,
40389    /// we provide this method for API completeness.
40390    pub fn profile_id(mut self, new_value: i64) -> CreativeGroupUpdateCall<'a, C> {
40391        self._profile_id = new_value;
40392        self
40393    }
40394    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
40395    /// while executing the actual API request.
40396    ///
40397    /// ````text
40398    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
40399    /// ````
40400    ///
40401    /// Sets the *delegate* property to the given value.
40402    pub fn delegate(
40403        mut self,
40404        new_value: &'a mut dyn common::Delegate,
40405    ) -> CreativeGroupUpdateCall<'a, C> {
40406        self._delegate = Some(new_value);
40407        self
40408    }
40409
40410    /// Set any additional parameter of the query string used in the request.
40411    /// It should be used to set parameters which are not yet available through their own
40412    /// setters.
40413    ///
40414    /// Please note that this method must not be used to set any of the known parameters
40415    /// which have their own setter method. If done anyway, the request will fail.
40416    ///
40417    /// # Additional Parameters
40418    ///
40419    /// * *$.xgafv* (query-string) - V1 error format.
40420    /// * *access_token* (query-string) - OAuth access token.
40421    /// * *alt* (query-string) - Data format for response.
40422    /// * *callback* (query-string) - JSONP
40423    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
40424    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
40425    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
40426    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
40427    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
40428    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
40429    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
40430    pub fn param<T>(mut self, name: T, value: T) -> CreativeGroupUpdateCall<'a, C>
40431    where
40432        T: AsRef<str>,
40433    {
40434        self._additional_params
40435            .insert(name.as_ref().to_string(), value.as_ref().to_string());
40436        self
40437    }
40438
40439    /// Identifies the authorization scope for the method you are building.
40440    ///
40441    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
40442    /// [`Scope::Dfatrafficking`].
40443    ///
40444    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
40445    /// tokens for more than one scope.
40446    ///
40447    /// Usually there is more than one suitable scope to authorize an operation, some of which may
40448    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
40449    /// sufficient, a read-write scope will do as well.
40450    pub fn add_scope<St>(mut self, scope: St) -> CreativeGroupUpdateCall<'a, C>
40451    where
40452        St: AsRef<str>,
40453    {
40454        self._scopes.insert(String::from(scope.as_ref()));
40455        self
40456    }
40457    /// Identifies the authorization scope(s) for the method you are building.
40458    ///
40459    /// See [`Self::add_scope()`] for details.
40460    pub fn add_scopes<I, St>(mut self, scopes: I) -> CreativeGroupUpdateCall<'a, C>
40461    where
40462        I: IntoIterator<Item = St>,
40463        St: AsRef<str>,
40464    {
40465        self._scopes
40466            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
40467        self
40468    }
40469
40470    /// Removes all scopes, and no default scope will be used either.
40471    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
40472    /// for details).
40473    pub fn clear_scopes(mut self) -> CreativeGroupUpdateCall<'a, C> {
40474        self._scopes.clear();
40475        self
40476    }
40477}
40478
40479/// Gets one creative by ID.
40480///
40481/// A builder for the *get* method supported by a *creative* resource.
40482/// It is not used directly, but through a [`CreativeMethods`] instance.
40483///
40484/// # Example
40485///
40486/// Instantiate a resource method builder
40487///
40488/// ```test_harness,no_run
40489/// # extern crate hyper;
40490/// # extern crate hyper_rustls;
40491/// # extern crate google_dfareporting3d3 as dfareporting3d3;
40492/// # async fn dox() {
40493/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
40494///
40495/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
40496/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
40497/// #     secret,
40498/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
40499/// # ).build().await.unwrap();
40500///
40501/// # let client = hyper_util::client::legacy::Client::builder(
40502/// #     hyper_util::rt::TokioExecutor::new()
40503/// # )
40504/// # .build(
40505/// #     hyper_rustls::HttpsConnectorBuilder::new()
40506/// #         .with_native_roots()
40507/// #         .unwrap()
40508/// #         .https_or_http()
40509/// #         .enable_http1()
40510/// #         .build()
40511/// # );
40512/// # let mut hub = Dfareporting::new(client, auth);
40513/// // You can configure optional parameters by calling the respective setters at will, and
40514/// // execute the final call using `doit()`.
40515/// // Values shown here are possibly random and not representative !
40516/// let result = hub.creatives().get(-79, -77)
40517///              .doit().await;
40518/// # }
40519/// ```
40520pub struct CreativeGetCall<'a, C>
40521where
40522    C: 'a,
40523{
40524    hub: &'a Dfareporting<C>,
40525    _profile_id: i64,
40526    _id: i64,
40527    _delegate: Option<&'a mut dyn common::Delegate>,
40528    _additional_params: HashMap<String, String>,
40529    _scopes: BTreeSet<String>,
40530}
40531
40532impl<'a, C> common::CallBuilder for CreativeGetCall<'a, C> {}
40533
40534impl<'a, C> CreativeGetCall<'a, C>
40535where
40536    C: common::Connector,
40537{
40538    /// Perform the operation you have build so far.
40539    pub async fn doit(mut self) -> common::Result<(common::Response, Creative)> {
40540        use std::borrow::Cow;
40541        use std::io::{Read, Seek};
40542
40543        use common::{url::Params, ToParts};
40544        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
40545
40546        let mut dd = common::DefaultDelegate;
40547        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
40548        dlg.begin(common::MethodInfo {
40549            id: "dfareporting.creatives.get",
40550            http_method: hyper::Method::GET,
40551        });
40552
40553        for &field in ["alt", "profileId", "id"].iter() {
40554            if self._additional_params.contains_key(field) {
40555                dlg.finished(false);
40556                return Err(common::Error::FieldClash(field));
40557            }
40558        }
40559
40560        let mut params = Params::with_capacity(4 + self._additional_params.len());
40561        params.push("profileId", self._profile_id.to_string());
40562        params.push("id", self._id.to_string());
40563
40564        params.extend(self._additional_params.iter());
40565
40566        params.push("alt", "json");
40567        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creatives/{id}";
40568        if self._scopes.is_empty() {
40569            self._scopes
40570                .insert(Scope::Dfatrafficking.as_ref().to_string());
40571        }
40572
40573        #[allow(clippy::single_element_loop)]
40574        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
40575            url = params.uri_replacement(url, param_name, find_this, false);
40576        }
40577        {
40578            let to_remove = ["id", "profileId"];
40579            params.remove_params(&to_remove);
40580        }
40581
40582        let url = params.parse_with_url(&url);
40583
40584        loop {
40585            let token = match self
40586                .hub
40587                .auth
40588                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
40589                .await
40590            {
40591                Ok(token) => token,
40592                Err(e) => match dlg.token(e) {
40593                    Ok(token) => token,
40594                    Err(e) => {
40595                        dlg.finished(false);
40596                        return Err(common::Error::MissingToken(e));
40597                    }
40598                },
40599            };
40600            let mut req_result = {
40601                let client = &self.hub.client;
40602                dlg.pre_request();
40603                let mut req_builder = hyper::Request::builder()
40604                    .method(hyper::Method::GET)
40605                    .uri(url.as_str())
40606                    .header(USER_AGENT, self.hub._user_agent.clone());
40607
40608                if let Some(token) = token.as_ref() {
40609                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
40610                }
40611
40612                let request = req_builder
40613                    .header(CONTENT_LENGTH, 0_u64)
40614                    .body(common::to_body::<String>(None));
40615
40616                client.request(request.unwrap()).await
40617            };
40618
40619            match req_result {
40620                Err(err) => {
40621                    if let common::Retry::After(d) = dlg.http_error(&err) {
40622                        sleep(d).await;
40623                        continue;
40624                    }
40625                    dlg.finished(false);
40626                    return Err(common::Error::HttpError(err));
40627                }
40628                Ok(res) => {
40629                    let (mut parts, body) = res.into_parts();
40630                    let mut body = common::Body::new(body);
40631                    if !parts.status.is_success() {
40632                        let bytes = common::to_bytes(body).await.unwrap_or_default();
40633                        let error = serde_json::from_str(&common::to_string(&bytes));
40634                        let response = common::to_response(parts, bytes.into());
40635
40636                        if let common::Retry::After(d) =
40637                            dlg.http_failure(&response, error.as_ref().ok())
40638                        {
40639                            sleep(d).await;
40640                            continue;
40641                        }
40642
40643                        dlg.finished(false);
40644
40645                        return Err(match error {
40646                            Ok(value) => common::Error::BadRequest(value),
40647                            _ => common::Error::Failure(response),
40648                        });
40649                    }
40650                    let response = {
40651                        let bytes = common::to_bytes(body).await.unwrap_or_default();
40652                        let encoded = common::to_string(&bytes);
40653                        match serde_json::from_str(&encoded) {
40654                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
40655                            Err(error) => {
40656                                dlg.response_json_decode_error(&encoded, &error);
40657                                return Err(common::Error::JsonDecodeError(
40658                                    encoded.to_string(),
40659                                    error,
40660                                ));
40661                            }
40662                        }
40663                    };
40664
40665                    dlg.finished(true);
40666                    return Ok(response);
40667                }
40668            }
40669        }
40670    }
40671
40672    /// User profile ID associated with this request.
40673    ///
40674    /// Sets the *profile id* path property to the given value.
40675    ///
40676    /// Even though the property as already been set when instantiating this call,
40677    /// we provide this method for API completeness.
40678    pub fn profile_id(mut self, new_value: i64) -> CreativeGetCall<'a, C> {
40679        self._profile_id = new_value;
40680        self
40681    }
40682    /// Creative ID.
40683    ///
40684    /// Sets the *id* path property to the given value.
40685    ///
40686    /// Even though the property as already been set when instantiating this call,
40687    /// we provide this method for API completeness.
40688    pub fn id(mut self, new_value: i64) -> CreativeGetCall<'a, C> {
40689        self._id = new_value;
40690        self
40691    }
40692    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
40693    /// while executing the actual API request.
40694    ///
40695    /// ````text
40696    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
40697    /// ````
40698    ///
40699    /// Sets the *delegate* property to the given value.
40700    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> CreativeGetCall<'a, C> {
40701        self._delegate = Some(new_value);
40702        self
40703    }
40704
40705    /// Set any additional parameter of the query string used in the request.
40706    /// It should be used to set parameters which are not yet available through their own
40707    /// setters.
40708    ///
40709    /// Please note that this method must not be used to set any of the known parameters
40710    /// which have their own setter method. If done anyway, the request will fail.
40711    ///
40712    /// # Additional Parameters
40713    ///
40714    /// * *$.xgafv* (query-string) - V1 error format.
40715    /// * *access_token* (query-string) - OAuth access token.
40716    /// * *alt* (query-string) - Data format for response.
40717    /// * *callback* (query-string) - JSONP
40718    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
40719    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
40720    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
40721    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
40722    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
40723    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
40724    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
40725    pub fn param<T>(mut self, name: T, value: T) -> CreativeGetCall<'a, C>
40726    where
40727        T: AsRef<str>,
40728    {
40729        self._additional_params
40730            .insert(name.as_ref().to_string(), value.as_ref().to_string());
40731        self
40732    }
40733
40734    /// Identifies the authorization scope for the method you are building.
40735    ///
40736    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
40737    /// [`Scope::Dfatrafficking`].
40738    ///
40739    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
40740    /// tokens for more than one scope.
40741    ///
40742    /// Usually there is more than one suitable scope to authorize an operation, some of which may
40743    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
40744    /// sufficient, a read-write scope will do as well.
40745    pub fn add_scope<St>(mut self, scope: St) -> CreativeGetCall<'a, C>
40746    where
40747        St: AsRef<str>,
40748    {
40749        self._scopes.insert(String::from(scope.as_ref()));
40750        self
40751    }
40752    /// Identifies the authorization scope(s) for the method you are building.
40753    ///
40754    /// See [`Self::add_scope()`] for details.
40755    pub fn add_scopes<I, St>(mut self, scopes: I) -> CreativeGetCall<'a, C>
40756    where
40757        I: IntoIterator<Item = St>,
40758        St: AsRef<str>,
40759    {
40760        self._scopes
40761            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
40762        self
40763    }
40764
40765    /// Removes all scopes, and no default scope will be used either.
40766    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
40767    /// for details).
40768    pub fn clear_scopes(mut self) -> CreativeGetCall<'a, C> {
40769        self._scopes.clear();
40770        self
40771    }
40772}
40773
40774/// Inserts a new creative.
40775///
40776/// A builder for the *insert* method supported by a *creative* resource.
40777/// It is not used directly, but through a [`CreativeMethods`] instance.
40778///
40779/// # Example
40780///
40781/// Instantiate a resource method builder
40782///
40783/// ```test_harness,no_run
40784/// # extern crate hyper;
40785/// # extern crate hyper_rustls;
40786/// # extern crate google_dfareporting3d3 as dfareporting3d3;
40787/// use dfareporting3d3::api::Creative;
40788/// # async fn dox() {
40789/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
40790///
40791/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
40792/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
40793/// #     secret,
40794/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
40795/// # ).build().await.unwrap();
40796///
40797/// # let client = hyper_util::client::legacy::Client::builder(
40798/// #     hyper_util::rt::TokioExecutor::new()
40799/// # )
40800/// # .build(
40801/// #     hyper_rustls::HttpsConnectorBuilder::new()
40802/// #         .with_native_roots()
40803/// #         .unwrap()
40804/// #         .https_or_http()
40805/// #         .enable_http1()
40806/// #         .build()
40807/// # );
40808/// # let mut hub = Dfareporting::new(client, auth);
40809/// // As the method needs a request, you would usually fill it with the desired information
40810/// // into the respective structure. Some of the parts shown here might not be applicable !
40811/// // Values shown here are possibly random and not representative !
40812/// let mut req = Creative::default();
40813///
40814/// // You can configure optional parameters by calling the respective setters at will, and
40815/// // execute the final call using `doit()`.
40816/// // Values shown here are possibly random and not representative !
40817/// let result = hub.creatives().insert(req, -81)
40818///              .doit().await;
40819/// # }
40820/// ```
40821pub struct CreativeInsertCall<'a, C>
40822where
40823    C: 'a,
40824{
40825    hub: &'a Dfareporting<C>,
40826    _request: Creative,
40827    _profile_id: i64,
40828    _delegate: Option<&'a mut dyn common::Delegate>,
40829    _additional_params: HashMap<String, String>,
40830    _scopes: BTreeSet<String>,
40831}
40832
40833impl<'a, C> common::CallBuilder for CreativeInsertCall<'a, C> {}
40834
40835impl<'a, C> CreativeInsertCall<'a, C>
40836where
40837    C: common::Connector,
40838{
40839    /// Perform the operation you have build so far.
40840    pub async fn doit(mut self) -> common::Result<(common::Response, Creative)> {
40841        use std::borrow::Cow;
40842        use std::io::{Read, Seek};
40843
40844        use common::{url::Params, ToParts};
40845        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
40846
40847        let mut dd = common::DefaultDelegate;
40848        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
40849        dlg.begin(common::MethodInfo {
40850            id: "dfareporting.creatives.insert",
40851            http_method: hyper::Method::POST,
40852        });
40853
40854        for &field in ["alt", "profileId"].iter() {
40855            if self._additional_params.contains_key(field) {
40856                dlg.finished(false);
40857                return Err(common::Error::FieldClash(field));
40858            }
40859        }
40860
40861        let mut params = Params::with_capacity(4 + self._additional_params.len());
40862        params.push("profileId", self._profile_id.to_string());
40863
40864        params.extend(self._additional_params.iter());
40865
40866        params.push("alt", "json");
40867        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creatives";
40868        if self._scopes.is_empty() {
40869            self._scopes
40870                .insert(Scope::Dfatrafficking.as_ref().to_string());
40871        }
40872
40873        #[allow(clippy::single_element_loop)]
40874        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
40875            url = params.uri_replacement(url, param_name, find_this, false);
40876        }
40877        {
40878            let to_remove = ["profileId"];
40879            params.remove_params(&to_remove);
40880        }
40881
40882        let url = params.parse_with_url(&url);
40883
40884        let mut json_mime_type = mime::APPLICATION_JSON;
40885        let mut request_value_reader = {
40886            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
40887            common::remove_json_null_values(&mut value);
40888            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
40889            serde_json::to_writer(&mut dst, &value).unwrap();
40890            dst
40891        };
40892        let request_size = request_value_reader
40893            .seek(std::io::SeekFrom::End(0))
40894            .unwrap();
40895        request_value_reader
40896            .seek(std::io::SeekFrom::Start(0))
40897            .unwrap();
40898
40899        loop {
40900            let token = match self
40901                .hub
40902                .auth
40903                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
40904                .await
40905            {
40906                Ok(token) => token,
40907                Err(e) => match dlg.token(e) {
40908                    Ok(token) => token,
40909                    Err(e) => {
40910                        dlg.finished(false);
40911                        return Err(common::Error::MissingToken(e));
40912                    }
40913                },
40914            };
40915            request_value_reader
40916                .seek(std::io::SeekFrom::Start(0))
40917                .unwrap();
40918            let mut req_result = {
40919                let client = &self.hub.client;
40920                dlg.pre_request();
40921                let mut req_builder = hyper::Request::builder()
40922                    .method(hyper::Method::POST)
40923                    .uri(url.as_str())
40924                    .header(USER_AGENT, self.hub._user_agent.clone());
40925
40926                if let Some(token) = token.as_ref() {
40927                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
40928                }
40929
40930                let request = req_builder
40931                    .header(CONTENT_TYPE, json_mime_type.to_string())
40932                    .header(CONTENT_LENGTH, request_size as u64)
40933                    .body(common::to_body(
40934                        request_value_reader.get_ref().clone().into(),
40935                    ));
40936
40937                client.request(request.unwrap()).await
40938            };
40939
40940            match req_result {
40941                Err(err) => {
40942                    if let common::Retry::After(d) = dlg.http_error(&err) {
40943                        sleep(d).await;
40944                        continue;
40945                    }
40946                    dlg.finished(false);
40947                    return Err(common::Error::HttpError(err));
40948                }
40949                Ok(res) => {
40950                    let (mut parts, body) = res.into_parts();
40951                    let mut body = common::Body::new(body);
40952                    if !parts.status.is_success() {
40953                        let bytes = common::to_bytes(body).await.unwrap_or_default();
40954                        let error = serde_json::from_str(&common::to_string(&bytes));
40955                        let response = common::to_response(parts, bytes.into());
40956
40957                        if let common::Retry::After(d) =
40958                            dlg.http_failure(&response, error.as_ref().ok())
40959                        {
40960                            sleep(d).await;
40961                            continue;
40962                        }
40963
40964                        dlg.finished(false);
40965
40966                        return Err(match error {
40967                            Ok(value) => common::Error::BadRequest(value),
40968                            _ => common::Error::Failure(response),
40969                        });
40970                    }
40971                    let response = {
40972                        let bytes = common::to_bytes(body).await.unwrap_or_default();
40973                        let encoded = common::to_string(&bytes);
40974                        match serde_json::from_str(&encoded) {
40975                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
40976                            Err(error) => {
40977                                dlg.response_json_decode_error(&encoded, &error);
40978                                return Err(common::Error::JsonDecodeError(
40979                                    encoded.to_string(),
40980                                    error,
40981                                ));
40982                            }
40983                        }
40984                    };
40985
40986                    dlg.finished(true);
40987                    return Ok(response);
40988                }
40989            }
40990        }
40991    }
40992
40993    ///
40994    /// Sets the *request* property to the given value.
40995    ///
40996    /// Even though the property as already been set when instantiating this call,
40997    /// we provide this method for API completeness.
40998    pub fn request(mut self, new_value: Creative) -> CreativeInsertCall<'a, C> {
40999        self._request = new_value;
41000        self
41001    }
41002    /// User profile ID associated with this request.
41003    ///
41004    /// Sets the *profile id* path property to the given value.
41005    ///
41006    /// Even though the property as already been set when instantiating this call,
41007    /// we provide this method for API completeness.
41008    pub fn profile_id(mut self, new_value: i64) -> CreativeInsertCall<'a, C> {
41009        self._profile_id = new_value;
41010        self
41011    }
41012    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
41013    /// while executing the actual API request.
41014    ///
41015    /// ````text
41016    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
41017    /// ````
41018    ///
41019    /// Sets the *delegate* property to the given value.
41020    pub fn delegate(
41021        mut self,
41022        new_value: &'a mut dyn common::Delegate,
41023    ) -> CreativeInsertCall<'a, C> {
41024        self._delegate = Some(new_value);
41025        self
41026    }
41027
41028    /// Set any additional parameter of the query string used in the request.
41029    /// It should be used to set parameters which are not yet available through their own
41030    /// setters.
41031    ///
41032    /// Please note that this method must not be used to set any of the known parameters
41033    /// which have their own setter method. If done anyway, the request will fail.
41034    ///
41035    /// # Additional Parameters
41036    ///
41037    /// * *$.xgafv* (query-string) - V1 error format.
41038    /// * *access_token* (query-string) - OAuth access token.
41039    /// * *alt* (query-string) - Data format for response.
41040    /// * *callback* (query-string) - JSONP
41041    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
41042    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
41043    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
41044    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
41045    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
41046    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
41047    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
41048    pub fn param<T>(mut self, name: T, value: T) -> CreativeInsertCall<'a, C>
41049    where
41050        T: AsRef<str>,
41051    {
41052        self._additional_params
41053            .insert(name.as_ref().to_string(), value.as_ref().to_string());
41054        self
41055    }
41056
41057    /// Identifies the authorization scope for the method you are building.
41058    ///
41059    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
41060    /// [`Scope::Dfatrafficking`].
41061    ///
41062    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
41063    /// tokens for more than one scope.
41064    ///
41065    /// Usually there is more than one suitable scope to authorize an operation, some of which may
41066    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
41067    /// sufficient, a read-write scope will do as well.
41068    pub fn add_scope<St>(mut self, scope: St) -> CreativeInsertCall<'a, C>
41069    where
41070        St: AsRef<str>,
41071    {
41072        self._scopes.insert(String::from(scope.as_ref()));
41073        self
41074    }
41075    /// Identifies the authorization scope(s) for the method you are building.
41076    ///
41077    /// See [`Self::add_scope()`] for details.
41078    pub fn add_scopes<I, St>(mut self, scopes: I) -> CreativeInsertCall<'a, C>
41079    where
41080        I: IntoIterator<Item = St>,
41081        St: AsRef<str>,
41082    {
41083        self._scopes
41084            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
41085        self
41086    }
41087
41088    /// Removes all scopes, and no default scope will be used either.
41089    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
41090    /// for details).
41091    pub fn clear_scopes(mut self) -> CreativeInsertCall<'a, C> {
41092        self._scopes.clear();
41093        self
41094    }
41095}
41096
41097/// Retrieves a list of creatives, possibly filtered. This method supports paging.
41098///
41099/// A builder for the *list* method supported by a *creative* resource.
41100/// It is not used directly, but through a [`CreativeMethods`] instance.
41101///
41102/// # Example
41103///
41104/// Instantiate a resource method builder
41105///
41106/// ```test_harness,no_run
41107/// # extern crate hyper;
41108/// # extern crate hyper_rustls;
41109/// # extern crate google_dfareporting3d3 as dfareporting3d3;
41110/// # async fn dox() {
41111/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
41112///
41113/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
41114/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
41115/// #     secret,
41116/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
41117/// # ).build().await.unwrap();
41118///
41119/// # let client = hyper_util::client::legacy::Client::builder(
41120/// #     hyper_util::rt::TokioExecutor::new()
41121/// # )
41122/// # .build(
41123/// #     hyper_rustls::HttpsConnectorBuilder::new()
41124/// #         .with_native_roots()
41125/// #         .unwrap()
41126/// #         .https_or_http()
41127/// #         .enable_http1()
41128/// #         .build()
41129/// # );
41130/// # let mut hub = Dfareporting::new(client, auth);
41131/// // You can configure optional parameters by calling the respective setters at will, and
41132/// // execute the final call using `doit()`.
41133/// // Values shown here are possibly random and not representative !
41134/// let result = hub.creatives().list(-71)
41135///              .add_types("ipsum")
41136///              .studio_creative_id(-73)
41137///              .sort_order("dolores")
41138///              .sort_field("consetetur")
41139///              .add_size_ids(-11)
41140///              .search_string("justo")
41141///              .add_rendering_ids(-45)
41142///              .page_token("diam")
41143///              .max_results(-10)
41144///              .add_ids(-50)
41145///              .add_creative_field_ids(-15)
41146///              .add_companion_creative_ids(-62)
41147///              .campaign_id(-5)
41148///              .archived(true)
41149///              .advertiser_id(-98)
41150///              .active(true)
41151///              .doit().await;
41152/// # }
41153/// ```
41154pub struct CreativeListCall<'a, C>
41155where
41156    C: 'a,
41157{
41158    hub: &'a Dfareporting<C>,
41159    _profile_id: i64,
41160    _types: Vec<String>,
41161    _studio_creative_id: Option<i64>,
41162    _sort_order: Option<String>,
41163    _sort_field: Option<String>,
41164    _size_ids: Vec<i64>,
41165    _search_string: Option<String>,
41166    _rendering_ids: Vec<i64>,
41167    _page_token: Option<String>,
41168    _max_results: Option<i32>,
41169    _ids: Vec<i64>,
41170    _creative_field_ids: Vec<i64>,
41171    _companion_creative_ids: Vec<i64>,
41172    _campaign_id: Option<i64>,
41173    _archived: Option<bool>,
41174    _advertiser_id: Option<i64>,
41175    _active: Option<bool>,
41176    _delegate: Option<&'a mut dyn common::Delegate>,
41177    _additional_params: HashMap<String, String>,
41178    _scopes: BTreeSet<String>,
41179}
41180
41181impl<'a, C> common::CallBuilder for CreativeListCall<'a, C> {}
41182
41183impl<'a, C> CreativeListCall<'a, C>
41184where
41185    C: common::Connector,
41186{
41187    /// Perform the operation you have build so far.
41188    pub async fn doit(mut self) -> common::Result<(common::Response, CreativesListResponse)> {
41189        use std::borrow::Cow;
41190        use std::io::{Read, Seek};
41191
41192        use common::{url::Params, ToParts};
41193        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
41194
41195        let mut dd = common::DefaultDelegate;
41196        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
41197        dlg.begin(common::MethodInfo {
41198            id: "dfareporting.creatives.list",
41199            http_method: hyper::Method::GET,
41200        });
41201
41202        for &field in [
41203            "alt",
41204            "profileId",
41205            "types",
41206            "studioCreativeId",
41207            "sortOrder",
41208            "sortField",
41209            "sizeIds",
41210            "searchString",
41211            "renderingIds",
41212            "pageToken",
41213            "maxResults",
41214            "ids",
41215            "creativeFieldIds",
41216            "companionCreativeIds",
41217            "campaignId",
41218            "archived",
41219            "advertiserId",
41220            "active",
41221        ]
41222        .iter()
41223        {
41224            if self._additional_params.contains_key(field) {
41225                dlg.finished(false);
41226                return Err(common::Error::FieldClash(field));
41227            }
41228        }
41229
41230        let mut params = Params::with_capacity(19 + self._additional_params.len());
41231        params.push("profileId", self._profile_id.to_string());
41232        if !self._types.is_empty() {
41233            for f in self._types.iter() {
41234                params.push("types", f);
41235            }
41236        }
41237        if let Some(value) = self._studio_creative_id.as_ref() {
41238            params.push("studioCreativeId", value.to_string());
41239        }
41240        if let Some(value) = self._sort_order.as_ref() {
41241            params.push("sortOrder", value);
41242        }
41243        if let Some(value) = self._sort_field.as_ref() {
41244            params.push("sortField", value);
41245        }
41246        if !self._size_ids.is_empty() {
41247            for f in self._size_ids.iter() {
41248                params.push("sizeIds", f.to_string());
41249            }
41250        }
41251        if let Some(value) = self._search_string.as_ref() {
41252            params.push("searchString", value);
41253        }
41254        if !self._rendering_ids.is_empty() {
41255            for f in self._rendering_ids.iter() {
41256                params.push("renderingIds", f.to_string());
41257            }
41258        }
41259        if let Some(value) = self._page_token.as_ref() {
41260            params.push("pageToken", value);
41261        }
41262        if let Some(value) = self._max_results.as_ref() {
41263            params.push("maxResults", value.to_string());
41264        }
41265        if !self._ids.is_empty() {
41266            for f in self._ids.iter() {
41267                params.push("ids", f.to_string());
41268            }
41269        }
41270        if !self._creative_field_ids.is_empty() {
41271            for f in self._creative_field_ids.iter() {
41272                params.push("creativeFieldIds", f.to_string());
41273            }
41274        }
41275        if !self._companion_creative_ids.is_empty() {
41276            for f in self._companion_creative_ids.iter() {
41277                params.push("companionCreativeIds", f.to_string());
41278            }
41279        }
41280        if let Some(value) = self._campaign_id.as_ref() {
41281            params.push("campaignId", value.to_string());
41282        }
41283        if let Some(value) = self._archived.as_ref() {
41284            params.push("archived", value.to_string());
41285        }
41286        if let Some(value) = self._advertiser_id.as_ref() {
41287            params.push("advertiserId", value.to_string());
41288        }
41289        if let Some(value) = self._active.as_ref() {
41290            params.push("active", value.to_string());
41291        }
41292
41293        params.extend(self._additional_params.iter());
41294
41295        params.push("alt", "json");
41296        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creatives";
41297        if self._scopes.is_empty() {
41298            self._scopes
41299                .insert(Scope::Dfatrafficking.as_ref().to_string());
41300        }
41301
41302        #[allow(clippy::single_element_loop)]
41303        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
41304            url = params.uri_replacement(url, param_name, find_this, false);
41305        }
41306        {
41307            let to_remove = ["profileId"];
41308            params.remove_params(&to_remove);
41309        }
41310
41311        let url = params.parse_with_url(&url);
41312
41313        loop {
41314            let token = match self
41315                .hub
41316                .auth
41317                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
41318                .await
41319            {
41320                Ok(token) => token,
41321                Err(e) => match dlg.token(e) {
41322                    Ok(token) => token,
41323                    Err(e) => {
41324                        dlg.finished(false);
41325                        return Err(common::Error::MissingToken(e));
41326                    }
41327                },
41328            };
41329            let mut req_result = {
41330                let client = &self.hub.client;
41331                dlg.pre_request();
41332                let mut req_builder = hyper::Request::builder()
41333                    .method(hyper::Method::GET)
41334                    .uri(url.as_str())
41335                    .header(USER_AGENT, self.hub._user_agent.clone());
41336
41337                if let Some(token) = token.as_ref() {
41338                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
41339                }
41340
41341                let request = req_builder
41342                    .header(CONTENT_LENGTH, 0_u64)
41343                    .body(common::to_body::<String>(None));
41344
41345                client.request(request.unwrap()).await
41346            };
41347
41348            match req_result {
41349                Err(err) => {
41350                    if let common::Retry::After(d) = dlg.http_error(&err) {
41351                        sleep(d).await;
41352                        continue;
41353                    }
41354                    dlg.finished(false);
41355                    return Err(common::Error::HttpError(err));
41356                }
41357                Ok(res) => {
41358                    let (mut parts, body) = res.into_parts();
41359                    let mut body = common::Body::new(body);
41360                    if !parts.status.is_success() {
41361                        let bytes = common::to_bytes(body).await.unwrap_or_default();
41362                        let error = serde_json::from_str(&common::to_string(&bytes));
41363                        let response = common::to_response(parts, bytes.into());
41364
41365                        if let common::Retry::After(d) =
41366                            dlg.http_failure(&response, error.as_ref().ok())
41367                        {
41368                            sleep(d).await;
41369                            continue;
41370                        }
41371
41372                        dlg.finished(false);
41373
41374                        return Err(match error {
41375                            Ok(value) => common::Error::BadRequest(value),
41376                            _ => common::Error::Failure(response),
41377                        });
41378                    }
41379                    let response = {
41380                        let bytes = common::to_bytes(body).await.unwrap_or_default();
41381                        let encoded = common::to_string(&bytes);
41382                        match serde_json::from_str(&encoded) {
41383                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
41384                            Err(error) => {
41385                                dlg.response_json_decode_error(&encoded, &error);
41386                                return Err(common::Error::JsonDecodeError(
41387                                    encoded.to_string(),
41388                                    error,
41389                                ));
41390                            }
41391                        }
41392                    };
41393
41394                    dlg.finished(true);
41395                    return Ok(response);
41396                }
41397            }
41398        }
41399    }
41400
41401    /// User profile ID associated with this request.
41402    ///
41403    /// Sets the *profile id* path property to the given value.
41404    ///
41405    /// Even though the property as already been set when instantiating this call,
41406    /// we provide this method for API completeness.
41407    pub fn profile_id(mut self, new_value: i64) -> CreativeListCall<'a, C> {
41408        self._profile_id = new_value;
41409        self
41410    }
41411    /// Select only creatives with these creative types.
41412    ///
41413    /// Append the given value to the *types* query property.
41414    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
41415    pub fn add_types(mut self, new_value: &str) -> CreativeListCall<'a, C> {
41416        self._types.push(new_value.to_string());
41417        self
41418    }
41419    /// Select only creatives corresponding to this Studio creative ID.
41420    ///
41421    /// Sets the *studio creative id* query property to the given value.
41422    pub fn studio_creative_id(mut self, new_value: i64) -> CreativeListCall<'a, C> {
41423        self._studio_creative_id = Some(new_value);
41424        self
41425    }
41426    /// Order of sorted results.
41427    ///
41428    /// Sets the *sort order* query property to the given value.
41429    pub fn sort_order(mut self, new_value: &str) -> CreativeListCall<'a, C> {
41430        self._sort_order = Some(new_value.to_string());
41431        self
41432    }
41433    /// Field by which to sort the list.
41434    ///
41435    /// Sets the *sort field* query property to the given value.
41436    pub fn sort_field(mut self, new_value: &str) -> CreativeListCall<'a, C> {
41437        self._sort_field = Some(new_value.to_string());
41438        self
41439    }
41440    /// Select only creatives with these size IDs.
41441    ///
41442    /// Append the given value to the *size ids* query property.
41443    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
41444    pub fn add_size_ids(mut self, new_value: i64) -> CreativeListCall<'a, C> {
41445        self._size_ids.push(new_value);
41446        self
41447    }
41448    /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "creative*2015" will return objects with names like "creative June 2015", "creative April 2015", or simply "creative 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "creative" will match objects with name "my creative", "creative 2015", or simply "creative".
41449    ///
41450    /// Sets the *search string* query property to the given value.
41451    pub fn search_string(mut self, new_value: &str) -> CreativeListCall<'a, C> {
41452        self._search_string = Some(new_value.to_string());
41453        self
41454    }
41455    /// Select only creatives with these rendering IDs.
41456    ///
41457    /// Append the given value to the *rendering ids* query property.
41458    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
41459    pub fn add_rendering_ids(mut self, new_value: i64) -> CreativeListCall<'a, C> {
41460        self._rendering_ids.push(new_value);
41461        self
41462    }
41463    /// Value of the nextPageToken from the previous result page.
41464    ///
41465    /// Sets the *page token* query property to the given value.
41466    pub fn page_token(mut self, new_value: &str) -> CreativeListCall<'a, C> {
41467        self._page_token = Some(new_value.to_string());
41468        self
41469    }
41470    /// Maximum number of results to return.
41471    ///
41472    /// Sets the *max results* query property to the given value.
41473    pub fn max_results(mut self, new_value: i32) -> CreativeListCall<'a, C> {
41474        self._max_results = Some(new_value);
41475        self
41476    }
41477    /// Select only creatives with these IDs.
41478    ///
41479    /// Append the given value to the *ids* query property.
41480    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
41481    pub fn add_ids(mut self, new_value: i64) -> CreativeListCall<'a, C> {
41482        self._ids.push(new_value);
41483        self
41484    }
41485    /// Select only creatives with these creative field IDs.
41486    ///
41487    /// Append the given value to the *creative field ids* query property.
41488    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
41489    pub fn add_creative_field_ids(mut self, new_value: i64) -> CreativeListCall<'a, C> {
41490        self._creative_field_ids.push(new_value);
41491        self
41492    }
41493    /// Select only in-stream video creatives with these companion IDs.
41494    ///
41495    /// Append the given value to the *companion creative ids* query property.
41496    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
41497    pub fn add_companion_creative_ids(mut self, new_value: i64) -> CreativeListCall<'a, C> {
41498        self._companion_creative_ids.push(new_value);
41499        self
41500    }
41501    /// Select only creatives with this campaign ID.
41502    ///
41503    /// Sets the *campaign id* query property to the given value.
41504    pub fn campaign_id(mut self, new_value: i64) -> CreativeListCall<'a, C> {
41505        self._campaign_id = Some(new_value);
41506        self
41507    }
41508    /// Select only archived creatives. Leave blank to select archived and unarchived creatives.
41509    ///
41510    /// Sets the *archived* query property to the given value.
41511    pub fn archived(mut self, new_value: bool) -> CreativeListCall<'a, C> {
41512        self._archived = Some(new_value);
41513        self
41514    }
41515    /// Select only creatives with this advertiser ID.
41516    ///
41517    /// Sets the *advertiser id* query property to the given value.
41518    pub fn advertiser_id(mut self, new_value: i64) -> CreativeListCall<'a, C> {
41519        self._advertiser_id = Some(new_value);
41520        self
41521    }
41522    /// Select only active creatives. Leave blank to select active and inactive creatives.
41523    ///
41524    /// Sets the *active* query property to the given value.
41525    pub fn active(mut self, new_value: bool) -> CreativeListCall<'a, C> {
41526        self._active = Some(new_value);
41527        self
41528    }
41529    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
41530    /// while executing the actual API request.
41531    ///
41532    /// ````text
41533    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
41534    /// ````
41535    ///
41536    /// Sets the *delegate* property to the given value.
41537    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> CreativeListCall<'a, C> {
41538        self._delegate = Some(new_value);
41539        self
41540    }
41541
41542    /// Set any additional parameter of the query string used in the request.
41543    /// It should be used to set parameters which are not yet available through their own
41544    /// setters.
41545    ///
41546    /// Please note that this method must not be used to set any of the known parameters
41547    /// which have their own setter method. If done anyway, the request will fail.
41548    ///
41549    /// # Additional Parameters
41550    ///
41551    /// * *$.xgafv* (query-string) - V1 error format.
41552    /// * *access_token* (query-string) - OAuth access token.
41553    /// * *alt* (query-string) - Data format for response.
41554    /// * *callback* (query-string) - JSONP
41555    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
41556    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
41557    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
41558    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
41559    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
41560    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
41561    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
41562    pub fn param<T>(mut self, name: T, value: T) -> CreativeListCall<'a, C>
41563    where
41564        T: AsRef<str>,
41565    {
41566        self._additional_params
41567            .insert(name.as_ref().to_string(), value.as_ref().to_string());
41568        self
41569    }
41570
41571    /// Identifies the authorization scope for the method you are building.
41572    ///
41573    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
41574    /// [`Scope::Dfatrafficking`].
41575    ///
41576    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
41577    /// tokens for more than one scope.
41578    ///
41579    /// Usually there is more than one suitable scope to authorize an operation, some of which may
41580    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
41581    /// sufficient, a read-write scope will do as well.
41582    pub fn add_scope<St>(mut self, scope: St) -> CreativeListCall<'a, C>
41583    where
41584        St: AsRef<str>,
41585    {
41586        self._scopes.insert(String::from(scope.as_ref()));
41587        self
41588    }
41589    /// Identifies the authorization scope(s) for the method you are building.
41590    ///
41591    /// See [`Self::add_scope()`] for details.
41592    pub fn add_scopes<I, St>(mut self, scopes: I) -> CreativeListCall<'a, C>
41593    where
41594        I: IntoIterator<Item = St>,
41595        St: AsRef<str>,
41596    {
41597        self._scopes
41598            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
41599        self
41600    }
41601
41602    /// Removes all scopes, and no default scope will be used either.
41603    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
41604    /// for details).
41605    pub fn clear_scopes(mut self) -> CreativeListCall<'a, C> {
41606        self._scopes.clear();
41607        self
41608    }
41609}
41610
41611/// Updates an existing creative. This method supports patch semantics.
41612///
41613/// A builder for the *patch* method supported by a *creative* resource.
41614/// It is not used directly, but through a [`CreativeMethods`] instance.
41615///
41616/// # Example
41617///
41618/// Instantiate a resource method builder
41619///
41620/// ```test_harness,no_run
41621/// # extern crate hyper;
41622/// # extern crate hyper_rustls;
41623/// # extern crate google_dfareporting3d3 as dfareporting3d3;
41624/// use dfareporting3d3::api::Creative;
41625/// # async fn dox() {
41626/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
41627///
41628/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
41629/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
41630/// #     secret,
41631/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
41632/// # ).build().await.unwrap();
41633///
41634/// # let client = hyper_util::client::legacy::Client::builder(
41635/// #     hyper_util::rt::TokioExecutor::new()
41636/// # )
41637/// # .build(
41638/// #     hyper_rustls::HttpsConnectorBuilder::new()
41639/// #         .with_native_roots()
41640/// #         .unwrap()
41641/// #         .https_or_http()
41642/// #         .enable_http1()
41643/// #         .build()
41644/// # );
41645/// # let mut hub = Dfareporting::new(client, auth);
41646/// // As the method needs a request, you would usually fill it with the desired information
41647/// // into the respective structure. Some of the parts shown here might not be applicable !
41648/// // Values shown here are possibly random and not representative !
41649/// let mut req = Creative::default();
41650///
41651/// // You can configure optional parameters by calling the respective setters at will, and
41652/// // execute the final call using `doit()`.
41653/// // Values shown here are possibly random and not representative !
41654/// let result = hub.creatives().patch(req, -56, -21)
41655///              .doit().await;
41656/// # }
41657/// ```
41658pub struct CreativePatchCall<'a, C>
41659where
41660    C: 'a,
41661{
41662    hub: &'a Dfareporting<C>,
41663    _request: Creative,
41664    _profile_id: i64,
41665    _id: i64,
41666    _delegate: Option<&'a mut dyn common::Delegate>,
41667    _additional_params: HashMap<String, String>,
41668    _scopes: BTreeSet<String>,
41669}
41670
41671impl<'a, C> common::CallBuilder for CreativePatchCall<'a, C> {}
41672
41673impl<'a, C> CreativePatchCall<'a, C>
41674where
41675    C: common::Connector,
41676{
41677    /// Perform the operation you have build so far.
41678    pub async fn doit(mut self) -> common::Result<(common::Response, Creative)> {
41679        use std::borrow::Cow;
41680        use std::io::{Read, Seek};
41681
41682        use common::{url::Params, ToParts};
41683        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
41684
41685        let mut dd = common::DefaultDelegate;
41686        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
41687        dlg.begin(common::MethodInfo {
41688            id: "dfareporting.creatives.patch",
41689            http_method: hyper::Method::PATCH,
41690        });
41691
41692        for &field in ["alt", "profileId", "id"].iter() {
41693            if self._additional_params.contains_key(field) {
41694                dlg.finished(false);
41695                return Err(common::Error::FieldClash(field));
41696            }
41697        }
41698
41699        let mut params = Params::with_capacity(5 + self._additional_params.len());
41700        params.push("profileId", self._profile_id.to_string());
41701        params.push("id", self._id.to_string());
41702
41703        params.extend(self._additional_params.iter());
41704
41705        params.push("alt", "json");
41706        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creatives";
41707        if self._scopes.is_empty() {
41708            self._scopes
41709                .insert(Scope::Dfatrafficking.as_ref().to_string());
41710        }
41711
41712        #[allow(clippy::single_element_loop)]
41713        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
41714            url = params.uri_replacement(url, param_name, find_this, false);
41715        }
41716        {
41717            let to_remove = ["profileId"];
41718            params.remove_params(&to_remove);
41719        }
41720
41721        let url = params.parse_with_url(&url);
41722
41723        let mut json_mime_type = mime::APPLICATION_JSON;
41724        let mut request_value_reader = {
41725            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
41726            common::remove_json_null_values(&mut value);
41727            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
41728            serde_json::to_writer(&mut dst, &value).unwrap();
41729            dst
41730        };
41731        let request_size = request_value_reader
41732            .seek(std::io::SeekFrom::End(0))
41733            .unwrap();
41734        request_value_reader
41735            .seek(std::io::SeekFrom::Start(0))
41736            .unwrap();
41737
41738        loop {
41739            let token = match self
41740                .hub
41741                .auth
41742                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
41743                .await
41744            {
41745                Ok(token) => token,
41746                Err(e) => match dlg.token(e) {
41747                    Ok(token) => token,
41748                    Err(e) => {
41749                        dlg.finished(false);
41750                        return Err(common::Error::MissingToken(e));
41751                    }
41752                },
41753            };
41754            request_value_reader
41755                .seek(std::io::SeekFrom::Start(0))
41756                .unwrap();
41757            let mut req_result = {
41758                let client = &self.hub.client;
41759                dlg.pre_request();
41760                let mut req_builder = hyper::Request::builder()
41761                    .method(hyper::Method::PATCH)
41762                    .uri(url.as_str())
41763                    .header(USER_AGENT, self.hub._user_agent.clone());
41764
41765                if let Some(token) = token.as_ref() {
41766                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
41767                }
41768
41769                let request = req_builder
41770                    .header(CONTENT_TYPE, json_mime_type.to_string())
41771                    .header(CONTENT_LENGTH, request_size as u64)
41772                    .body(common::to_body(
41773                        request_value_reader.get_ref().clone().into(),
41774                    ));
41775
41776                client.request(request.unwrap()).await
41777            };
41778
41779            match req_result {
41780                Err(err) => {
41781                    if let common::Retry::After(d) = dlg.http_error(&err) {
41782                        sleep(d).await;
41783                        continue;
41784                    }
41785                    dlg.finished(false);
41786                    return Err(common::Error::HttpError(err));
41787                }
41788                Ok(res) => {
41789                    let (mut parts, body) = res.into_parts();
41790                    let mut body = common::Body::new(body);
41791                    if !parts.status.is_success() {
41792                        let bytes = common::to_bytes(body).await.unwrap_or_default();
41793                        let error = serde_json::from_str(&common::to_string(&bytes));
41794                        let response = common::to_response(parts, bytes.into());
41795
41796                        if let common::Retry::After(d) =
41797                            dlg.http_failure(&response, error.as_ref().ok())
41798                        {
41799                            sleep(d).await;
41800                            continue;
41801                        }
41802
41803                        dlg.finished(false);
41804
41805                        return Err(match error {
41806                            Ok(value) => common::Error::BadRequest(value),
41807                            _ => common::Error::Failure(response),
41808                        });
41809                    }
41810                    let response = {
41811                        let bytes = common::to_bytes(body).await.unwrap_or_default();
41812                        let encoded = common::to_string(&bytes);
41813                        match serde_json::from_str(&encoded) {
41814                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
41815                            Err(error) => {
41816                                dlg.response_json_decode_error(&encoded, &error);
41817                                return Err(common::Error::JsonDecodeError(
41818                                    encoded.to_string(),
41819                                    error,
41820                                ));
41821                            }
41822                        }
41823                    };
41824
41825                    dlg.finished(true);
41826                    return Ok(response);
41827                }
41828            }
41829        }
41830    }
41831
41832    ///
41833    /// Sets the *request* property to the given value.
41834    ///
41835    /// Even though the property as already been set when instantiating this call,
41836    /// we provide this method for API completeness.
41837    pub fn request(mut self, new_value: Creative) -> CreativePatchCall<'a, C> {
41838        self._request = new_value;
41839        self
41840    }
41841    /// User profile ID associated with this request.
41842    ///
41843    /// Sets the *profile id* path property to the given value.
41844    ///
41845    /// Even though the property as already been set when instantiating this call,
41846    /// we provide this method for API completeness.
41847    pub fn profile_id(mut self, new_value: i64) -> CreativePatchCall<'a, C> {
41848        self._profile_id = new_value;
41849        self
41850    }
41851    /// Creative ID.
41852    ///
41853    /// Sets the *id* query property to the given value.
41854    ///
41855    /// Even though the property as already been set when instantiating this call,
41856    /// we provide this method for API completeness.
41857    pub fn id(mut self, new_value: i64) -> CreativePatchCall<'a, C> {
41858        self._id = new_value;
41859        self
41860    }
41861    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
41862    /// while executing the actual API request.
41863    ///
41864    /// ````text
41865    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
41866    /// ````
41867    ///
41868    /// Sets the *delegate* property to the given value.
41869    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> CreativePatchCall<'a, C> {
41870        self._delegate = Some(new_value);
41871        self
41872    }
41873
41874    /// Set any additional parameter of the query string used in the request.
41875    /// It should be used to set parameters which are not yet available through their own
41876    /// setters.
41877    ///
41878    /// Please note that this method must not be used to set any of the known parameters
41879    /// which have their own setter method. If done anyway, the request will fail.
41880    ///
41881    /// # Additional Parameters
41882    ///
41883    /// * *$.xgafv* (query-string) - V1 error format.
41884    /// * *access_token* (query-string) - OAuth access token.
41885    /// * *alt* (query-string) - Data format for response.
41886    /// * *callback* (query-string) - JSONP
41887    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
41888    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
41889    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
41890    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
41891    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
41892    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
41893    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
41894    pub fn param<T>(mut self, name: T, value: T) -> CreativePatchCall<'a, C>
41895    where
41896        T: AsRef<str>,
41897    {
41898        self._additional_params
41899            .insert(name.as_ref().to_string(), value.as_ref().to_string());
41900        self
41901    }
41902
41903    /// Identifies the authorization scope for the method you are building.
41904    ///
41905    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
41906    /// [`Scope::Dfatrafficking`].
41907    ///
41908    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
41909    /// tokens for more than one scope.
41910    ///
41911    /// Usually there is more than one suitable scope to authorize an operation, some of which may
41912    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
41913    /// sufficient, a read-write scope will do as well.
41914    pub fn add_scope<St>(mut self, scope: St) -> CreativePatchCall<'a, C>
41915    where
41916        St: AsRef<str>,
41917    {
41918        self._scopes.insert(String::from(scope.as_ref()));
41919        self
41920    }
41921    /// Identifies the authorization scope(s) for the method you are building.
41922    ///
41923    /// See [`Self::add_scope()`] for details.
41924    pub fn add_scopes<I, St>(mut self, scopes: I) -> CreativePatchCall<'a, C>
41925    where
41926        I: IntoIterator<Item = St>,
41927        St: AsRef<str>,
41928    {
41929        self._scopes
41930            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
41931        self
41932    }
41933
41934    /// Removes all scopes, and no default scope will be used either.
41935    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
41936    /// for details).
41937    pub fn clear_scopes(mut self) -> CreativePatchCall<'a, C> {
41938        self._scopes.clear();
41939        self
41940    }
41941}
41942
41943/// Updates an existing creative.
41944///
41945/// A builder for the *update* method supported by a *creative* resource.
41946/// It is not used directly, but through a [`CreativeMethods`] instance.
41947///
41948/// # Example
41949///
41950/// Instantiate a resource method builder
41951///
41952/// ```test_harness,no_run
41953/// # extern crate hyper;
41954/// # extern crate hyper_rustls;
41955/// # extern crate google_dfareporting3d3 as dfareporting3d3;
41956/// use dfareporting3d3::api::Creative;
41957/// # async fn dox() {
41958/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
41959///
41960/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
41961/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
41962/// #     secret,
41963/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
41964/// # ).build().await.unwrap();
41965///
41966/// # let client = hyper_util::client::legacy::Client::builder(
41967/// #     hyper_util::rt::TokioExecutor::new()
41968/// # )
41969/// # .build(
41970/// #     hyper_rustls::HttpsConnectorBuilder::new()
41971/// #         .with_native_roots()
41972/// #         .unwrap()
41973/// #         .https_or_http()
41974/// #         .enable_http1()
41975/// #         .build()
41976/// # );
41977/// # let mut hub = Dfareporting::new(client, auth);
41978/// // As the method needs a request, you would usually fill it with the desired information
41979/// // into the respective structure. Some of the parts shown here might not be applicable !
41980/// // Values shown here are possibly random and not representative !
41981/// let mut req = Creative::default();
41982///
41983/// // You can configure optional parameters by calling the respective setters at will, and
41984/// // execute the final call using `doit()`.
41985/// // Values shown here are possibly random and not representative !
41986/// let result = hub.creatives().update(req, -88)
41987///              .doit().await;
41988/// # }
41989/// ```
41990pub struct CreativeUpdateCall<'a, C>
41991where
41992    C: 'a,
41993{
41994    hub: &'a Dfareporting<C>,
41995    _request: Creative,
41996    _profile_id: i64,
41997    _delegate: Option<&'a mut dyn common::Delegate>,
41998    _additional_params: HashMap<String, String>,
41999    _scopes: BTreeSet<String>,
42000}
42001
42002impl<'a, C> common::CallBuilder for CreativeUpdateCall<'a, C> {}
42003
42004impl<'a, C> CreativeUpdateCall<'a, C>
42005where
42006    C: common::Connector,
42007{
42008    /// Perform the operation you have build so far.
42009    pub async fn doit(mut self) -> common::Result<(common::Response, Creative)> {
42010        use std::borrow::Cow;
42011        use std::io::{Read, Seek};
42012
42013        use common::{url::Params, ToParts};
42014        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
42015
42016        let mut dd = common::DefaultDelegate;
42017        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
42018        dlg.begin(common::MethodInfo {
42019            id: "dfareporting.creatives.update",
42020            http_method: hyper::Method::PUT,
42021        });
42022
42023        for &field in ["alt", "profileId"].iter() {
42024            if self._additional_params.contains_key(field) {
42025                dlg.finished(false);
42026                return Err(common::Error::FieldClash(field));
42027            }
42028        }
42029
42030        let mut params = Params::with_capacity(4 + self._additional_params.len());
42031        params.push("profileId", self._profile_id.to_string());
42032
42033        params.extend(self._additional_params.iter());
42034
42035        params.push("alt", "json");
42036        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/creatives";
42037        if self._scopes.is_empty() {
42038            self._scopes
42039                .insert(Scope::Dfatrafficking.as_ref().to_string());
42040        }
42041
42042        #[allow(clippy::single_element_loop)]
42043        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
42044            url = params.uri_replacement(url, param_name, find_this, false);
42045        }
42046        {
42047            let to_remove = ["profileId"];
42048            params.remove_params(&to_remove);
42049        }
42050
42051        let url = params.parse_with_url(&url);
42052
42053        let mut json_mime_type = mime::APPLICATION_JSON;
42054        let mut request_value_reader = {
42055            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
42056            common::remove_json_null_values(&mut value);
42057            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
42058            serde_json::to_writer(&mut dst, &value).unwrap();
42059            dst
42060        };
42061        let request_size = request_value_reader
42062            .seek(std::io::SeekFrom::End(0))
42063            .unwrap();
42064        request_value_reader
42065            .seek(std::io::SeekFrom::Start(0))
42066            .unwrap();
42067
42068        loop {
42069            let token = match self
42070                .hub
42071                .auth
42072                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
42073                .await
42074            {
42075                Ok(token) => token,
42076                Err(e) => match dlg.token(e) {
42077                    Ok(token) => token,
42078                    Err(e) => {
42079                        dlg.finished(false);
42080                        return Err(common::Error::MissingToken(e));
42081                    }
42082                },
42083            };
42084            request_value_reader
42085                .seek(std::io::SeekFrom::Start(0))
42086                .unwrap();
42087            let mut req_result = {
42088                let client = &self.hub.client;
42089                dlg.pre_request();
42090                let mut req_builder = hyper::Request::builder()
42091                    .method(hyper::Method::PUT)
42092                    .uri(url.as_str())
42093                    .header(USER_AGENT, self.hub._user_agent.clone());
42094
42095                if let Some(token) = token.as_ref() {
42096                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
42097                }
42098
42099                let request = req_builder
42100                    .header(CONTENT_TYPE, json_mime_type.to_string())
42101                    .header(CONTENT_LENGTH, request_size as u64)
42102                    .body(common::to_body(
42103                        request_value_reader.get_ref().clone().into(),
42104                    ));
42105
42106                client.request(request.unwrap()).await
42107            };
42108
42109            match req_result {
42110                Err(err) => {
42111                    if let common::Retry::After(d) = dlg.http_error(&err) {
42112                        sleep(d).await;
42113                        continue;
42114                    }
42115                    dlg.finished(false);
42116                    return Err(common::Error::HttpError(err));
42117                }
42118                Ok(res) => {
42119                    let (mut parts, body) = res.into_parts();
42120                    let mut body = common::Body::new(body);
42121                    if !parts.status.is_success() {
42122                        let bytes = common::to_bytes(body).await.unwrap_or_default();
42123                        let error = serde_json::from_str(&common::to_string(&bytes));
42124                        let response = common::to_response(parts, bytes.into());
42125
42126                        if let common::Retry::After(d) =
42127                            dlg.http_failure(&response, error.as_ref().ok())
42128                        {
42129                            sleep(d).await;
42130                            continue;
42131                        }
42132
42133                        dlg.finished(false);
42134
42135                        return Err(match error {
42136                            Ok(value) => common::Error::BadRequest(value),
42137                            _ => common::Error::Failure(response),
42138                        });
42139                    }
42140                    let response = {
42141                        let bytes = common::to_bytes(body).await.unwrap_or_default();
42142                        let encoded = common::to_string(&bytes);
42143                        match serde_json::from_str(&encoded) {
42144                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
42145                            Err(error) => {
42146                                dlg.response_json_decode_error(&encoded, &error);
42147                                return Err(common::Error::JsonDecodeError(
42148                                    encoded.to_string(),
42149                                    error,
42150                                ));
42151                            }
42152                        }
42153                    };
42154
42155                    dlg.finished(true);
42156                    return Ok(response);
42157                }
42158            }
42159        }
42160    }
42161
42162    ///
42163    /// Sets the *request* property to the given value.
42164    ///
42165    /// Even though the property as already been set when instantiating this call,
42166    /// we provide this method for API completeness.
42167    pub fn request(mut self, new_value: Creative) -> CreativeUpdateCall<'a, C> {
42168        self._request = new_value;
42169        self
42170    }
42171    /// User profile ID associated with this request.
42172    ///
42173    /// Sets the *profile id* path property to the given value.
42174    ///
42175    /// Even though the property as already been set when instantiating this call,
42176    /// we provide this method for API completeness.
42177    pub fn profile_id(mut self, new_value: i64) -> CreativeUpdateCall<'a, C> {
42178        self._profile_id = new_value;
42179        self
42180    }
42181    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
42182    /// while executing the actual API request.
42183    ///
42184    /// ````text
42185    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
42186    /// ````
42187    ///
42188    /// Sets the *delegate* property to the given value.
42189    pub fn delegate(
42190        mut self,
42191        new_value: &'a mut dyn common::Delegate,
42192    ) -> CreativeUpdateCall<'a, C> {
42193        self._delegate = Some(new_value);
42194        self
42195    }
42196
42197    /// Set any additional parameter of the query string used in the request.
42198    /// It should be used to set parameters which are not yet available through their own
42199    /// setters.
42200    ///
42201    /// Please note that this method must not be used to set any of the known parameters
42202    /// which have their own setter method. If done anyway, the request will fail.
42203    ///
42204    /// # Additional Parameters
42205    ///
42206    /// * *$.xgafv* (query-string) - V1 error format.
42207    /// * *access_token* (query-string) - OAuth access token.
42208    /// * *alt* (query-string) - Data format for response.
42209    /// * *callback* (query-string) - JSONP
42210    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
42211    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
42212    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
42213    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
42214    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
42215    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
42216    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
42217    pub fn param<T>(mut self, name: T, value: T) -> CreativeUpdateCall<'a, C>
42218    where
42219        T: AsRef<str>,
42220    {
42221        self._additional_params
42222            .insert(name.as_ref().to_string(), value.as_ref().to_string());
42223        self
42224    }
42225
42226    /// Identifies the authorization scope for the method you are building.
42227    ///
42228    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
42229    /// [`Scope::Dfatrafficking`].
42230    ///
42231    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
42232    /// tokens for more than one scope.
42233    ///
42234    /// Usually there is more than one suitable scope to authorize an operation, some of which may
42235    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
42236    /// sufficient, a read-write scope will do as well.
42237    pub fn add_scope<St>(mut self, scope: St) -> CreativeUpdateCall<'a, C>
42238    where
42239        St: AsRef<str>,
42240    {
42241        self._scopes.insert(String::from(scope.as_ref()));
42242        self
42243    }
42244    /// Identifies the authorization scope(s) for the method you are building.
42245    ///
42246    /// See [`Self::add_scope()`] for details.
42247    pub fn add_scopes<I, St>(mut self, scopes: I) -> CreativeUpdateCall<'a, C>
42248    where
42249        I: IntoIterator<Item = St>,
42250        St: AsRef<str>,
42251    {
42252        self._scopes
42253            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
42254        self
42255    }
42256
42257    /// Removes all scopes, and no default scope will be used either.
42258    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
42259    /// for details).
42260    pub fn clear_scopes(mut self) -> CreativeUpdateCall<'a, C> {
42261        self._scopes.clear();
42262        self
42263    }
42264}
42265
42266/// Retrieves list of report dimension values for a list of filters.
42267///
42268/// A builder for the *query* method supported by a *dimensionValue* resource.
42269/// It is not used directly, but through a [`DimensionValueMethods`] instance.
42270///
42271/// # Example
42272///
42273/// Instantiate a resource method builder
42274///
42275/// ```test_harness,no_run
42276/// # extern crate hyper;
42277/// # extern crate hyper_rustls;
42278/// # extern crate google_dfareporting3d3 as dfareporting3d3;
42279/// use dfareporting3d3::api::DimensionValueRequest;
42280/// # async fn dox() {
42281/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
42282///
42283/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
42284/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
42285/// #     secret,
42286/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
42287/// # ).build().await.unwrap();
42288///
42289/// # let client = hyper_util::client::legacy::Client::builder(
42290/// #     hyper_util::rt::TokioExecutor::new()
42291/// # )
42292/// # .build(
42293/// #     hyper_rustls::HttpsConnectorBuilder::new()
42294/// #         .with_native_roots()
42295/// #         .unwrap()
42296/// #         .https_or_http()
42297/// #         .enable_http1()
42298/// #         .build()
42299/// # );
42300/// # let mut hub = Dfareporting::new(client, auth);
42301/// // As the method needs a request, you would usually fill it with the desired information
42302/// // into the respective structure. Some of the parts shown here might not be applicable !
42303/// // Values shown here are possibly random and not representative !
42304/// let mut req = DimensionValueRequest::default();
42305///
42306/// // You can configure optional parameters by calling the respective setters at will, and
42307/// // execute the final call using `doit()`.
42308/// // Values shown here are possibly random and not representative !
42309/// let result = hub.dimension_values().query(req, -1)
42310///              .page_token("sed")
42311///              .max_results(-91)
42312///              .doit().await;
42313/// # }
42314/// ```
42315pub struct DimensionValueQueryCall<'a, C>
42316where
42317    C: 'a,
42318{
42319    hub: &'a Dfareporting<C>,
42320    _request: DimensionValueRequest,
42321    _profile_id: i64,
42322    _page_token: Option<String>,
42323    _max_results: Option<i32>,
42324    _delegate: Option<&'a mut dyn common::Delegate>,
42325    _additional_params: HashMap<String, String>,
42326    _scopes: BTreeSet<String>,
42327}
42328
42329impl<'a, C> common::CallBuilder for DimensionValueQueryCall<'a, C> {}
42330
42331impl<'a, C> DimensionValueQueryCall<'a, C>
42332where
42333    C: common::Connector,
42334{
42335    /// Perform the operation you have build so far.
42336    pub async fn doit(mut self) -> common::Result<(common::Response, DimensionValueList)> {
42337        use std::borrow::Cow;
42338        use std::io::{Read, Seek};
42339
42340        use common::{url::Params, ToParts};
42341        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
42342
42343        let mut dd = common::DefaultDelegate;
42344        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
42345        dlg.begin(common::MethodInfo {
42346            id: "dfareporting.dimensionValues.query",
42347            http_method: hyper::Method::POST,
42348        });
42349
42350        for &field in ["alt", "profileId", "pageToken", "maxResults"].iter() {
42351            if self._additional_params.contains_key(field) {
42352                dlg.finished(false);
42353                return Err(common::Error::FieldClash(field));
42354            }
42355        }
42356
42357        let mut params = Params::with_capacity(6 + self._additional_params.len());
42358        params.push("profileId", self._profile_id.to_string());
42359        if let Some(value) = self._page_token.as_ref() {
42360            params.push("pageToken", value);
42361        }
42362        if let Some(value) = self._max_results.as_ref() {
42363            params.push("maxResults", value.to_string());
42364        }
42365
42366        params.extend(self._additional_params.iter());
42367
42368        params.push("alt", "json");
42369        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/dimensionvalues/query";
42370        if self._scopes.is_empty() {
42371            self._scopes.insert(Scope::Full.as_ref().to_string());
42372        }
42373
42374        #[allow(clippy::single_element_loop)]
42375        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
42376            url = params.uri_replacement(url, param_name, find_this, false);
42377        }
42378        {
42379            let to_remove = ["profileId"];
42380            params.remove_params(&to_remove);
42381        }
42382
42383        let url = params.parse_with_url(&url);
42384
42385        let mut json_mime_type = mime::APPLICATION_JSON;
42386        let mut request_value_reader = {
42387            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
42388            common::remove_json_null_values(&mut value);
42389            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
42390            serde_json::to_writer(&mut dst, &value).unwrap();
42391            dst
42392        };
42393        let request_size = request_value_reader
42394            .seek(std::io::SeekFrom::End(0))
42395            .unwrap();
42396        request_value_reader
42397            .seek(std::io::SeekFrom::Start(0))
42398            .unwrap();
42399
42400        loop {
42401            let token = match self
42402                .hub
42403                .auth
42404                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
42405                .await
42406            {
42407                Ok(token) => token,
42408                Err(e) => match dlg.token(e) {
42409                    Ok(token) => token,
42410                    Err(e) => {
42411                        dlg.finished(false);
42412                        return Err(common::Error::MissingToken(e));
42413                    }
42414                },
42415            };
42416            request_value_reader
42417                .seek(std::io::SeekFrom::Start(0))
42418                .unwrap();
42419            let mut req_result = {
42420                let client = &self.hub.client;
42421                dlg.pre_request();
42422                let mut req_builder = hyper::Request::builder()
42423                    .method(hyper::Method::POST)
42424                    .uri(url.as_str())
42425                    .header(USER_AGENT, self.hub._user_agent.clone());
42426
42427                if let Some(token) = token.as_ref() {
42428                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
42429                }
42430
42431                let request = req_builder
42432                    .header(CONTENT_TYPE, json_mime_type.to_string())
42433                    .header(CONTENT_LENGTH, request_size as u64)
42434                    .body(common::to_body(
42435                        request_value_reader.get_ref().clone().into(),
42436                    ));
42437
42438                client.request(request.unwrap()).await
42439            };
42440
42441            match req_result {
42442                Err(err) => {
42443                    if let common::Retry::After(d) = dlg.http_error(&err) {
42444                        sleep(d).await;
42445                        continue;
42446                    }
42447                    dlg.finished(false);
42448                    return Err(common::Error::HttpError(err));
42449                }
42450                Ok(res) => {
42451                    let (mut parts, body) = res.into_parts();
42452                    let mut body = common::Body::new(body);
42453                    if !parts.status.is_success() {
42454                        let bytes = common::to_bytes(body).await.unwrap_or_default();
42455                        let error = serde_json::from_str(&common::to_string(&bytes));
42456                        let response = common::to_response(parts, bytes.into());
42457
42458                        if let common::Retry::After(d) =
42459                            dlg.http_failure(&response, error.as_ref().ok())
42460                        {
42461                            sleep(d).await;
42462                            continue;
42463                        }
42464
42465                        dlg.finished(false);
42466
42467                        return Err(match error {
42468                            Ok(value) => common::Error::BadRequest(value),
42469                            _ => common::Error::Failure(response),
42470                        });
42471                    }
42472                    let response = {
42473                        let bytes = common::to_bytes(body).await.unwrap_or_default();
42474                        let encoded = common::to_string(&bytes);
42475                        match serde_json::from_str(&encoded) {
42476                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
42477                            Err(error) => {
42478                                dlg.response_json_decode_error(&encoded, &error);
42479                                return Err(common::Error::JsonDecodeError(
42480                                    encoded.to_string(),
42481                                    error,
42482                                ));
42483                            }
42484                        }
42485                    };
42486
42487                    dlg.finished(true);
42488                    return Ok(response);
42489                }
42490            }
42491        }
42492    }
42493
42494    ///
42495    /// Sets the *request* property to the given value.
42496    ///
42497    /// Even though the property as already been set when instantiating this call,
42498    /// we provide this method for API completeness.
42499    pub fn request(mut self, new_value: DimensionValueRequest) -> DimensionValueQueryCall<'a, C> {
42500        self._request = new_value;
42501        self
42502    }
42503    /// The Campaign Manager 360 user profile ID.
42504    ///
42505    /// Sets the *profile id* path property to the given value.
42506    ///
42507    /// Even though the property as already been set when instantiating this call,
42508    /// we provide this method for API completeness.
42509    pub fn profile_id(mut self, new_value: i64) -> DimensionValueQueryCall<'a, C> {
42510        self._profile_id = new_value;
42511        self
42512    }
42513    /// The value of the nextToken from the previous result page.
42514    ///
42515    /// Sets the *page token* query property to the given value.
42516    pub fn page_token(mut self, new_value: &str) -> DimensionValueQueryCall<'a, C> {
42517        self._page_token = Some(new_value.to_string());
42518        self
42519    }
42520    /// Maximum number of results to return.
42521    ///
42522    /// Sets the *max results* query property to the given value.
42523    pub fn max_results(mut self, new_value: i32) -> DimensionValueQueryCall<'a, C> {
42524        self._max_results = Some(new_value);
42525        self
42526    }
42527    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
42528    /// while executing the actual API request.
42529    ///
42530    /// ````text
42531    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
42532    /// ````
42533    ///
42534    /// Sets the *delegate* property to the given value.
42535    pub fn delegate(
42536        mut self,
42537        new_value: &'a mut dyn common::Delegate,
42538    ) -> DimensionValueQueryCall<'a, C> {
42539        self._delegate = Some(new_value);
42540        self
42541    }
42542
42543    /// Set any additional parameter of the query string used in the request.
42544    /// It should be used to set parameters which are not yet available through their own
42545    /// setters.
42546    ///
42547    /// Please note that this method must not be used to set any of the known parameters
42548    /// which have their own setter method. If done anyway, the request will fail.
42549    ///
42550    /// # Additional Parameters
42551    ///
42552    /// * *$.xgafv* (query-string) - V1 error format.
42553    /// * *access_token* (query-string) - OAuth access token.
42554    /// * *alt* (query-string) - Data format for response.
42555    /// * *callback* (query-string) - JSONP
42556    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
42557    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
42558    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
42559    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
42560    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
42561    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
42562    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
42563    pub fn param<T>(mut self, name: T, value: T) -> DimensionValueQueryCall<'a, C>
42564    where
42565        T: AsRef<str>,
42566    {
42567        self._additional_params
42568            .insert(name.as_ref().to_string(), value.as_ref().to_string());
42569        self
42570    }
42571
42572    /// Identifies the authorization scope for the method you are building.
42573    ///
42574    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
42575    /// [`Scope::Full`].
42576    ///
42577    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
42578    /// tokens for more than one scope.
42579    ///
42580    /// Usually there is more than one suitable scope to authorize an operation, some of which may
42581    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
42582    /// sufficient, a read-write scope will do as well.
42583    pub fn add_scope<St>(mut self, scope: St) -> DimensionValueQueryCall<'a, C>
42584    where
42585        St: AsRef<str>,
42586    {
42587        self._scopes.insert(String::from(scope.as_ref()));
42588        self
42589    }
42590    /// Identifies the authorization scope(s) for the method you are building.
42591    ///
42592    /// See [`Self::add_scope()`] for details.
42593    pub fn add_scopes<I, St>(mut self, scopes: I) -> DimensionValueQueryCall<'a, C>
42594    where
42595        I: IntoIterator<Item = St>,
42596        St: AsRef<str>,
42597    {
42598        self._scopes
42599            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
42600        self
42601    }
42602
42603    /// Removes all scopes, and no default scope will be used either.
42604    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
42605    /// for details).
42606    pub fn clear_scopes(mut self) -> DimensionValueQueryCall<'a, C> {
42607        self._scopes.clear();
42608        self
42609    }
42610}
42611
42612/// Gets one directory site by ID.
42613///
42614/// A builder for the *get* method supported by a *directorySite* resource.
42615/// It is not used directly, but through a [`DirectorySiteMethods`] instance.
42616///
42617/// # Example
42618///
42619/// Instantiate a resource method builder
42620///
42621/// ```test_harness,no_run
42622/// # extern crate hyper;
42623/// # extern crate hyper_rustls;
42624/// # extern crate google_dfareporting3d3 as dfareporting3d3;
42625/// # async fn dox() {
42626/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
42627///
42628/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
42629/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
42630/// #     secret,
42631/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
42632/// # ).build().await.unwrap();
42633///
42634/// # let client = hyper_util::client::legacy::Client::builder(
42635/// #     hyper_util::rt::TokioExecutor::new()
42636/// # )
42637/// # .build(
42638/// #     hyper_rustls::HttpsConnectorBuilder::new()
42639/// #         .with_native_roots()
42640/// #         .unwrap()
42641/// #         .https_or_http()
42642/// #         .enable_http1()
42643/// #         .build()
42644/// # );
42645/// # let mut hub = Dfareporting::new(client, auth);
42646/// // You can configure optional parameters by calling the respective setters at will, and
42647/// // execute the final call using `doit()`.
42648/// // Values shown here are possibly random and not representative !
42649/// let result = hub.directory_sites().get(-10, -100)
42650///              .doit().await;
42651/// # }
42652/// ```
42653pub struct DirectorySiteGetCall<'a, C>
42654where
42655    C: 'a,
42656{
42657    hub: &'a Dfareporting<C>,
42658    _profile_id: i64,
42659    _id: i64,
42660    _delegate: Option<&'a mut dyn common::Delegate>,
42661    _additional_params: HashMap<String, String>,
42662    _scopes: BTreeSet<String>,
42663}
42664
42665impl<'a, C> common::CallBuilder for DirectorySiteGetCall<'a, C> {}
42666
42667impl<'a, C> DirectorySiteGetCall<'a, C>
42668where
42669    C: common::Connector,
42670{
42671    /// Perform the operation you have build so far.
42672    pub async fn doit(mut self) -> common::Result<(common::Response, DirectorySite)> {
42673        use std::borrow::Cow;
42674        use std::io::{Read, Seek};
42675
42676        use common::{url::Params, ToParts};
42677        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
42678
42679        let mut dd = common::DefaultDelegate;
42680        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
42681        dlg.begin(common::MethodInfo {
42682            id: "dfareporting.directorySites.get",
42683            http_method: hyper::Method::GET,
42684        });
42685
42686        for &field in ["alt", "profileId", "id"].iter() {
42687            if self._additional_params.contains_key(field) {
42688                dlg.finished(false);
42689                return Err(common::Error::FieldClash(field));
42690            }
42691        }
42692
42693        let mut params = Params::with_capacity(4 + self._additional_params.len());
42694        params.push("profileId", self._profile_id.to_string());
42695        params.push("id", self._id.to_string());
42696
42697        params.extend(self._additional_params.iter());
42698
42699        params.push("alt", "json");
42700        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/directorySites/{id}";
42701        if self._scopes.is_empty() {
42702            self._scopes
42703                .insert(Scope::Dfatrafficking.as_ref().to_string());
42704        }
42705
42706        #[allow(clippy::single_element_loop)]
42707        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
42708            url = params.uri_replacement(url, param_name, find_this, false);
42709        }
42710        {
42711            let to_remove = ["id", "profileId"];
42712            params.remove_params(&to_remove);
42713        }
42714
42715        let url = params.parse_with_url(&url);
42716
42717        loop {
42718            let token = match self
42719                .hub
42720                .auth
42721                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
42722                .await
42723            {
42724                Ok(token) => token,
42725                Err(e) => match dlg.token(e) {
42726                    Ok(token) => token,
42727                    Err(e) => {
42728                        dlg.finished(false);
42729                        return Err(common::Error::MissingToken(e));
42730                    }
42731                },
42732            };
42733            let mut req_result = {
42734                let client = &self.hub.client;
42735                dlg.pre_request();
42736                let mut req_builder = hyper::Request::builder()
42737                    .method(hyper::Method::GET)
42738                    .uri(url.as_str())
42739                    .header(USER_AGENT, self.hub._user_agent.clone());
42740
42741                if let Some(token) = token.as_ref() {
42742                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
42743                }
42744
42745                let request = req_builder
42746                    .header(CONTENT_LENGTH, 0_u64)
42747                    .body(common::to_body::<String>(None));
42748
42749                client.request(request.unwrap()).await
42750            };
42751
42752            match req_result {
42753                Err(err) => {
42754                    if let common::Retry::After(d) = dlg.http_error(&err) {
42755                        sleep(d).await;
42756                        continue;
42757                    }
42758                    dlg.finished(false);
42759                    return Err(common::Error::HttpError(err));
42760                }
42761                Ok(res) => {
42762                    let (mut parts, body) = res.into_parts();
42763                    let mut body = common::Body::new(body);
42764                    if !parts.status.is_success() {
42765                        let bytes = common::to_bytes(body).await.unwrap_or_default();
42766                        let error = serde_json::from_str(&common::to_string(&bytes));
42767                        let response = common::to_response(parts, bytes.into());
42768
42769                        if let common::Retry::After(d) =
42770                            dlg.http_failure(&response, error.as_ref().ok())
42771                        {
42772                            sleep(d).await;
42773                            continue;
42774                        }
42775
42776                        dlg.finished(false);
42777
42778                        return Err(match error {
42779                            Ok(value) => common::Error::BadRequest(value),
42780                            _ => common::Error::Failure(response),
42781                        });
42782                    }
42783                    let response = {
42784                        let bytes = common::to_bytes(body).await.unwrap_or_default();
42785                        let encoded = common::to_string(&bytes);
42786                        match serde_json::from_str(&encoded) {
42787                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
42788                            Err(error) => {
42789                                dlg.response_json_decode_error(&encoded, &error);
42790                                return Err(common::Error::JsonDecodeError(
42791                                    encoded.to_string(),
42792                                    error,
42793                                ));
42794                            }
42795                        }
42796                    };
42797
42798                    dlg.finished(true);
42799                    return Ok(response);
42800                }
42801            }
42802        }
42803    }
42804
42805    /// User profile ID associated with this request.
42806    ///
42807    /// Sets the *profile id* path property to the given value.
42808    ///
42809    /// Even though the property as already been set when instantiating this call,
42810    /// we provide this method for API completeness.
42811    pub fn profile_id(mut self, new_value: i64) -> DirectorySiteGetCall<'a, C> {
42812        self._profile_id = new_value;
42813        self
42814    }
42815    /// Directory site ID.
42816    ///
42817    /// Sets the *id* path property to the given value.
42818    ///
42819    /// Even though the property as already been set when instantiating this call,
42820    /// we provide this method for API completeness.
42821    pub fn id(mut self, new_value: i64) -> DirectorySiteGetCall<'a, C> {
42822        self._id = new_value;
42823        self
42824    }
42825    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
42826    /// while executing the actual API request.
42827    ///
42828    /// ````text
42829    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
42830    /// ````
42831    ///
42832    /// Sets the *delegate* property to the given value.
42833    pub fn delegate(
42834        mut self,
42835        new_value: &'a mut dyn common::Delegate,
42836    ) -> DirectorySiteGetCall<'a, C> {
42837        self._delegate = Some(new_value);
42838        self
42839    }
42840
42841    /// Set any additional parameter of the query string used in the request.
42842    /// It should be used to set parameters which are not yet available through their own
42843    /// setters.
42844    ///
42845    /// Please note that this method must not be used to set any of the known parameters
42846    /// which have their own setter method. If done anyway, the request will fail.
42847    ///
42848    /// # Additional Parameters
42849    ///
42850    /// * *$.xgafv* (query-string) - V1 error format.
42851    /// * *access_token* (query-string) - OAuth access token.
42852    /// * *alt* (query-string) - Data format for response.
42853    /// * *callback* (query-string) - JSONP
42854    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
42855    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
42856    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
42857    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
42858    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
42859    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
42860    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
42861    pub fn param<T>(mut self, name: T, value: T) -> DirectorySiteGetCall<'a, C>
42862    where
42863        T: AsRef<str>,
42864    {
42865        self._additional_params
42866            .insert(name.as_ref().to_string(), value.as_ref().to_string());
42867        self
42868    }
42869
42870    /// Identifies the authorization scope for the method you are building.
42871    ///
42872    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
42873    /// [`Scope::Dfatrafficking`].
42874    ///
42875    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
42876    /// tokens for more than one scope.
42877    ///
42878    /// Usually there is more than one suitable scope to authorize an operation, some of which may
42879    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
42880    /// sufficient, a read-write scope will do as well.
42881    pub fn add_scope<St>(mut self, scope: St) -> DirectorySiteGetCall<'a, C>
42882    where
42883        St: AsRef<str>,
42884    {
42885        self._scopes.insert(String::from(scope.as_ref()));
42886        self
42887    }
42888    /// Identifies the authorization scope(s) for the method you are building.
42889    ///
42890    /// See [`Self::add_scope()`] for details.
42891    pub fn add_scopes<I, St>(mut self, scopes: I) -> DirectorySiteGetCall<'a, C>
42892    where
42893        I: IntoIterator<Item = St>,
42894        St: AsRef<str>,
42895    {
42896        self._scopes
42897            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
42898        self
42899    }
42900
42901    /// Removes all scopes, and no default scope will be used either.
42902    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
42903    /// for details).
42904    pub fn clear_scopes(mut self) -> DirectorySiteGetCall<'a, C> {
42905        self._scopes.clear();
42906        self
42907    }
42908}
42909
42910/// Inserts a new directory site.
42911///
42912/// A builder for the *insert* method supported by a *directorySite* resource.
42913/// It is not used directly, but through a [`DirectorySiteMethods`] instance.
42914///
42915/// # Example
42916///
42917/// Instantiate a resource method builder
42918///
42919/// ```test_harness,no_run
42920/// # extern crate hyper;
42921/// # extern crate hyper_rustls;
42922/// # extern crate google_dfareporting3d3 as dfareporting3d3;
42923/// use dfareporting3d3::api::DirectorySite;
42924/// # async fn dox() {
42925/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
42926///
42927/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
42928/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
42929/// #     secret,
42930/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
42931/// # ).build().await.unwrap();
42932///
42933/// # let client = hyper_util::client::legacy::Client::builder(
42934/// #     hyper_util::rt::TokioExecutor::new()
42935/// # )
42936/// # .build(
42937/// #     hyper_rustls::HttpsConnectorBuilder::new()
42938/// #         .with_native_roots()
42939/// #         .unwrap()
42940/// #         .https_or_http()
42941/// #         .enable_http1()
42942/// #         .build()
42943/// # );
42944/// # let mut hub = Dfareporting::new(client, auth);
42945/// // As the method needs a request, you would usually fill it with the desired information
42946/// // into the respective structure. Some of the parts shown here might not be applicable !
42947/// // Values shown here are possibly random and not representative !
42948/// let mut req = DirectorySite::default();
42949///
42950/// // You can configure optional parameters by calling the respective setters at will, and
42951/// // execute the final call using `doit()`.
42952/// // Values shown here are possibly random and not representative !
42953/// let result = hub.directory_sites().insert(req, -63)
42954///              .doit().await;
42955/// # }
42956/// ```
42957pub struct DirectorySiteInsertCall<'a, C>
42958where
42959    C: 'a,
42960{
42961    hub: &'a Dfareporting<C>,
42962    _request: DirectorySite,
42963    _profile_id: i64,
42964    _delegate: Option<&'a mut dyn common::Delegate>,
42965    _additional_params: HashMap<String, String>,
42966    _scopes: BTreeSet<String>,
42967}
42968
42969impl<'a, C> common::CallBuilder for DirectorySiteInsertCall<'a, C> {}
42970
42971impl<'a, C> DirectorySiteInsertCall<'a, C>
42972where
42973    C: common::Connector,
42974{
42975    /// Perform the operation you have build so far.
42976    pub async fn doit(mut self) -> common::Result<(common::Response, DirectorySite)> {
42977        use std::borrow::Cow;
42978        use std::io::{Read, Seek};
42979
42980        use common::{url::Params, ToParts};
42981        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
42982
42983        let mut dd = common::DefaultDelegate;
42984        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
42985        dlg.begin(common::MethodInfo {
42986            id: "dfareporting.directorySites.insert",
42987            http_method: hyper::Method::POST,
42988        });
42989
42990        for &field in ["alt", "profileId"].iter() {
42991            if self._additional_params.contains_key(field) {
42992                dlg.finished(false);
42993                return Err(common::Error::FieldClash(field));
42994            }
42995        }
42996
42997        let mut params = Params::with_capacity(4 + self._additional_params.len());
42998        params.push("profileId", self._profile_id.to_string());
42999
43000        params.extend(self._additional_params.iter());
43001
43002        params.push("alt", "json");
43003        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/directorySites";
43004        if self._scopes.is_empty() {
43005            self._scopes
43006                .insert(Scope::Dfatrafficking.as_ref().to_string());
43007        }
43008
43009        #[allow(clippy::single_element_loop)]
43010        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
43011            url = params.uri_replacement(url, param_name, find_this, false);
43012        }
43013        {
43014            let to_remove = ["profileId"];
43015            params.remove_params(&to_remove);
43016        }
43017
43018        let url = params.parse_with_url(&url);
43019
43020        let mut json_mime_type = mime::APPLICATION_JSON;
43021        let mut request_value_reader = {
43022            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
43023            common::remove_json_null_values(&mut value);
43024            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
43025            serde_json::to_writer(&mut dst, &value).unwrap();
43026            dst
43027        };
43028        let request_size = request_value_reader
43029            .seek(std::io::SeekFrom::End(0))
43030            .unwrap();
43031        request_value_reader
43032            .seek(std::io::SeekFrom::Start(0))
43033            .unwrap();
43034
43035        loop {
43036            let token = match self
43037                .hub
43038                .auth
43039                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
43040                .await
43041            {
43042                Ok(token) => token,
43043                Err(e) => match dlg.token(e) {
43044                    Ok(token) => token,
43045                    Err(e) => {
43046                        dlg.finished(false);
43047                        return Err(common::Error::MissingToken(e));
43048                    }
43049                },
43050            };
43051            request_value_reader
43052                .seek(std::io::SeekFrom::Start(0))
43053                .unwrap();
43054            let mut req_result = {
43055                let client = &self.hub.client;
43056                dlg.pre_request();
43057                let mut req_builder = hyper::Request::builder()
43058                    .method(hyper::Method::POST)
43059                    .uri(url.as_str())
43060                    .header(USER_AGENT, self.hub._user_agent.clone());
43061
43062                if let Some(token) = token.as_ref() {
43063                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
43064                }
43065
43066                let request = req_builder
43067                    .header(CONTENT_TYPE, json_mime_type.to_string())
43068                    .header(CONTENT_LENGTH, request_size as u64)
43069                    .body(common::to_body(
43070                        request_value_reader.get_ref().clone().into(),
43071                    ));
43072
43073                client.request(request.unwrap()).await
43074            };
43075
43076            match req_result {
43077                Err(err) => {
43078                    if let common::Retry::After(d) = dlg.http_error(&err) {
43079                        sleep(d).await;
43080                        continue;
43081                    }
43082                    dlg.finished(false);
43083                    return Err(common::Error::HttpError(err));
43084                }
43085                Ok(res) => {
43086                    let (mut parts, body) = res.into_parts();
43087                    let mut body = common::Body::new(body);
43088                    if !parts.status.is_success() {
43089                        let bytes = common::to_bytes(body).await.unwrap_or_default();
43090                        let error = serde_json::from_str(&common::to_string(&bytes));
43091                        let response = common::to_response(parts, bytes.into());
43092
43093                        if let common::Retry::After(d) =
43094                            dlg.http_failure(&response, error.as_ref().ok())
43095                        {
43096                            sleep(d).await;
43097                            continue;
43098                        }
43099
43100                        dlg.finished(false);
43101
43102                        return Err(match error {
43103                            Ok(value) => common::Error::BadRequest(value),
43104                            _ => common::Error::Failure(response),
43105                        });
43106                    }
43107                    let response = {
43108                        let bytes = common::to_bytes(body).await.unwrap_or_default();
43109                        let encoded = common::to_string(&bytes);
43110                        match serde_json::from_str(&encoded) {
43111                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
43112                            Err(error) => {
43113                                dlg.response_json_decode_error(&encoded, &error);
43114                                return Err(common::Error::JsonDecodeError(
43115                                    encoded.to_string(),
43116                                    error,
43117                                ));
43118                            }
43119                        }
43120                    };
43121
43122                    dlg.finished(true);
43123                    return Ok(response);
43124                }
43125            }
43126        }
43127    }
43128
43129    ///
43130    /// Sets the *request* property to the given value.
43131    ///
43132    /// Even though the property as already been set when instantiating this call,
43133    /// we provide this method for API completeness.
43134    pub fn request(mut self, new_value: DirectorySite) -> DirectorySiteInsertCall<'a, C> {
43135        self._request = new_value;
43136        self
43137    }
43138    /// User profile ID associated with this request.
43139    ///
43140    /// Sets the *profile id* path property to the given value.
43141    ///
43142    /// Even though the property as already been set when instantiating this call,
43143    /// we provide this method for API completeness.
43144    pub fn profile_id(mut self, new_value: i64) -> DirectorySiteInsertCall<'a, C> {
43145        self._profile_id = new_value;
43146        self
43147    }
43148    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
43149    /// while executing the actual API request.
43150    ///
43151    /// ````text
43152    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
43153    /// ````
43154    ///
43155    /// Sets the *delegate* property to the given value.
43156    pub fn delegate(
43157        mut self,
43158        new_value: &'a mut dyn common::Delegate,
43159    ) -> DirectorySiteInsertCall<'a, C> {
43160        self._delegate = Some(new_value);
43161        self
43162    }
43163
43164    /// Set any additional parameter of the query string used in the request.
43165    /// It should be used to set parameters which are not yet available through their own
43166    /// setters.
43167    ///
43168    /// Please note that this method must not be used to set any of the known parameters
43169    /// which have their own setter method. If done anyway, the request will fail.
43170    ///
43171    /// # Additional Parameters
43172    ///
43173    /// * *$.xgafv* (query-string) - V1 error format.
43174    /// * *access_token* (query-string) - OAuth access token.
43175    /// * *alt* (query-string) - Data format for response.
43176    /// * *callback* (query-string) - JSONP
43177    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
43178    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
43179    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
43180    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
43181    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
43182    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
43183    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
43184    pub fn param<T>(mut self, name: T, value: T) -> DirectorySiteInsertCall<'a, C>
43185    where
43186        T: AsRef<str>,
43187    {
43188        self._additional_params
43189            .insert(name.as_ref().to_string(), value.as_ref().to_string());
43190        self
43191    }
43192
43193    /// Identifies the authorization scope for the method you are building.
43194    ///
43195    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
43196    /// [`Scope::Dfatrafficking`].
43197    ///
43198    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
43199    /// tokens for more than one scope.
43200    ///
43201    /// Usually there is more than one suitable scope to authorize an operation, some of which may
43202    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
43203    /// sufficient, a read-write scope will do as well.
43204    pub fn add_scope<St>(mut self, scope: St) -> DirectorySiteInsertCall<'a, C>
43205    where
43206        St: AsRef<str>,
43207    {
43208        self._scopes.insert(String::from(scope.as_ref()));
43209        self
43210    }
43211    /// Identifies the authorization scope(s) for the method you are building.
43212    ///
43213    /// See [`Self::add_scope()`] for details.
43214    pub fn add_scopes<I, St>(mut self, scopes: I) -> DirectorySiteInsertCall<'a, C>
43215    where
43216        I: IntoIterator<Item = St>,
43217        St: AsRef<str>,
43218    {
43219        self._scopes
43220            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
43221        self
43222    }
43223
43224    /// Removes all scopes, and no default scope will be used either.
43225    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
43226    /// for details).
43227    pub fn clear_scopes(mut self) -> DirectorySiteInsertCall<'a, C> {
43228        self._scopes.clear();
43229        self
43230    }
43231}
43232
43233/// Retrieves a list of directory sites, possibly filtered. This method supports paging.
43234///
43235/// A builder for the *list* method supported by a *directorySite* resource.
43236/// It is not used directly, but through a [`DirectorySiteMethods`] instance.
43237///
43238/// # Example
43239///
43240/// Instantiate a resource method builder
43241///
43242/// ```test_harness,no_run
43243/// # extern crate hyper;
43244/// # extern crate hyper_rustls;
43245/// # extern crate google_dfareporting3d3 as dfareporting3d3;
43246/// # async fn dox() {
43247/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
43248///
43249/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
43250/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
43251/// #     secret,
43252/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
43253/// # ).build().await.unwrap();
43254///
43255/// # let client = hyper_util::client::legacy::Client::builder(
43256/// #     hyper_util::rt::TokioExecutor::new()
43257/// # )
43258/// # .build(
43259/// #     hyper_rustls::HttpsConnectorBuilder::new()
43260/// #         .with_native_roots()
43261/// #         .unwrap()
43262/// #         .https_or_http()
43263/// #         .enable_http1()
43264/// #         .build()
43265/// # );
43266/// # let mut hub = Dfareporting::new(client, auth);
43267/// // You can configure optional parameters by calling the respective setters at will, and
43268/// // execute the final call using `doit()`.
43269/// // Values shown here are possibly random and not representative !
43270/// let result = hub.directory_sites().list(-21)
43271///              .sort_order("ea")
43272///              .sort_field("At")
43273///              .search_string("erat")
43274///              .page_token("clita")
43275///              .max_results(-76)
43276///              .add_ids(-88)
43277///              .dfp_network_code("nonumy")
43278///              .active(false)
43279///              .accepts_publisher_paid_placements(true)
43280///              .accepts_interstitial_placements(false)
43281///              .accepts_in_stream_video_placements(false)
43282///              .doit().await;
43283/// # }
43284/// ```
43285pub struct DirectorySiteListCall<'a, C>
43286where
43287    C: 'a,
43288{
43289    hub: &'a Dfareporting<C>,
43290    _profile_id: i64,
43291    _sort_order: Option<String>,
43292    _sort_field: Option<String>,
43293    _search_string: Option<String>,
43294    _page_token: Option<String>,
43295    _max_results: Option<i32>,
43296    _ids: Vec<i64>,
43297    _dfp_network_code: Option<String>,
43298    _active: Option<bool>,
43299    _accepts_publisher_paid_placements: Option<bool>,
43300    _accepts_interstitial_placements: Option<bool>,
43301    _accepts_in_stream_video_placements: Option<bool>,
43302    _delegate: Option<&'a mut dyn common::Delegate>,
43303    _additional_params: HashMap<String, String>,
43304    _scopes: BTreeSet<String>,
43305}
43306
43307impl<'a, C> common::CallBuilder for DirectorySiteListCall<'a, C> {}
43308
43309impl<'a, C> DirectorySiteListCall<'a, C>
43310where
43311    C: common::Connector,
43312{
43313    /// Perform the operation you have build so far.
43314    pub async fn doit(mut self) -> common::Result<(common::Response, DirectorySitesListResponse)> {
43315        use std::borrow::Cow;
43316        use std::io::{Read, Seek};
43317
43318        use common::{url::Params, ToParts};
43319        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
43320
43321        let mut dd = common::DefaultDelegate;
43322        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
43323        dlg.begin(common::MethodInfo {
43324            id: "dfareporting.directorySites.list",
43325            http_method: hyper::Method::GET,
43326        });
43327
43328        for &field in [
43329            "alt",
43330            "profileId",
43331            "sortOrder",
43332            "sortField",
43333            "searchString",
43334            "pageToken",
43335            "maxResults",
43336            "ids",
43337            "dfpNetworkCode",
43338            "active",
43339            "acceptsPublisherPaidPlacements",
43340            "acceptsInterstitialPlacements",
43341            "acceptsInStreamVideoPlacements",
43342        ]
43343        .iter()
43344        {
43345            if self._additional_params.contains_key(field) {
43346                dlg.finished(false);
43347                return Err(common::Error::FieldClash(field));
43348            }
43349        }
43350
43351        let mut params = Params::with_capacity(14 + self._additional_params.len());
43352        params.push("profileId", self._profile_id.to_string());
43353        if let Some(value) = self._sort_order.as_ref() {
43354            params.push("sortOrder", value);
43355        }
43356        if let Some(value) = self._sort_field.as_ref() {
43357            params.push("sortField", value);
43358        }
43359        if let Some(value) = self._search_string.as_ref() {
43360            params.push("searchString", value);
43361        }
43362        if let Some(value) = self._page_token.as_ref() {
43363            params.push("pageToken", value);
43364        }
43365        if let Some(value) = self._max_results.as_ref() {
43366            params.push("maxResults", value.to_string());
43367        }
43368        if !self._ids.is_empty() {
43369            for f in self._ids.iter() {
43370                params.push("ids", f.to_string());
43371            }
43372        }
43373        if let Some(value) = self._dfp_network_code.as_ref() {
43374            params.push("dfpNetworkCode", value);
43375        }
43376        if let Some(value) = self._active.as_ref() {
43377            params.push("active", value.to_string());
43378        }
43379        if let Some(value) = self._accepts_publisher_paid_placements.as_ref() {
43380            params.push("acceptsPublisherPaidPlacements", value.to_string());
43381        }
43382        if let Some(value) = self._accepts_interstitial_placements.as_ref() {
43383            params.push("acceptsInterstitialPlacements", value.to_string());
43384        }
43385        if let Some(value) = self._accepts_in_stream_video_placements.as_ref() {
43386            params.push("acceptsInStreamVideoPlacements", value.to_string());
43387        }
43388
43389        params.extend(self._additional_params.iter());
43390
43391        params.push("alt", "json");
43392        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/directorySites";
43393        if self._scopes.is_empty() {
43394            self._scopes
43395                .insert(Scope::Dfatrafficking.as_ref().to_string());
43396        }
43397
43398        #[allow(clippy::single_element_loop)]
43399        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
43400            url = params.uri_replacement(url, param_name, find_this, false);
43401        }
43402        {
43403            let to_remove = ["profileId"];
43404            params.remove_params(&to_remove);
43405        }
43406
43407        let url = params.parse_with_url(&url);
43408
43409        loop {
43410            let token = match self
43411                .hub
43412                .auth
43413                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
43414                .await
43415            {
43416                Ok(token) => token,
43417                Err(e) => match dlg.token(e) {
43418                    Ok(token) => token,
43419                    Err(e) => {
43420                        dlg.finished(false);
43421                        return Err(common::Error::MissingToken(e));
43422                    }
43423                },
43424            };
43425            let mut req_result = {
43426                let client = &self.hub.client;
43427                dlg.pre_request();
43428                let mut req_builder = hyper::Request::builder()
43429                    .method(hyper::Method::GET)
43430                    .uri(url.as_str())
43431                    .header(USER_AGENT, self.hub._user_agent.clone());
43432
43433                if let Some(token) = token.as_ref() {
43434                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
43435                }
43436
43437                let request = req_builder
43438                    .header(CONTENT_LENGTH, 0_u64)
43439                    .body(common::to_body::<String>(None));
43440
43441                client.request(request.unwrap()).await
43442            };
43443
43444            match req_result {
43445                Err(err) => {
43446                    if let common::Retry::After(d) = dlg.http_error(&err) {
43447                        sleep(d).await;
43448                        continue;
43449                    }
43450                    dlg.finished(false);
43451                    return Err(common::Error::HttpError(err));
43452                }
43453                Ok(res) => {
43454                    let (mut parts, body) = res.into_parts();
43455                    let mut body = common::Body::new(body);
43456                    if !parts.status.is_success() {
43457                        let bytes = common::to_bytes(body).await.unwrap_or_default();
43458                        let error = serde_json::from_str(&common::to_string(&bytes));
43459                        let response = common::to_response(parts, bytes.into());
43460
43461                        if let common::Retry::After(d) =
43462                            dlg.http_failure(&response, error.as_ref().ok())
43463                        {
43464                            sleep(d).await;
43465                            continue;
43466                        }
43467
43468                        dlg.finished(false);
43469
43470                        return Err(match error {
43471                            Ok(value) => common::Error::BadRequest(value),
43472                            _ => common::Error::Failure(response),
43473                        });
43474                    }
43475                    let response = {
43476                        let bytes = common::to_bytes(body).await.unwrap_or_default();
43477                        let encoded = common::to_string(&bytes);
43478                        match serde_json::from_str(&encoded) {
43479                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
43480                            Err(error) => {
43481                                dlg.response_json_decode_error(&encoded, &error);
43482                                return Err(common::Error::JsonDecodeError(
43483                                    encoded.to_string(),
43484                                    error,
43485                                ));
43486                            }
43487                        }
43488                    };
43489
43490                    dlg.finished(true);
43491                    return Ok(response);
43492                }
43493            }
43494        }
43495    }
43496
43497    /// User profile ID associated with this request.
43498    ///
43499    /// Sets the *profile id* path property to the given value.
43500    ///
43501    /// Even though the property as already been set when instantiating this call,
43502    /// we provide this method for API completeness.
43503    pub fn profile_id(mut self, new_value: i64) -> DirectorySiteListCall<'a, C> {
43504        self._profile_id = new_value;
43505        self
43506    }
43507    /// Order of sorted results.
43508    ///
43509    /// Sets the *sort order* query property to the given value.
43510    pub fn sort_order(mut self, new_value: &str) -> DirectorySiteListCall<'a, C> {
43511        self._sort_order = Some(new_value.to_string());
43512        self
43513    }
43514    /// Field by which to sort the list.
43515    ///
43516    /// Sets the *sort field* query property to the given value.
43517    pub fn sort_field(mut self, new_value: &str) -> DirectorySiteListCall<'a, C> {
43518        self._sort_field = Some(new_value.to_string());
43519        self
43520    }
43521    /// Allows searching for objects by name, ID or URL. Wildcards (*) are allowed. For example, "directory site*2015" will return objects with names like "directory site June 2015", "directory site April 2015", or simply "directory site 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "directory site" will match objects with name "my directory site", "directory site 2015" or simply, "directory site".
43522    ///
43523    /// Sets the *search string* query property to the given value.
43524    pub fn search_string(mut self, new_value: &str) -> DirectorySiteListCall<'a, C> {
43525        self._search_string = Some(new_value.to_string());
43526        self
43527    }
43528    /// Value of the nextPageToken from the previous result page.
43529    ///
43530    /// Sets the *page token* query property to the given value.
43531    pub fn page_token(mut self, new_value: &str) -> DirectorySiteListCall<'a, C> {
43532        self._page_token = Some(new_value.to_string());
43533        self
43534    }
43535    /// Maximum number of results to return.
43536    ///
43537    /// Sets the *max results* query property to the given value.
43538    pub fn max_results(mut self, new_value: i32) -> DirectorySiteListCall<'a, C> {
43539        self._max_results = Some(new_value);
43540        self
43541    }
43542    /// Select only directory sites with these IDs.
43543    ///
43544    /// Append the given value to the *ids* query property.
43545    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
43546    pub fn add_ids(mut self, new_value: i64) -> DirectorySiteListCall<'a, C> {
43547        self._ids.push(new_value);
43548        self
43549    }
43550    /// Select only directory sites with this Ad Manager network code.
43551    ///
43552    /// Sets the *dfp network code* query property to the given value.
43553    pub fn dfp_network_code(mut self, new_value: &str) -> DirectorySiteListCall<'a, C> {
43554        self._dfp_network_code = Some(new_value.to_string());
43555        self
43556    }
43557    /// Select only active directory sites. Leave blank to retrieve both active and inactive directory sites.
43558    ///
43559    /// Sets the *active* query property to the given value.
43560    pub fn active(mut self, new_value: bool) -> DirectorySiteListCall<'a, C> {
43561        self._active = Some(new_value);
43562        self
43563    }
43564    /// Select only directory sites that accept publisher paid placements. This field can be left blank.
43565    ///
43566    /// Sets the *accepts publisher paid placements* query property to the given value.
43567    pub fn accepts_publisher_paid_placements(
43568        mut self,
43569        new_value: bool,
43570    ) -> DirectorySiteListCall<'a, C> {
43571        self._accepts_publisher_paid_placements = Some(new_value);
43572        self
43573    }
43574    /// This search filter is no longer supported and will have no effect on the results returned.
43575    ///
43576    /// Sets the *accepts interstitial placements* query property to the given value.
43577    pub fn accepts_interstitial_placements(
43578        mut self,
43579        new_value: bool,
43580    ) -> DirectorySiteListCall<'a, C> {
43581        self._accepts_interstitial_placements = Some(new_value);
43582        self
43583    }
43584    /// This search filter is no longer supported and will have no effect on the results returned.
43585    ///
43586    /// Sets the *accepts in stream video placements* query property to the given value.
43587    pub fn accepts_in_stream_video_placements(
43588        mut self,
43589        new_value: bool,
43590    ) -> DirectorySiteListCall<'a, C> {
43591        self._accepts_in_stream_video_placements = Some(new_value);
43592        self
43593    }
43594    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
43595    /// while executing the actual API request.
43596    ///
43597    /// ````text
43598    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
43599    /// ````
43600    ///
43601    /// Sets the *delegate* property to the given value.
43602    pub fn delegate(
43603        mut self,
43604        new_value: &'a mut dyn common::Delegate,
43605    ) -> DirectorySiteListCall<'a, C> {
43606        self._delegate = Some(new_value);
43607        self
43608    }
43609
43610    /// Set any additional parameter of the query string used in the request.
43611    /// It should be used to set parameters which are not yet available through their own
43612    /// setters.
43613    ///
43614    /// Please note that this method must not be used to set any of the known parameters
43615    /// which have their own setter method. If done anyway, the request will fail.
43616    ///
43617    /// # Additional Parameters
43618    ///
43619    /// * *$.xgafv* (query-string) - V1 error format.
43620    /// * *access_token* (query-string) - OAuth access token.
43621    /// * *alt* (query-string) - Data format for response.
43622    /// * *callback* (query-string) - JSONP
43623    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
43624    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
43625    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
43626    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
43627    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
43628    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
43629    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
43630    pub fn param<T>(mut self, name: T, value: T) -> DirectorySiteListCall<'a, C>
43631    where
43632        T: AsRef<str>,
43633    {
43634        self._additional_params
43635            .insert(name.as_ref().to_string(), value.as_ref().to_string());
43636        self
43637    }
43638
43639    /// Identifies the authorization scope for the method you are building.
43640    ///
43641    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
43642    /// [`Scope::Dfatrafficking`].
43643    ///
43644    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
43645    /// tokens for more than one scope.
43646    ///
43647    /// Usually there is more than one suitable scope to authorize an operation, some of which may
43648    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
43649    /// sufficient, a read-write scope will do as well.
43650    pub fn add_scope<St>(mut self, scope: St) -> DirectorySiteListCall<'a, C>
43651    where
43652        St: AsRef<str>,
43653    {
43654        self._scopes.insert(String::from(scope.as_ref()));
43655        self
43656    }
43657    /// Identifies the authorization scope(s) for the method you are building.
43658    ///
43659    /// See [`Self::add_scope()`] for details.
43660    pub fn add_scopes<I, St>(mut self, scopes: I) -> DirectorySiteListCall<'a, C>
43661    where
43662        I: IntoIterator<Item = St>,
43663        St: AsRef<str>,
43664    {
43665        self._scopes
43666            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
43667        self
43668    }
43669
43670    /// Removes all scopes, and no default scope will be used either.
43671    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
43672    /// for details).
43673    pub fn clear_scopes(mut self) -> DirectorySiteListCall<'a, C> {
43674        self._scopes.clear();
43675        self
43676    }
43677}
43678
43679/// Deletes an existing dynamic targeting key.
43680///
43681/// A builder for the *delete* method supported by a *dynamicTargetingKey* resource.
43682/// It is not used directly, but through a [`DynamicTargetingKeyMethods`] instance.
43683///
43684/// # Example
43685///
43686/// Instantiate a resource method builder
43687///
43688/// ```test_harness,no_run
43689/// # extern crate hyper;
43690/// # extern crate hyper_rustls;
43691/// # extern crate google_dfareporting3d3 as dfareporting3d3;
43692/// # async fn dox() {
43693/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
43694///
43695/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
43696/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
43697/// #     secret,
43698/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
43699/// # ).build().await.unwrap();
43700///
43701/// # let client = hyper_util::client::legacy::Client::builder(
43702/// #     hyper_util::rt::TokioExecutor::new()
43703/// # )
43704/// # .build(
43705/// #     hyper_rustls::HttpsConnectorBuilder::new()
43706/// #         .with_native_roots()
43707/// #         .unwrap()
43708/// #         .https_or_http()
43709/// #         .enable_http1()
43710/// #         .build()
43711/// # );
43712/// # let mut hub = Dfareporting::new(client, auth);
43713/// // You can configure optional parameters by calling the respective setters at will, and
43714/// // execute the final call using `doit()`.
43715/// // Values shown here are possibly random and not representative !
43716/// let result = hub.dynamic_targeting_keys().delete(-46, -72, "name", "objectType")
43717///              .doit().await;
43718/// # }
43719/// ```
43720pub struct DynamicTargetingKeyDeleteCall<'a, C>
43721where
43722    C: 'a,
43723{
43724    hub: &'a Dfareporting<C>,
43725    _profile_id: i64,
43726    _object_id: i64,
43727    _name: String,
43728    _object_type: String,
43729    _delegate: Option<&'a mut dyn common::Delegate>,
43730    _additional_params: HashMap<String, String>,
43731    _scopes: BTreeSet<String>,
43732}
43733
43734impl<'a, C> common::CallBuilder for DynamicTargetingKeyDeleteCall<'a, C> {}
43735
43736impl<'a, C> DynamicTargetingKeyDeleteCall<'a, C>
43737where
43738    C: common::Connector,
43739{
43740    /// Perform the operation you have build so far.
43741    pub async fn doit(mut self) -> common::Result<common::Response> {
43742        use std::borrow::Cow;
43743        use std::io::{Read, Seek};
43744
43745        use common::{url::Params, ToParts};
43746        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
43747
43748        let mut dd = common::DefaultDelegate;
43749        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
43750        dlg.begin(common::MethodInfo {
43751            id: "dfareporting.dynamicTargetingKeys.delete",
43752            http_method: hyper::Method::DELETE,
43753        });
43754
43755        for &field in ["profileId", "objectId", "name", "objectType"].iter() {
43756            if self._additional_params.contains_key(field) {
43757                dlg.finished(false);
43758                return Err(common::Error::FieldClash(field));
43759            }
43760        }
43761
43762        let mut params = Params::with_capacity(5 + self._additional_params.len());
43763        params.push("profileId", self._profile_id.to_string());
43764        params.push("objectId", self._object_id.to_string());
43765        params.push("name", self._name);
43766        params.push("objectType", self._object_type);
43767
43768        params.extend(self._additional_params.iter());
43769
43770        let mut url =
43771            self.hub._base_url.clone() + "userprofiles/{profileId}/dynamicTargetingKeys/{objectId}";
43772        if self._scopes.is_empty() {
43773            self._scopes
43774                .insert(Scope::Dfatrafficking.as_ref().to_string());
43775        }
43776
43777        #[allow(clippy::single_element_loop)]
43778        for &(find_this, param_name) in
43779            [("{profileId}", "profileId"), ("{objectId}", "objectId")].iter()
43780        {
43781            url = params.uri_replacement(url, param_name, find_this, false);
43782        }
43783        {
43784            let to_remove = ["objectId", "profileId"];
43785            params.remove_params(&to_remove);
43786        }
43787
43788        let url = params.parse_with_url(&url);
43789
43790        loop {
43791            let token = match self
43792                .hub
43793                .auth
43794                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
43795                .await
43796            {
43797                Ok(token) => token,
43798                Err(e) => match dlg.token(e) {
43799                    Ok(token) => token,
43800                    Err(e) => {
43801                        dlg.finished(false);
43802                        return Err(common::Error::MissingToken(e));
43803                    }
43804                },
43805            };
43806            let mut req_result = {
43807                let client = &self.hub.client;
43808                dlg.pre_request();
43809                let mut req_builder = hyper::Request::builder()
43810                    .method(hyper::Method::DELETE)
43811                    .uri(url.as_str())
43812                    .header(USER_AGENT, self.hub._user_agent.clone());
43813
43814                if let Some(token) = token.as_ref() {
43815                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
43816                }
43817
43818                let request = req_builder
43819                    .header(CONTENT_LENGTH, 0_u64)
43820                    .body(common::to_body::<String>(None));
43821
43822                client.request(request.unwrap()).await
43823            };
43824
43825            match req_result {
43826                Err(err) => {
43827                    if let common::Retry::After(d) = dlg.http_error(&err) {
43828                        sleep(d).await;
43829                        continue;
43830                    }
43831                    dlg.finished(false);
43832                    return Err(common::Error::HttpError(err));
43833                }
43834                Ok(res) => {
43835                    let (mut parts, body) = res.into_parts();
43836                    let mut body = common::Body::new(body);
43837                    if !parts.status.is_success() {
43838                        let bytes = common::to_bytes(body).await.unwrap_or_default();
43839                        let error = serde_json::from_str(&common::to_string(&bytes));
43840                        let response = common::to_response(parts, bytes.into());
43841
43842                        if let common::Retry::After(d) =
43843                            dlg.http_failure(&response, error.as_ref().ok())
43844                        {
43845                            sleep(d).await;
43846                            continue;
43847                        }
43848
43849                        dlg.finished(false);
43850
43851                        return Err(match error {
43852                            Ok(value) => common::Error::BadRequest(value),
43853                            _ => common::Error::Failure(response),
43854                        });
43855                    }
43856                    let response = common::Response::from_parts(parts, body);
43857
43858                    dlg.finished(true);
43859                    return Ok(response);
43860                }
43861            }
43862        }
43863    }
43864
43865    /// User profile ID associated with this request.
43866    ///
43867    /// Sets the *profile id* path property to the given value.
43868    ///
43869    /// Even though the property as already been set when instantiating this call,
43870    /// we provide this method for API completeness.
43871    pub fn profile_id(mut self, new_value: i64) -> DynamicTargetingKeyDeleteCall<'a, C> {
43872        self._profile_id = new_value;
43873        self
43874    }
43875    /// ID of the object of this dynamic targeting key. This is a required field.
43876    ///
43877    /// Sets the *object id* path property to the given value.
43878    ///
43879    /// Even though the property as already been set when instantiating this call,
43880    /// we provide this method for API completeness.
43881    pub fn object_id(mut self, new_value: i64) -> DynamicTargetingKeyDeleteCall<'a, C> {
43882        self._object_id = new_value;
43883        self
43884    }
43885    /// Name of this dynamic targeting key. This is a required field. Must be less than 256 characters long and cannot contain commas. All characters are converted to lowercase.
43886    ///
43887    /// Sets the *name* query property to the given value.
43888    ///
43889    /// Even though the property as already been set when instantiating this call,
43890    /// we provide this method for API completeness.
43891    pub fn name(mut self, new_value: &str) -> DynamicTargetingKeyDeleteCall<'a, C> {
43892        self._name = new_value.to_string();
43893        self
43894    }
43895    /// Type of the object of this dynamic targeting key. This is a required field.
43896    ///
43897    /// Sets the *object type* query property to the given value.
43898    ///
43899    /// Even though the property as already been set when instantiating this call,
43900    /// we provide this method for API completeness.
43901    pub fn object_type(mut self, new_value: &str) -> DynamicTargetingKeyDeleteCall<'a, C> {
43902        self._object_type = new_value.to_string();
43903        self
43904    }
43905    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
43906    /// while executing the actual API request.
43907    ///
43908    /// ````text
43909    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
43910    /// ````
43911    ///
43912    /// Sets the *delegate* property to the given value.
43913    pub fn delegate(
43914        mut self,
43915        new_value: &'a mut dyn common::Delegate,
43916    ) -> DynamicTargetingKeyDeleteCall<'a, C> {
43917        self._delegate = Some(new_value);
43918        self
43919    }
43920
43921    /// Set any additional parameter of the query string used in the request.
43922    /// It should be used to set parameters which are not yet available through their own
43923    /// setters.
43924    ///
43925    /// Please note that this method must not be used to set any of the known parameters
43926    /// which have their own setter method. If done anyway, the request will fail.
43927    ///
43928    /// # Additional Parameters
43929    ///
43930    /// * *$.xgafv* (query-string) - V1 error format.
43931    /// * *access_token* (query-string) - OAuth access token.
43932    /// * *alt* (query-string) - Data format for response.
43933    /// * *callback* (query-string) - JSONP
43934    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
43935    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
43936    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
43937    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
43938    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
43939    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
43940    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
43941    pub fn param<T>(mut self, name: T, value: T) -> DynamicTargetingKeyDeleteCall<'a, C>
43942    where
43943        T: AsRef<str>,
43944    {
43945        self._additional_params
43946            .insert(name.as_ref().to_string(), value.as_ref().to_string());
43947        self
43948    }
43949
43950    /// Identifies the authorization scope for the method you are building.
43951    ///
43952    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
43953    /// [`Scope::Dfatrafficking`].
43954    ///
43955    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
43956    /// tokens for more than one scope.
43957    ///
43958    /// Usually there is more than one suitable scope to authorize an operation, some of which may
43959    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
43960    /// sufficient, a read-write scope will do as well.
43961    pub fn add_scope<St>(mut self, scope: St) -> DynamicTargetingKeyDeleteCall<'a, C>
43962    where
43963        St: AsRef<str>,
43964    {
43965        self._scopes.insert(String::from(scope.as_ref()));
43966        self
43967    }
43968    /// Identifies the authorization scope(s) for the method you are building.
43969    ///
43970    /// See [`Self::add_scope()`] for details.
43971    pub fn add_scopes<I, St>(mut self, scopes: I) -> DynamicTargetingKeyDeleteCall<'a, C>
43972    where
43973        I: IntoIterator<Item = St>,
43974        St: AsRef<str>,
43975    {
43976        self._scopes
43977            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
43978        self
43979    }
43980
43981    /// Removes all scopes, and no default scope will be used either.
43982    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
43983    /// for details).
43984    pub fn clear_scopes(mut self) -> DynamicTargetingKeyDeleteCall<'a, C> {
43985        self._scopes.clear();
43986        self
43987    }
43988}
43989
43990/// Inserts a new dynamic targeting key. Keys must be created at the advertiser level before being assigned to the advertiser's ads, creatives, or placements. There is a maximum of 1000 keys per advertiser, out of which a maximum of 20 keys can be assigned per ad, creative, or placement.
43991///
43992/// A builder for the *insert* method supported by a *dynamicTargetingKey* resource.
43993/// It is not used directly, but through a [`DynamicTargetingKeyMethods`] instance.
43994///
43995/// # Example
43996///
43997/// Instantiate a resource method builder
43998///
43999/// ```test_harness,no_run
44000/// # extern crate hyper;
44001/// # extern crate hyper_rustls;
44002/// # extern crate google_dfareporting3d3 as dfareporting3d3;
44003/// use dfareporting3d3::api::DynamicTargetingKey;
44004/// # async fn dox() {
44005/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
44006///
44007/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
44008/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
44009/// #     secret,
44010/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
44011/// # ).build().await.unwrap();
44012///
44013/// # let client = hyper_util::client::legacy::Client::builder(
44014/// #     hyper_util::rt::TokioExecutor::new()
44015/// # )
44016/// # .build(
44017/// #     hyper_rustls::HttpsConnectorBuilder::new()
44018/// #         .with_native_roots()
44019/// #         .unwrap()
44020/// #         .https_or_http()
44021/// #         .enable_http1()
44022/// #         .build()
44023/// # );
44024/// # let mut hub = Dfareporting::new(client, auth);
44025/// // As the method needs a request, you would usually fill it with the desired information
44026/// // into the respective structure. Some of the parts shown here might not be applicable !
44027/// // Values shown here are possibly random and not representative !
44028/// let mut req = DynamicTargetingKey::default();
44029///
44030/// // You can configure optional parameters by calling the respective setters at will, and
44031/// // execute the final call using `doit()`.
44032/// // Values shown here are possibly random and not representative !
44033/// let result = hub.dynamic_targeting_keys().insert(req, -59)
44034///              .doit().await;
44035/// # }
44036/// ```
44037pub struct DynamicTargetingKeyInsertCall<'a, C>
44038where
44039    C: 'a,
44040{
44041    hub: &'a Dfareporting<C>,
44042    _request: DynamicTargetingKey,
44043    _profile_id: i64,
44044    _delegate: Option<&'a mut dyn common::Delegate>,
44045    _additional_params: HashMap<String, String>,
44046    _scopes: BTreeSet<String>,
44047}
44048
44049impl<'a, C> common::CallBuilder for DynamicTargetingKeyInsertCall<'a, C> {}
44050
44051impl<'a, C> DynamicTargetingKeyInsertCall<'a, C>
44052where
44053    C: common::Connector,
44054{
44055    /// Perform the operation you have build so far.
44056    pub async fn doit(mut self) -> common::Result<(common::Response, DynamicTargetingKey)> {
44057        use std::borrow::Cow;
44058        use std::io::{Read, Seek};
44059
44060        use common::{url::Params, ToParts};
44061        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
44062
44063        let mut dd = common::DefaultDelegate;
44064        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
44065        dlg.begin(common::MethodInfo {
44066            id: "dfareporting.dynamicTargetingKeys.insert",
44067            http_method: hyper::Method::POST,
44068        });
44069
44070        for &field in ["alt", "profileId"].iter() {
44071            if self._additional_params.contains_key(field) {
44072                dlg.finished(false);
44073                return Err(common::Error::FieldClash(field));
44074            }
44075        }
44076
44077        let mut params = Params::with_capacity(4 + self._additional_params.len());
44078        params.push("profileId", self._profile_id.to_string());
44079
44080        params.extend(self._additional_params.iter());
44081
44082        params.push("alt", "json");
44083        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/dynamicTargetingKeys";
44084        if self._scopes.is_empty() {
44085            self._scopes
44086                .insert(Scope::Dfatrafficking.as_ref().to_string());
44087        }
44088
44089        #[allow(clippy::single_element_loop)]
44090        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
44091            url = params.uri_replacement(url, param_name, find_this, false);
44092        }
44093        {
44094            let to_remove = ["profileId"];
44095            params.remove_params(&to_remove);
44096        }
44097
44098        let url = params.parse_with_url(&url);
44099
44100        let mut json_mime_type = mime::APPLICATION_JSON;
44101        let mut request_value_reader = {
44102            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
44103            common::remove_json_null_values(&mut value);
44104            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
44105            serde_json::to_writer(&mut dst, &value).unwrap();
44106            dst
44107        };
44108        let request_size = request_value_reader
44109            .seek(std::io::SeekFrom::End(0))
44110            .unwrap();
44111        request_value_reader
44112            .seek(std::io::SeekFrom::Start(0))
44113            .unwrap();
44114
44115        loop {
44116            let token = match self
44117                .hub
44118                .auth
44119                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
44120                .await
44121            {
44122                Ok(token) => token,
44123                Err(e) => match dlg.token(e) {
44124                    Ok(token) => token,
44125                    Err(e) => {
44126                        dlg.finished(false);
44127                        return Err(common::Error::MissingToken(e));
44128                    }
44129                },
44130            };
44131            request_value_reader
44132                .seek(std::io::SeekFrom::Start(0))
44133                .unwrap();
44134            let mut req_result = {
44135                let client = &self.hub.client;
44136                dlg.pre_request();
44137                let mut req_builder = hyper::Request::builder()
44138                    .method(hyper::Method::POST)
44139                    .uri(url.as_str())
44140                    .header(USER_AGENT, self.hub._user_agent.clone());
44141
44142                if let Some(token) = token.as_ref() {
44143                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
44144                }
44145
44146                let request = req_builder
44147                    .header(CONTENT_TYPE, json_mime_type.to_string())
44148                    .header(CONTENT_LENGTH, request_size as u64)
44149                    .body(common::to_body(
44150                        request_value_reader.get_ref().clone().into(),
44151                    ));
44152
44153                client.request(request.unwrap()).await
44154            };
44155
44156            match req_result {
44157                Err(err) => {
44158                    if let common::Retry::After(d) = dlg.http_error(&err) {
44159                        sleep(d).await;
44160                        continue;
44161                    }
44162                    dlg.finished(false);
44163                    return Err(common::Error::HttpError(err));
44164                }
44165                Ok(res) => {
44166                    let (mut parts, body) = res.into_parts();
44167                    let mut body = common::Body::new(body);
44168                    if !parts.status.is_success() {
44169                        let bytes = common::to_bytes(body).await.unwrap_or_default();
44170                        let error = serde_json::from_str(&common::to_string(&bytes));
44171                        let response = common::to_response(parts, bytes.into());
44172
44173                        if let common::Retry::After(d) =
44174                            dlg.http_failure(&response, error.as_ref().ok())
44175                        {
44176                            sleep(d).await;
44177                            continue;
44178                        }
44179
44180                        dlg.finished(false);
44181
44182                        return Err(match error {
44183                            Ok(value) => common::Error::BadRequest(value),
44184                            _ => common::Error::Failure(response),
44185                        });
44186                    }
44187                    let response = {
44188                        let bytes = common::to_bytes(body).await.unwrap_or_default();
44189                        let encoded = common::to_string(&bytes);
44190                        match serde_json::from_str(&encoded) {
44191                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
44192                            Err(error) => {
44193                                dlg.response_json_decode_error(&encoded, &error);
44194                                return Err(common::Error::JsonDecodeError(
44195                                    encoded.to_string(),
44196                                    error,
44197                                ));
44198                            }
44199                        }
44200                    };
44201
44202                    dlg.finished(true);
44203                    return Ok(response);
44204                }
44205            }
44206        }
44207    }
44208
44209    ///
44210    /// Sets the *request* property to the given value.
44211    ///
44212    /// Even though the property as already been set when instantiating this call,
44213    /// we provide this method for API completeness.
44214    pub fn request(
44215        mut self,
44216        new_value: DynamicTargetingKey,
44217    ) -> DynamicTargetingKeyInsertCall<'a, C> {
44218        self._request = new_value;
44219        self
44220    }
44221    /// User profile ID associated with this request.
44222    ///
44223    /// Sets the *profile id* path property to the given value.
44224    ///
44225    /// Even though the property as already been set when instantiating this call,
44226    /// we provide this method for API completeness.
44227    pub fn profile_id(mut self, new_value: i64) -> DynamicTargetingKeyInsertCall<'a, C> {
44228        self._profile_id = new_value;
44229        self
44230    }
44231    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
44232    /// while executing the actual API request.
44233    ///
44234    /// ````text
44235    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
44236    /// ````
44237    ///
44238    /// Sets the *delegate* property to the given value.
44239    pub fn delegate(
44240        mut self,
44241        new_value: &'a mut dyn common::Delegate,
44242    ) -> DynamicTargetingKeyInsertCall<'a, C> {
44243        self._delegate = Some(new_value);
44244        self
44245    }
44246
44247    /// Set any additional parameter of the query string used in the request.
44248    /// It should be used to set parameters which are not yet available through their own
44249    /// setters.
44250    ///
44251    /// Please note that this method must not be used to set any of the known parameters
44252    /// which have their own setter method. If done anyway, the request will fail.
44253    ///
44254    /// # Additional Parameters
44255    ///
44256    /// * *$.xgafv* (query-string) - V1 error format.
44257    /// * *access_token* (query-string) - OAuth access token.
44258    /// * *alt* (query-string) - Data format for response.
44259    /// * *callback* (query-string) - JSONP
44260    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
44261    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
44262    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
44263    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
44264    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
44265    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
44266    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
44267    pub fn param<T>(mut self, name: T, value: T) -> DynamicTargetingKeyInsertCall<'a, C>
44268    where
44269        T: AsRef<str>,
44270    {
44271        self._additional_params
44272            .insert(name.as_ref().to_string(), value.as_ref().to_string());
44273        self
44274    }
44275
44276    /// Identifies the authorization scope for the method you are building.
44277    ///
44278    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
44279    /// [`Scope::Dfatrafficking`].
44280    ///
44281    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
44282    /// tokens for more than one scope.
44283    ///
44284    /// Usually there is more than one suitable scope to authorize an operation, some of which may
44285    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
44286    /// sufficient, a read-write scope will do as well.
44287    pub fn add_scope<St>(mut self, scope: St) -> DynamicTargetingKeyInsertCall<'a, C>
44288    where
44289        St: AsRef<str>,
44290    {
44291        self._scopes.insert(String::from(scope.as_ref()));
44292        self
44293    }
44294    /// Identifies the authorization scope(s) for the method you are building.
44295    ///
44296    /// See [`Self::add_scope()`] for details.
44297    pub fn add_scopes<I, St>(mut self, scopes: I) -> DynamicTargetingKeyInsertCall<'a, C>
44298    where
44299        I: IntoIterator<Item = St>,
44300        St: AsRef<str>,
44301    {
44302        self._scopes
44303            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
44304        self
44305    }
44306
44307    /// Removes all scopes, and no default scope will be used either.
44308    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
44309    /// for details).
44310    pub fn clear_scopes(mut self) -> DynamicTargetingKeyInsertCall<'a, C> {
44311        self._scopes.clear();
44312        self
44313    }
44314}
44315
44316/// Retrieves a list of dynamic targeting keys.
44317///
44318/// A builder for the *list* method supported by a *dynamicTargetingKey* resource.
44319/// It is not used directly, but through a [`DynamicTargetingKeyMethods`] instance.
44320///
44321/// # Example
44322///
44323/// Instantiate a resource method builder
44324///
44325/// ```test_harness,no_run
44326/// # extern crate hyper;
44327/// # extern crate hyper_rustls;
44328/// # extern crate google_dfareporting3d3 as dfareporting3d3;
44329/// # async fn dox() {
44330/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
44331///
44332/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
44333/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
44334/// #     secret,
44335/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
44336/// # ).build().await.unwrap();
44337///
44338/// # let client = hyper_util::client::legacy::Client::builder(
44339/// #     hyper_util::rt::TokioExecutor::new()
44340/// # )
44341/// # .build(
44342/// #     hyper_rustls::HttpsConnectorBuilder::new()
44343/// #         .with_native_roots()
44344/// #         .unwrap()
44345/// #         .https_or_http()
44346/// #         .enable_http1()
44347/// #         .build()
44348/// # );
44349/// # let mut hub = Dfareporting::new(client, auth);
44350/// // You can configure optional parameters by calling the respective setters at will, and
44351/// // execute the final call using `doit()`.
44352/// // Values shown here are possibly random and not representative !
44353/// let result = hub.dynamic_targeting_keys().list(-31)
44354///              .object_type("diam")
44355///              .object_id(-41)
44356///              .add_names("Lorem")
44357///              .advertiser_id(-77)
44358///              .doit().await;
44359/// # }
44360/// ```
44361pub struct DynamicTargetingKeyListCall<'a, C>
44362where
44363    C: 'a,
44364{
44365    hub: &'a Dfareporting<C>,
44366    _profile_id: i64,
44367    _object_type: Option<String>,
44368    _object_id: Option<i64>,
44369    _names: Vec<String>,
44370    _advertiser_id: Option<i64>,
44371    _delegate: Option<&'a mut dyn common::Delegate>,
44372    _additional_params: HashMap<String, String>,
44373    _scopes: BTreeSet<String>,
44374}
44375
44376impl<'a, C> common::CallBuilder for DynamicTargetingKeyListCall<'a, C> {}
44377
44378impl<'a, C> DynamicTargetingKeyListCall<'a, C>
44379where
44380    C: common::Connector,
44381{
44382    /// Perform the operation you have build so far.
44383    pub async fn doit(
44384        mut self,
44385    ) -> common::Result<(common::Response, DynamicTargetingKeysListResponse)> {
44386        use std::borrow::Cow;
44387        use std::io::{Read, Seek};
44388
44389        use common::{url::Params, ToParts};
44390        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
44391
44392        let mut dd = common::DefaultDelegate;
44393        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
44394        dlg.begin(common::MethodInfo {
44395            id: "dfareporting.dynamicTargetingKeys.list",
44396            http_method: hyper::Method::GET,
44397        });
44398
44399        for &field in [
44400            "alt",
44401            "profileId",
44402            "objectType",
44403            "objectId",
44404            "names",
44405            "advertiserId",
44406        ]
44407        .iter()
44408        {
44409            if self._additional_params.contains_key(field) {
44410                dlg.finished(false);
44411                return Err(common::Error::FieldClash(field));
44412            }
44413        }
44414
44415        let mut params = Params::with_capacity(7 + self._additional_params.len());
44416        params.push("profileId", self._profile_id.to_string());
44417        if let Some(value) = self._object_type.as_ref() {
44418            params.push("objectType", value);
44419        }
44420        if let Some(value) = self._object_id.as_ref() {
44421            params.push("objectId", value.to_string());
44422        }
44423        if !self._names.is_empty() {
44424            for f in self._names.iter() {
44425                params.push("names", f);
44426            }
44427        }
44428        if let Some(value) = self._advertiser_id.as_ref() {
44429            params.push("advertiserId", value.to_string());
44430        }
44431
44432        params.extend(self._additional_params.iter());
44433
44434        params.push("alt", "json");
44435        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/dynamicTargetingKeys";
44436        if self._scopes.is_empty() {
44437            self._scopes
44438                .insert(Scope::Dfatrafficking.as_ref().to_string());
44439        }
44440
44441        #[allow(clippy::single_element_loop)]
44442        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
44443            url = params.uri_replacement(url, param_name, find_this, false);
44444        }
44445        {
44446            let to_remove = ["profileId"];
44447            params.remove_params(&to_remove);
44448        }
44449
44450        let url = params.parse_with_url(&url);
44451
44452        loop {
44453            let token = match self
44454                .hub
44455                .auth
44456                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
44457                .await
44458            {
44459                Ok(token) => token,
44460                Err(e) => match dlg.token(e) {
44461                    Ok(token) => token,
44462                    Err(e) => {
44463                        dlg.finished(false);
44464                        return Err(common::Error::MissingToken(e));
44465                    }
44466                },
44467            };
44468            let mut req_result = {
44469                let client = &self.hub.client;
44470                dlg.pre_request();
44471                let mut req_builder = hyper::Request::builder()
44472                    .method(hyper::Method::GET)
44473                    .uri(url.as_str())
44474                    .header(USER_AGENT, self.hub._user_agent.clone());
44475
44476                if let Some(token) = token.as_ref() {
44477                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
44478                }
44479
44480                let request = req_builder
44481                    .header(CONTENT_LENGTH, 0_u64)
44482                    .body(common::to_body::<String>(None));
44483
44484                client.request(request.unwrap()).await
44485            };
44486
44487            match req_result {
44488                Err(err) => {
44489                    if let common::Retry::After(d) = dlg.http_error(&err) {
44490                        sleep(d).await;
44491                        continue;
44492                    }
44493                    dlg.finished(false);
44494                    return Err(common::Error::HttpError(err));
44495                }
44496                Ok(res) => {
44497                    let (mut parts, body) = res.into_parts();
44498                    let mut body = common::Body::new(body);
44499                    if !parts.status.is_success() {
44500                        let bytes = common::to_bytes(body).await.unwrap_or_default();
44501                        let error = serde_json::from_str(&common::to_string(&bytes));
44502                        let response = common::to_response(parts, bytes.into());
44503
44504                        if let common::Retry::After(d) =
44505                            dlg.http_failure(&response, error.as_ref().ok())
44506                        {
44507                            sleep(d).await;
44508                            continue;
44509                        }
44510
44511                        dlg.finished(false);
44512
44513                        return Err(match error {
44514                            Ok(value) => common::Error::BadRequest(value),
44515                            _ => common::Error::Failure(response),
44516                        });
44517                    }
44518                    let response = {
44519                        let bytes = common::to_bytes(body).await.unwrap_or_default();
44520                        let encoded = common::to_string(&bytes);
44521                        match serde_json::from_str(&encoded) {
44522                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
44523                            Err(error) => {
44524                                dlg.response_json_decode_error(&encoded, &error);
44525                                return Err(common::Error::JsonDecodeError(
44526                                    encoded.to_string(),
44527                                    error,
44528                                ));
44529                            }
44530                        }
44531                    };
44532
44533                    dlg.finished(true);
44534                    return Ok(response);
44535                }
44536            }
44537        }
44538    }
44539
44540    /// User profile ID associated with this request.
44541    ///
44542    /// Sets the *profile id* path property to the given value.
44543    ///
44544    /// Even though the property as already been set when instantiating this call,
44545    /// we provide this method for API completeness.
44546    pub fn profile_id(mut self, new_value: i64) -> DynamicTargetingKeyListCall<'a, C> {
44547        self._profile_id = new_value;
44548        self
44549    }
44550    /// Select only dynamic targeting keys with this object type.
44551    ///
44552    /// Sets the *object type* query property to the given value.
44553    pub fn object_type(mut self, new_value: &str) -> DynamicTargetingKeyListCall<'a, C> {
44554        self._object_type = Some(new_value.to_string());
44555        self
44556    }
44557    /// Select only dynamic targeting keys with this object ID.
44558    ///
44559    /// Sets the *object id* query property to the given value.
44560    pub fn object_id(mut self, new_value: i64) -> DynamicTargetingKeyListCall<'a, C> {
44561        self._object_id = Some(new_value);
44562        self
44563    }
44564    /// Select only dynamic targeting keys exactly matching these names.
44565    ///
44566    /// Append the given value to the *names* query property.
44567    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
44568    pub fn add_names(mut self, new_value: &str) -> DynamicTargetingKeyListCall<'a, C> {
44569        self._names.push(new_value.to_string());
44570        self
44571    }
44572    /// Select only dynamic targeting keys whose object has this advertiser ID.
44573    ///
44574    /// Sets the *advertiser id* query property to the given value.
44575    pub fn advertiser_id(mut self, new_value: i64) -> DynamicTargetingKeyListCall<'a, C> {
44576        self._advertiser_id = Some(new_value);
44577        self
44578    }
44579    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
44580    /// while executing the actual API request.
44581    ///
44582    /// ````text
44583    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
44584    /// ````
44585    ///
44586    /// Sets the *delegate* property to the given value.
44587    pub fn delegate(
44588        mut self,
44589        new_value: &'a mut dyn common::Delegate,
44590    ) -> DynamicTargetingKeyListCall<'a, C> {
44591        self._delegate = Some(new_value);
44592        self
44593    }
44594
44595    /// Set any additional parameter of the query string used in the request.
44596    /// It should be used to set parameters which are not yet available through their own
44597    /// setters.
44598    ///
44599    /// Please note that this method must not be used to set any of the known parameters
44600    /// which have their own setter method. If done anyway, the request will fail.
44601    ///
44602    /// # Additional Parameters
44603    ///
44604    /// * *$.xgafv* (query-string) - V1 error format.
44605    /// * *access_token* (query-string) - OAuth access token.
44606    /// * *alt* (query-string) - Data format for response.
44607    /// * *callback* (query-string) - JSONP
44608    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
44609    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
44610    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
44611    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
44612    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
44613    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
44614    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
44615    pub fn param<T>(mut self, name: T, value: T) -> DynamicTargetingKeyListCall<'a, C>
44616    where
44617        T: AsRef<str>,
44618    {
44619        self._additional_params
44620            .insert(name.as_ref().to_string(), value.as_ref().to_string());
44621        self
44622    }
44623
44624    /// Identifies the authorization scope for the method you are building.
44625    ///
44626    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
44627    /// [`Scope::Dfatrafficking`].
44628    ///
44629    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
44630    /// tokens for more than one scope.
44631    ///
44632    /// Usually there is more than one suitable scope to authorize an operation, some of which may
44633    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
44634    /// sufficient, a read-write scope will do as well.
44635    pub fn add_scope<St>(mut self, scope: St) -> DynamicTargetingKeyListCall<'a, C>
44636    where
44637        St: AsRef<str>,
44638    {
44639        self._scopes.insert(String::from(scope.as_ref()));
44640        self
44641    }
44642    /// Identifies the authorization scope(s) for the method you are building.
44643    ///
44644    /// See [`Self::add_scope()`] for details.
44645    pub fn add_scopes<I, St>(mut self, scopes: I) -> DynamicTargetingKeyListCall<'a, C>
44646    where
44647        I: IntoIterator<Item = St>,
44648        St: AsRef<str>,
44649    {
44650        self._scopes
44651            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
44652        self
44653    }
44654
44655    /// Removes all scopes, and no default scope will be used either.
44656    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
44657    /// for details).
44658    pub fn clear_scopes(mut self) -> DynamicTargetingKeyListCall<'a, C> {
44659        self._scopes.clear();
44660        self
44661    }
44662}
44663
44664/// Deletes an existing event tag.
44665///
44666/// A builder for the *delete* method supported by a *eventTag* resource.
44667/// It is not used directly, but through a [`EventTagMethods`] instance.
44668///
44669/// # Example
44670///
44671/// Instantiate a resource method builder
44672///
44673/// ```test_harness,no_run
44674/// # extern crate hyper;
44675/// # extern crate hyper_rustls;
44676/// # extern crate google_dfareporting3d3 as dfareporting3d3;
44677/// # async fn dox() {
44678/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
44679///
44680/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
44681/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
44682/// #     secret,
44683/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
44684/// # ).build().await.unwrap();
44685///
44686/// # let client = hyper_util::client::legacy::Client::builder(
44687/// #     hyper_util::rt::TokioExecutor::new()
44688/// # )
44689/// # .build(
44690/// #     hyper_rustls::HttpsConnectorBuilder::new()
44691/// #         .with_native_roots()
44692/// #         .unwrap()
44693/// #         .https_or_http()
44694/// #         .enable_http1()
44695/// #         .build()
44696/// # );
44697/// # let mut hub = Dfareporting::new(client, auth);
44698/// // You can configure optional parameters by calling the respective setters at will, and
44699/// // execute the final call using `doit()`.
44700/// // Values shown here are possibly random and not representative !
44701/// let result = hub.event_tags().delete(-92, -92)
44702///              .doit().await;
44703/// # }
44704/// ```
44705pub struct EventTagDeleteCall<'a, C>
44706where
44707    C: 'a,
44708{
44709    hub: &'a Dfareporting<C>,
44710    _profile_id: i64,
44711    _id: i64,
44712    _delegate: Option<&'a mut dyn common::Delegate>,
44713    _additional_params: HashMap<String, String>,
44714    _scopes: BTreeSet<String>,
44715}
44716
44717impl<'a, C> common::CallBuilder for EventTagDeleteCall<'a, C> {}
44718
44719impl<'a, C> EventTagDeleteCall<'a, C>
44720where
44721    C: common::Connector,
44722{
44723    /// Perform the operation you have build so far.
44724    pub async fn doit(mut self) -> common::Result<common::Response> {
44725        use std::borrow::Cow;
44726        use std::io::{Read, Seek};
44727
44728        use common::{url::Params, ToParts};
44729        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
44730
44731        let mut dd = common::DefaultDelegate;
44732        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
44733        dlg.begin(common::MethodInfo {
44734            id: "dfareporting.eventTags.delete",
44735            http_method: hyper::Method::DELETE,
44736        });
44737
44738        for &field in ["profileId", "id"].iter() {
44739            if self._additional_params.contains_key(field) {
44740                dlg.finished(false);
44741                return Err(common::Error::FieldClash(field));
44742            }
44743        }
44744
44745        let mut params = Params::with_capacity(3 + self._additional_params.len());
44746        params.push("profileId", self._profile_id.to_string());
44747        params.push("id", self._id.to_string());
44748
44749        params.extend(self._additional_params.iter());
44750
44751        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/eventTags/{id}";
44752        if self._scopes.is_empty() {
44753            self._scopes
44754                .insert(Scope::Dfatrafficking.as_ref().to_string());
44755        }
44756
44757        #[allow(clippy::single_element_loop)]
44758        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
44759            url = params.uri_replacement(url, param_name, find_this, false);
44760        }
44761        {
44762            let to_remove = ["id", "profileId"];
44763            params.remove_params(&to_remove);
44764        }
44765
44766        let url = params.parse_with_url(&url);
44767
44768        loop {
44769            let token = match self
44770                .hub
44771                .auth
44772                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
44773                .await
44774            {
44775                Ok(token) => token,
44776                Err(e) => match dlg.token(e) {
44777                    Ok(token) => token,
44778                    Err(e) => {
44779                        dlg.finished(false);
44780                        return Err(common::Error::MissingToken(e));
44781                    }
44782                },
44783            };
44784            let mut req_result = {
44785                let client = &self.hub.client;
44786                dlg.pre_request();
44787                let mut req_builder = hyper::Request::builder()
44788                    .method(hyper::Method::DELETE)
44789                    .uri(url.as_str())
44790                    .header(USER_AGENT, self.hub._user_agent.clone());
44791
44792                if let Some(token) = token.as_ref() {
44793                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
44794                }
44795
44796                let request = req_builder
44797                    .header(CONTENT_LENGTH, 0_u64)
44798                    .body(common::to_body::<String>(None));
44799
44800                client.request(request.unwrap()).await
44801            };
44802
44803            match req_result {
44804                Err(err) => {
44805                    if let common::Retry::After(d) = dlg.http_error(&err) {
44806                        sleep(d).await;
44807                        continue;
44808                    }
44809                    dlg.finished(false);
44810                    return Err(common::Error::HttpError(err));
44811                }
44812                Ok(res) => {
44813                    let (mut parts, body) = res.into_parts();
44814                    let mut body = common::Body::new(body);
44815                    if !parts.status.is_success() {
44816                        let bytes = common::to_bytes(body).await.unwrap_or_default();
44817                        let error = serde_json::from_str(&common::to_string(&bytes));
44818                        let response = common::to_response(parts, bytes.into());
44819
44820                        if let common::Retry::After(d) =
44821                            dlg.http_failure(&response, error.as_ref().ok())
44822                        {
44823                            sleep(d).await;
44824                            continue;
44825                        }
44826
44827                        dlg.finished(false);
44828
44829                        return Err(match error {
44830                            Ok(value) => common::Error::BadRequest(value),
44831                            _ => common::Error::Failure(response),
44832                        });
44833                    }
44834                    let response = common::Response::from_parts(parts, body);
44835
44836                    dlg.finished(true);
44837                    return Ok(response);
44838                }
44839            }
44840        }
44841    }
44842
44843    /// User profile ID associated with this request.
44844    ///
44845    /// Sets the *profile id* path property to the given value.
44846    ///
44847    /// Even though the property as already been set when instantiating this call,
44848    /// we provide this method for API completeness.
44849    pub fn profile_id(mut self, new_value: i64) -> EventTagDeleteCall<'a, C> {
44850        self._profile_id = new_value;
44851        self
44852    }
44853    /// Event tag ID.
44854    ///
44855    /// Sets the *id* path property to the given value.
44856    ///
44857    /// Even though the property as already been set when instantiating this call,
44858    /// we provide this method for API completeness.
44859    pub fn id(mut self, new_value: i64) -> EventTagDeleteCall<'a, C> {
44860        self._id = new_value;
44861        self
44862    }
44863    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
44864    /// while executing the actual API request.
44865    ///
44866    /// ````text
44867    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
44868    /// ````
44869    ///
44870    /// Sets the *delegate* property to the given value.
44871    pub fn delegate(
44872        mut self,
44873        new_value: &'a mut dyn common::Delegate,
44874    ) -> EventTagDeleteCall<'a, C> {
44875        self._delegate = Some(new_value);
44876        self
44877    }
44878
44879    /// Set any additional parameter of the query string used in the request.
44880    /// It should be used to set parameters which are not yet available through their own
44881    /// setters.
44882    ///
44883    /// Please note that this method must not be used to set any of the known parameters
44884    /// which have their own setter method. If done anyway, the request will fail.
44885    ///
44886    /// # Additional Parameters
44887    ///
44888    /// * *$.xgafv* (query-string) - V1 error format.
44889    /// * *access_token* (query-string) - OAuth access token.
44890    /// * *alt* (query-string) - Data format for response.
44891    /// * *callback* (query-string) - JSONP
44892    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
44893    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
44894    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
44895    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
44896    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
44897    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
44898    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
44899    pub fn param<T>(mut self, name: T, value: T) -> EventTagDeleteCall<'a, C>
44900    where
44901        T: AsRef<str>,
44902    {
44903        self._additional_params
44904            .insert(name.as_ref().to_string(), value.as_ref().to_string());
44905        self
44906    }
44907
44908    /// Identifies the authorization scope for the method you are building.
44909    ///
44910    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
44911    /// [`Scope::Dfatrafficking`].
44912    ///
44913    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
44914    /// tokens for more than one scope.
44915    ///
44916    /// Usually there is more than one suitable scope to authorize an operation, some of which may
44917    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
44918    /// sufficient, a read-write scope will do as well.
44919    pub fn add_scope<St>(mut self, scope: St) -> EventTagDeleteCall<'a, C>
44920    where
44921        St: AsRef<str>,
44922    {
44923        self._scopes.insert(String::from(scope.as_ref()));
44924        self
44925    }
44926    /// Identifies the authorization scope(s) for the method you are building.
44927    ///
44928    /// See [`Self::add_scope()`] for details.
44929    pub fn add_scopes<I, St>(mut self, scopes: I) -> EventTagDeleteCall<'a, C>
44930    where
44931        I: IntoIterator<Item = St>,
44932        St: AsRef<str>,
44933    {
44934        self._scopes
44935            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
44936        self
44937    }
44938
44939    /// Removes all scopes, and no default scope will be used either.
44940    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
44941    /// for details).
44942    pub fn clear_scopes(mut self) -> EventTagDeleteCall<'a, C> {
44943        self._scopes.clear();
44944        self
44945    }
44946}
44947
44948/// Gets one event tag by ID.
44949///
44950/// A builder for the *get* method supported by a *eventTag* resource.
44951/// It is not used directly, but through a [`EventTagMethods`] instance.
44952///
44953/// # Example
44954///
44955/// Instantiate a resource method builder
44956///
44957/// ```test_harness,no_run
44958/// # extern crate hyper;
44959/// # extern crate hyper_rustls;
44960/// # extern crate google_dfareporting3d3 as dfareporting3d3;
44961/// # async fn dox() {
44962/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
44963///
44964/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
44965/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
44966/// #     secret,
44967/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
44968/// # ).build().await.unwrap();
44969///
44970/// # let client = hyper_util::client::legacy::Client::builder(
44971/// #     hyper_util::rt::TokioExecutor::new()
44972/// # )
44973/// # .build(
44974/// #     hyper_rustls::HttpsConnectorBuilder::new()
44975/// #         .with_native_roots()
44976/// #         .unwrap()
44977/// #         .https_or_http()
44978/// #         .enable_http1()
44979/// #         .build()
44980/// # );
44981/// # let mut hub = Dfareporting::new(client, auth);
44982/// // You can configure optional parameters by calling the respective setters at will, and
44983/// // execute the final call using `doit()`.
44984/// // Values shown here are possibly random and not representative !
44985/// let result = hub.event_tags().get(-93, -18)
44986///              .doit().await;
44987/// # }
44988/// ```
44989pub struct EventTagGetCall<'a, C>
44990where
44991    C: 'a,
44992{
44993    hub: &'a Dfareporting<C>,
44994    _profile_id: i64,
44995    _id: i64,
44996    _delegate: Option<&'a mut dyn common::Delegate>,
44997    _additional_params: HashMap<String, String>,
44998    _scopes: BTreeSet<String>,
44999}
45000
45001impl<'a, C> common::CallBuilder for EventTagGetCall<'a, C> {}
45002
45003impl<'a, C> EventTagGetCall<'a, C>
45004where
45005    C: common::Connector,
45006{
45007    /// Perform the operation you have build so far.
45008    pub async fn doit(mut self) -> common::Result<(common::Response, EventTag)> {
45009        use std::borrow::Cow;
45010        use std::io::{Read, Seek};
45011
45012        use common::{url::Params, ToParts};
45013        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
45014
45015        let mut dd = common::DefaultDelegate;
45016        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
45017        dlg.begin(common::MethodInfo {
45018            id: "dfareporting.eventTags.get",
45019            http_method: hyper::Method::GET,
45020        });
45021
45022        for &field in ["alt", "profileId", "id"].iter() {
45023            if self._additional_params.contains_key(field) {
45024                dlg.finished(false);
45025                return Err(common::Error::FieldClash(field));
45026            }
45027        }
45028
45029        let mut params = Params::with_capacity(4 + self._additional_params.len());
45030        params.push("profileId", self._profile_id.to_string());
45031        params.push("id", self._id.to_string());
45032
45033        params.extend(self._additional_params.iter());
45034
45035        params.push("alt", "json");
45036        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/eventTags/{id}";
45037        if self._scopes.is_empty() {
45038            self._scopes
45039                .insert(Scope::Dfatrafficking.as_ref().to_string());
45040        }
45041
45042        #[allow(clippy::single_element_loop)]
45043        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
45044            url = params.uri_replacement(url, param_name, find_this, false);
45045        }
45046        {
45047            let to_remove = ["id", "profileId"];
45048            params.remove_params(&to_remove);
45049        }
45050
45051        let url = params.parse_with_url(&url);
45052
45053        loop {
45054            let token = match self
45055                .hub
45056                .auth
45057                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
45058                .await
45059            {
45060                Ok(token) => token,
45061                Err(e) => match dlg.token(e) {
45062                    Ok(token) => token,
45063                    Err(e) => {
45064                        dlg.finished(false);
45065                        return Err(common::Error::MissingToken(e));
45066                    }
45067                },
45068            };
45069            let mut req_result = {
45070                let client = &self.hub.client;
45071                dlg.pre_request();
45072                let mut req_builder = hyper::Request::builder()
45073                    .method(hyper::Method::GET)
45074                    .uri(url.as_str())
45075                    .header(USER_AGENT, self.hub._user_agent.clone());
45076
45077                if let Some(token) = token.as_ref() {
45078                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
45079                }
45080
45081                let request = req_builder
45082                    .header(CONTENT_LENGTH, 0_u64)
45083                    .body(common::to_body::<String>(None));
45084
45085                client.request(request.unwrap()).await
45086            };
45087
45088            match req_result {
45089                Err(err) => {
45090                    if let common::Retry::After(d) = dlg.http_error(&err) {
45091                        sleep(d).await;
45092                        continue;
45093                    }
45094                    dlg.finished(false);
45095                    return Err(common::Error::HttpError(err));
45096                }
45097                Ok(res) => {
45098                    let (mut parts, body) = res.into_parts();
45099                    let mut body = common::Body::new(body);
45100                    if !parts.status.is_success() {
45101                        let bytes = common::to_bytes(body).await.unwrap_or_default();
45102                        let error = serde_json::from_str(&common::to_string(&bytes));
45103                        let response = common::to_response(parts, bytes.into());
45104
45105                        if let common::Retry::After(d) =
45106                            dlg.http_failure(&response, error.as_ref().ok())
45107                        {
45108                            sleep(d).await;
45109                            continue;
45110                        }
45111
45112                        dlg.finished(false);
45113
45114                        return Err(match error {
45115                            Ok(value) => common::Error::BadRequest(value),
45116                            _ => common::Error::Failure(response),
45117                        });
45118                    }
45119                    let response = {
45120                        let bytes = common::to_bytes(body).await.unwrap_or_default();
45121                        let encoded = common::to_string(&bytes);
45122                        match serde_json::from_str(&encoded) {
45123                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
45124                            Err(error) => {
45125                                dlg.response_json_decode_error(&encoded, &error);
45126                                return Err(common::Error::JsonDecodeError(
45127                                    encoded.to_string(),
45128                                    error,
45129                                ));
45130                            }
45131                        }
45132                    };
45133
45134                    dlg.finished(true);
45135                    return Ok(response);
45136                }
45137            }
45138        }
45139    }
45140
45141    /// User profile ID associated with this request.
45142    ///
45143    /// Sets the *profile id* path property to the given value.
45144    ///
45145    /// Even though the property as already been set when instantiating this call,
45146    /// we provide this method for API completeness.
45147    pub fn profile_id(mut self, new_value: i64) -> EventTagGetCall<'a, C> {
45148        self._profile_id = new_value;
45149        self
45150    }
45151    /// Event tag ID.
45152    ///
45153    /// Sets the *id* path property to the given value.
45154    ///
45155    /// Even though the property as already been set when instantiating this call,
45156    /// we provide this method for API completeness.
45157    pub fn id(mut self, new_value: i64) -> EventTagGetCall<'a, C> {
45158        self._id = new_value;
45159        self
45160    }
45161    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
45162    /// while executing the actual API request.
45163    ///
45164    /// ````text
45165    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
45166    /// ````
45167    ///
45168    /// Sets the *delegate* property to the given value.
45169    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> EventTagGetCall<'a, C> {
45170        self._delegate = Some(new_value);
45171        self
45172    }
45173
45174    /// Set any additional parameter of the query string used in the request.
45175    /// It should be used to set parameters which are not yet available through their own
45176    /// setters.
45177    ///
45178    /// Please note that this method must not be used to set any of the known parameters
45179    /// which have their own setter method. If done anyway, the request will fail.
45180    ///
45181    /// # Additional Parameters
45182    ///
45183    /// * *$.xgafv* (query-string) - V1 error format.
45184    /// * *access_token* (query-string) - OAuth access token.
45185    /// * *alt* (query-string) - Data format for response.
45186    /// * *callback* (query-string) - JSONP
45187    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
45188    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
45189    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
45190    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
45191    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
45192    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
45193    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
45194    pub fn param<T>(mut self, name: T, value: T) -> EventTagGetCall<'a, C>
45195    where
45196        T: AsRef<str>,
45197    {
45198        self._additional_params
45199            .insert(name.as_ref().to_string(), value.as_ref().to_string());
45200        self
45201    }
45202
45203    /// Identifies the authorization scope for the method you are building.
45204    ///
45205    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
45206    /// [`Scope::Dfatrafficking`].
45207    ///
45208    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
45209    /// tokens for more than one scope.
45210    ///
45211    /// Usually there is more than one suitable scope to authorize an operation, some of which may
45212    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
45213    /// sufficient, a read-write scope will do as well.
45214    pub fn add_scope<St>(mut self, scope: St) -> EventTagGetCall<'a, C>
45215    where
45216        St: AsRef<str>,
45217    {
45218        self._scopes.insert(String::from(scope.as_ref()));
45219        self
45220    }
45221    /// Identifies the authorization scope(s) for the method you are building.
45222    ///
45223    /// See [`Self::add_scope()`] for details.
45224    pub fn add_scopes<I, St>(mut self, scopes: I) -> EventTagGetCall<'a, C>
45225    where
45226        I: IntoIterator<Item = St>,
45227        St: AsRef<str>,
45228    {
45229        self._scopes
45230            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
45231        self
45232    }
45233
45234    /// Removes all scopes, and no default scope will be used either.
45235    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
45236    /// for details).
45237    pub fn clear_scopes(mut self) -> EventTagGetCall<'a, C> {
45238        self._scopes.clear();
45239        self
45240    }
45241}
45242
45243/// Inserts a new event tag.
45244///
45245/// A builder for the *insert* method supported by a *eventTag* resource.
45246/// It is not used directly, but through a [`EventTagMethods`] instance.
45247///
45248/// # Example
45249///
45250/// Instantiate a resource method builder
45251///
45252/// ```test_harness,no_run
45253/// # extern crate hyper;
45254/// # extern crate hyper_rustls;
45255/// # extern crate google_dfareporting3d3 as dfareporting3d3;
45256/// use dfareporting3d3::api::EventTag;
45257/// # async fn dox() {
45258/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
45259///
45260/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
45261/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
45262/// #     secret,
45263/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
45264/// # ).build().await.unwrap();
45265///
45266/// # let client = hyper_util::client::legacy::Client::builder(
45267/// #     hyper_util::rt::TokioExecutor::new()
45268/// # )
45269/// # .build(
45270/// #     hyper_rustls::HttpsConnectorBuilder::new()
45271/// #         .with_native_roots()
45272/// #         .unwrap()
45273/// #         .https_or_http()
45274/// #         .enable_http1()
45275/// #         .build()
45276/// # );
45277/// # let mut hub = Dfareporting::new(client, auth);
45278/// // As the method needs a request, you would usually fill it with the desired information
45279/// // into the respective structure. Some of the parts shown here might not be applicable !
45280/// // Values shown here are possibly random and not representative !
45281/// let mut req = EventTag::default();
45282///
45283/// // You can configure optional parameters by calling the respective setters at will, and
45284/// // execute the final call using `doit()`.
45285/// // Values shown here are possibly random and not representative !
45286/// let result = hub.event_tags().insert(req, -17)
45287///              .doit().await;
45288/// # }
45289/// ```
45290pub struct EventTagInsertCall<'a, C>
45291where
45292    C: 'a,
45293{
45294    hub: &'a Dfareporting<C>,
45295    _request: EventTag,
45296    _profile_id: i64,
45297    _delegate: Option<&'a mut dyn common::Delegate>,
45298    _additional_params: HashMap<String, String>,
45299    _scopes: BTreeSet<String>,
45300}
45301
45302impl<'a, C> common::CallBuilder for EventTagInsertCall<'a, C> {}
45303
45304impl<'a, C> EventTagInsertCall<'a, C>
45305where
45306    C: common::Connector,
45307{
45308    /// Perform the operation you have build so far.
45309    pub async fn doit(mut self) -> common::Result<(common::Response, EventTag)> {
45310        use std::borrow::Cow;
45311        use std::io::{Read, Seek};
45312
45313        use common::{url::Params, ToParts};
45314        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
45315
45316        let mut dd = common::DefaultDelegate;
45317        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
45318        dlg.begin(common::MethodInfo {
45319            id: "dfareporting.eventTags.insert",
45320            http_method: hyper::Method::POST,
45321        });
45322
45323        for &field in ["alt", "profileId"].iter() {
45324            if self._additional_params.contains_key(field) {
45325                dlg.finished(false);
45326                return Err(common::Error::FieldClash(field));
45327            }
45328        }
45329
45330        let mut params = Params::with_capacity(4 + self._additional_params.len());
45331        params.push("profileId", self._profile_id.to_string());
45332
45333        params.extend(self._additional_params.iter());
45334
45335        params.push("alt", "json");
45336        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/eventTags";
45337        if self._scopes.is_empty() {
45338            self._scopes
45339                .insert(Scope::Dfatrafficking.as_ref().to_string());
45340        }
45341
45342        #[allow(clippy::single_element_loop)]
45343        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
45344            url = params.uri_replacement(url, param_name, find_this, false);
45345        }
45346        {
45347            let to_remove = ["profileId"];
45348            params.remove_params(&to_remove);
45349        }
45350
45351        let url = params.parse_with_url(&url);
45352
45353        let mut json_mime_type = mime::APPLICATION_JSON;
45354        let mut request_value_reader = {
45355            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
45356            common::remove_json_null_values(&mut value);
45357            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
45358            serde_json::to_writer(&mut dst, &value).unwrap();
45359            dst
45360        };
45361        let request_size = request_value_reader
45362            .seek(std::io::SeekFrom::End(0))
45363            .unwrap();
45364        request_value_reader
45365            .seek(std::io::SeekFrom::Start(0))
45366            .unwrap();
45367
45368        loop {
45369            let token = match self
45370                .hub
45371                .auth
45372                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
45373                .await
45374            {
45375                Ok(token) => token,
45376                Err(e) => match dlg.token(e) {
45377                    Ok(token) => token,
45378                    Err(e) => {
45379                        dlg.finished(false);
45380                        return Err(common::Error::MissingToken(e));
45381                    }
45382                },
45383            };
45384            request_value_reader
45385                .seek(std::io::SeekFrom::Start(0))
45386                .unwrap();
45387            let mut req_result = {
45388                let client = &self.hub.client;
45389                dlg.pre_request();
45390                let mut req_builder = hyper::Request::builder()
45391                    .method(hyper::Method::POST)
45392                    .uri(url.as_str())
45393                    .header(USER_AGENT, self.hub._user_agent.clone());
45394
45395                if let Some(token) = token.as_ref() {
45396                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
45397                }
45398
45399                let request = req_builder
45400                    .header(CONTENT_TYPE, json_mime_type.to_string())
45401                    .header(CONTENT_LENGTH, request_size as u64)
45402                    .body(common::to_body(
45403                        request_value_reader.get_ref().clone().into(),
45404                    ));
45405
45406                client.request(request.unwrap()).await
45407            };
45408
45409            match req_result {
45410                Err(err) => {
45411                    if let common::Retry::After(d) = dlg.http_error(&err) {
45412                        sleep(d).await;
45413                        continue;
45414                    }
45415                    dlg.finished(false);
45416                    return Err(common::Error::HttpError(err));
45417                }
45418                Ok(res) => {
45419                    let (mut parts, body) = res.into_parts();
45420                    let mut body = common::Body::new(body);
45421                    if !parts.status.is_success() {
45422                        let bytes = common::to_bytes(body).await.unwrap_or_default();
45423                        let error = serde_json::from_str(&common::to_string(&bytes));
45424                        let response = common::to_response(parts, bytes.into());
45425
45426                        if let common::Retry::After(d) =
45427                            dlg.http_failure(&response, error.as_ref().ok())
45428                        {
45429                            sleep(d).await;
45430                            continue;
45431                        }
45432
45433                        dlg.finished(false);
45434
45435                        return Err(match error {
45436                            Ok(value) => common::Error::BadRequest(value),
45437                            _ => common::Error::Failure(response),
45438                        });
45439                    }
45440                    let response = {
45441                        let bytes = common::to_bytes(body).await.unwrap_or_default();
45442                        let encoded = common::to_string(&bytes);
45443                        match serde_json::from_str(&encoded) {
45444                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
45445                            Err(error) => {
45446                                dlg.response_json_decode_error(&encoded, &error);
45447                                return Err(common::Error::JsonDecodeError(
45448                                    encoded.to_string(),
45449                                    error,
45450                                ));
45451                            }
45452                        }
45453                    };
45454
45455                    dlg.finished(true);
45456                    return Ok(response);
45457                }
45458            }
45459        }
45460    }
45461
45462    ///
45463    /// Sets the *request* property to the given value.
45464    ///
45465    /// Even though the property as already been set when instantiating this call,
45466    /// we provide this method for API completeness.
45467    pub fn request(mut self, new_value: EventTag) -> EventTagInsertCall<'a, C> {
45468        self._request = new_value;
45469        self
45470    }
45471    /// User profile ID associated with this request.
45472    ///
45473    /// Sets the *profile id* path property to the given value.
45474    ///
45475    /// Even though the property as already been set when instantiating this call,
45476    /// we provide this method for API completeness.
45477    pub fn profile_id(mut self, new_value: i64) -> EventTagInsertCall<'a, C> {
45478        self._profile_id = new_value;
45479        self
45480    }
45481    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
45482    /// while executing the actual API request.
45483    ///
45484    /// ````text
45485    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
45486    /// ````
45487    ///
45488    /// Sets the *delegate* property to the given value.
45489    pub fn delegate(
45490        mut self,
45491        new_value: &'a mut dyn common::Delegate,
45492    ) -> EventTagInsertCall<'a, C> {
45493        self._delegate = Some(new_value);
45494        self
45495    }
45496
45497    /// Set any additional parameter of the query string used in the request.
45498    /// It should be used to set parameters which are not yet available through their own
45499    /// setters.
45500    ///
45501    /// Please note that this method must not be used to set any of the known parameters
45502    /// which have their own setter method. If done anyway, the request will fail.
45503    ///
45504    /// # Additional Parameters
45505    ///
45506    /// * *$.xgafv* (query-string) - V1 error format.
45507    /// * *access_token* (query-string) - OAuth access token.
45508    /// * *alt* (query-string) - Data format for response.
45509    /// * *callback* (query-string) - JSONP
45510    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
45511    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
45512    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
45513    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
45514    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
45515    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
45516    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
45517    pub fn param<T>(mut self, name: T, value: T) -> EventTagInsertCall<'a, C>
45518    where
45519        T: AsRef<str>,
45520    {
45521        self._additional_params
45522            .insert(name.as_ref().to_string(), value.as_ref().to_string());
45523        self
45524    }
45525
45526    /// Identifies the authorization scope for the method you are building.
45527    ///
45528    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
45529    /// [`Scope::Dfatrafficking`].
45530    ///
45531    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
45532    /// tokens for more than one scope.
45533    ///
45534    /// Usually there is more than one suitable scope to authorize an operation, some of which may
45535    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
45536    /// sufficient, a read-write scope will do as well.
45537    pub fn add_scope<St>(mut self, scope: St) -> EventTagInsertCall<'a, C>
45538    where
45539        St: AsRef<str>,
45540    {
45541        self._scopes.insert(String::from(scope.as_ref()));
45542        self
45543    }
45544    /// Identifies the authorization scope(s) for the method you are building.
45545    ///
45546    /// See [`Self::add_scope()`] for details.
45547    pub fn add_scopes<I, St>(mut self, scopes: I) -> EventTagInsertCall<'a, C>
45548    where
45549        I: IntoIterator<Item = St>,
45550        St: AsRef<str>,
45551    {
45552        self._scopes
45553            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
45554        self
45555    }
45556
45557    /// Removes all scopes, and no default scope will be used either.
45558    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
45559    /// for details).
45560    pub fn clear_scopes(mut self) -> EventTagInsertCall<'a, C> {
45561        self._scopes.clear();
45562        self
45563    }
45564}
45565
45566/// Retrieves a list of event tags, possibly filtered.
45567///
45568/// A builder for the *list* method supported by a *eventTag* resource.
45569/// It is not used directly, but through a [`EventTagMethods`] instance.
45570///
45571/// # Example
45572///
45573/// Instantiate a resource method builder
45574///
45575/// ```test_harness,no_run
45576/// # extern crate hyper;
45577/// # extern crate hyper_rustls;
45578/// # extern crate google_dfareporting3d3 as dfareporting3d3;
45579/// # async fn dox() {
45580/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
45581///
45582/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
45583/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
45584/// #     secret,
45585/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
45586/// # ).build().await.unwrap();
45587///
45588/// # let client = hyper_util::client::legacy::Client::builder(
45589/// #     hyper_util::rt::TokioExecutor::new()
45590/// # )
45591/// # .build(
45592/// #     hyper_rustls::HttpsConnectorBuilder::new()
45593/// #         .with_native_roots()
45594/// #         .unwrap()
45595/// #         .https_or_http()
45596/// #         .enable_http1()
45597/// #         .build()
45598/// # );
45599/// # let mut hub = Dfareporting::new(client, auth);
45600/// // You can configure optional parameters by calling the respective setters at will, and
45601/// // execute the final call using `doit()`.
45602/// // Values shown here are possibly random and not representative !
45603/// let result = hub.event_tags().list(-84)
45604///              .sort_order("ipsum")
45605///              .sort_field("ea")
45606///              .search_string("At")
45607///              .add_ids(-53)
45608///              .add_event_tag_types("sit")
45609///              .enabled(false)
45610///              .definitions_only(false)
45611///              .campaign_id(-94)
45612///              .advertiser_id(-32)
45613///              .ad_id(-31)
45614///              .doit().await;
45615/// # }
45616/// ```
45617pub struct EventTagListCall<'a, C>
45618where
45619    C: 'a,
45620{
45621    hub: &'a Dfareporting<C>,
45622    _profile_id: i64,
45623    _sort_order: Option<String>,
45624    _sort_field: Option<String>,
45625    _search_string: Option<String>,
45626    _ids: Vec<i64>,
45627    _event_tag_types: Vec<String>,
45628    _enabled: Option<bool>,
45629    _definitions_only: Option<bool>,
45630    _campaign_id: Option<i64>,
45631    _advertiser_id: Option<i64>,
45632    _ad_id: Option<i64>,
45633    _delegate: Option<&'a mut dyn common::Delegate>,
45634    _additional_params: HashMap<String, String>,
45635    _scopes: BTreeSet<String>,
45636}
45637
45638impl<'a, C> common::CallBuilder for EventTagListCall<'a, C> {}
45639
45640impl<'a, C> EventTagListCall<'a, C>
45641where
45642    C: common::Connector,
45643{
45644    /// Perform the operation you have build so far.
45645    pub async fn doit(mut self) -> common::Result<(common::Response, EventTagsListResponse)> {
45646        use std::borrow::Cow;
45647        use std::io::{Read, Seek};
45648
45649        use common::{url::Params, ToParts};
45650        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
45651
45652        let mut dd = common::DefaultDelegate;
45653        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
45654        dlg.begin(common::MethodInfo {
45655            id: "dfareporting.eventTags.list",
45656            http_method: hyper::Method::GET,
45657        });
45658
45659        for &field in [
45660            "alt",
45661            "profileId",
45662            "sortOrder",
45663            "sortField",
45664            "searchString",
45665            "ids",
45666            "eventTagTypes",
45667            "enabled",
45668            "definitionsOnly",
45669            "campaignId",
45670            "advertiserId",
45671            "adId",
45672        ]
45673        .iter()
45674        {
45675            if self._additional_params.contains_key(field) {
45676                dlg.finished(false);
45677                return Err(common::Error::FieldClash(field));
45678            }
45679        }
45680
45681        let mut params = Params::with_capacity(13 + self._additional_params.len());
45682        params.push("profileId", self._profile_id.to_string());
45683        if let Some(value) = self._sort_order.as_ref() {
45684            params.push("sortOrder", value);
45685        }
45686        if let Some(value) = self._sort_field.as_ref() {
45687            params.push("sortField", value);
45688        }
45689        if let Some(value) = self._search_string.as_ref() {
45690            params.push("searchString", value);
45691        }
45692        if !self._ids.is_empty() {
45693            for f in self._ids.iter() {
45694                params.push("ids", f.to_string());
45695            }
45696        }
45697        if !self._event_tag_types.is_empty() {
45698            for f in self._event_tag_types.iter() {
45699                params.push("eventTagTypes", f);
45700            }
45701        }
45702        if let Some(value) = self._enabled.as_ref() {
45703            params.push("enabled", value.to_string());
45704        }
45705        if let Some(value) = self._definitions_only.as_ref() {
45706            params.push("definitionsOnly", value.to_string());
45707        }
45708        if let Some(value) = self._campaign_id.as_ref() {
45709            params.push("campaignId", value.to_string());
45710        }
45711        if let Some(value) = self._advertiser_id.as_ref() {
45712            params.push("advertiserId", value.to_string());
45713        }
45714        if let Some(value) = self._ad_id.as_ref() {
45715            params.push("adId", value.to_string());
45716        }
45717
45718        params.extend(self._additional_params.iter());
45719
45720        params.push("alt", "json");
45721        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/eventTags";
45722        if self._scopes.is_empty() {
45723            self._scopes
45724                .insert(Scope::Dfatrafficking.as_ref().to_string());
45725        }
45726
45727        #[allow(clippy::single_element_loop)]
45728        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
45729            url = params.uri_replacement(url, param_name, find_this, false);
45730        }
45731        {
45732            let to_remove = ["profileId"];
45733            params.remove_params(&to_remove);
45734        }
45735
45736        let url = params.parse_with_url(&url);
45737
45738        loop {
45739            let token = match self
45740                .hub
45741                .auth
45742                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
45743                .await
45744            {
45745                Ok(token) => token,
45746                Err(e) => match dlg.token(e) {
45747                    Ok(token) => token,
45748                    Err(e) => {
45749                        dlg.finished(false);
45750                        return Err(common::Error::MissingToken(e));
45751                    }
45752                },
45753            };
45754            let mut req_result = {
45755                let client = &self.hub.client;
45756                dlg.pre_request();
45757                let mut req_builder = hyper::Request::builder()
45758                    .method(hyper::Method::GET)
45759                    .uri(url.as_str())
45760                    .header(USER_AGENT, self.hub._user_agent.clone());
45761
45762                if let Some(token) = token.as_ref() {
45763                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
45764                }
45765
45766                let request = req_builder
45767                    .header(CONTENT_LENGTH, 0_u64)
45768                    .body(common::to_body::<String>(None));
45769
45770                client.request(request.unwrap()).await
45771            };
45772
45773            match req_result {
45774                Err(err) => {
45775                    if let common::Retry::After(d) = dlg.http_error(&err) {
45776                        sleep(d).await;
45777                        continue;
45778                    }
45779                    dlg.finished(false);
45780                    return Err(common::Error::HttpError(err));
45781                }
45782                Ok(res) => {
45783                    let (mut parts, body) = res.into_parts();
45784                    let mut body = common::Body::new(body);
45785                    if !parts.status.is_success() {
45786                        let bytes = common::to_bytes(body).await.unwrap_or_default();
45787                        let error = serde_json::from_str(&common::to_string(&bytes));
45788                        let response = common::to_response(parts, bytes.into());
45789
45790                        if let common::Retry::After(d) =
45791                            dlg.http_failure(&response, error.as_ref().ok())
45792                        {
45793                            sleep(d).await;
45794                            continue;
45795                        }
45796
45797                        dlg.finished(false);
45798
45799                        return Err(match error {
45800                            Ok(value) => common::Error::BadRequest(value),
45801                            _ => common::Error::Failure(response),
45802                        });
45803                    }
45804                    let response = {
45805                        let bytes = common::to_bytes(body).await.unwrap_or_default();
45806                        let encoded = common::to_string(&bytes);
45807                        match serde_json::from_str(&encoded) {
45808                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
45809                            Err(error) => {
45810                                dlg.response_json_decode_error(&encoded, &error);
45811                                return Err(common::Error::JsonDecodeError(
45812                                    encoded.to_string(),
45813                                    error,
45814                                ));
45815                            }
45816                        }
45817                    };
45818
45819                    dlg.finished(true);
45820                    return Ok(response);
45821                }
45822            }
45823        }
45824    }
45825
45826    /// User profile ID associated with this request.
45827    ///
45828    /// Sets the *profile id* path property to the given value.
45829    ///
45830    /// Even though the property as already been set when instantiating this call,
45831    /// we provide this method for API completeness.
45832    pub fn profile_id(mut self, new_value: i64) -> EventTagListCall<'a, C> {
45833        self._profile_id = new_value;
45834        self
45835    }
45836    /// Order of sorted results.
45837    ///
45838    /// Sets the *sort order* query property to the given value.
45839    pub fn sort_order(mut self, new_value: &str) -> EventTagListCall<'a, C> {
45840        self._sort_order = Some(new_value.to_string());
45841        self
45842    }
45843    /// Field by which to sort the list.
45844    ///
45845    /// Sets the *sort field* query property to the given value.
45846    pub fn sort_field(mut self, new_value: &str) -> EventTagListCall<'a, C> {
45847        self._sort_field = Some(new_value.to_string());
45848        self
45849    }
45850    /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "eventtag*2015" will return objects with names like "eventtag June 2015", "eventtag April 2015", or simply "eventtag 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "eventtag" will match objects with name "my eventtag", "eventtag 2015", or simply "eventtag".
45851    ///
45852    /// Sets the *search string* query property to the given value.
45853    pub fn search_string(mut self, new_value: &str) -> EventTagListCall<'a, C> {
45854        self._search_string = Some(new_value.to_string());
45855        self
45856    }
45857    /// Select only event tags with these IDs.
45858    ///
45859    /// Append the given value to the *ids* query property.
45860    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
45861    pub fn add_ids(mut self, new_value: i64) -> EventTagListCall<'a, C> {
45862        self._ids.push(new_value);
45863        self
45864    }
45865    /// Select only event tags with the specified event tag types. Event tag types can be used to specify whether to use a third-party pixel, a third-party JavaScript URL, or a third-party click-through URL for either impression or click tracking.
45866    ///
45867    /// Append the given value to the *event tag types* query property.
45868    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
45869    pub fn add_event_tag_types(mut self, new_value: &str) -> EventTagListCall<'a, C> {
45870        self._event_tag_types.push(new_value.to_string());
45871        self
45872    }
45873    /// Select only enabled event tags. What is considered enabled or disabled depends on the definitionsOnly parameter. When definitionsOnly is set to true, only the specified advertiser or campaign's event tags' enabledByDefault field is examined. When definitionsOnly is set to false, the specified ad or specified campaign's parent advertiser's or parent campaign's event tags' enabledByDefault and status fields are examined as well.
45874    ///
45875    /// Sets the *enabled* query property to the given value.
45876    pub fn enabled(mut self, new_value: bool) -> EventTagListCall<'a, C> {
45877        self._enabled = Some(new_value);
45878        self
45879    }
45880    /// Examine only the specified campaign or advertiser's event tags for matching selector criteria. When set to false, the parent advertiser and parent campaign of the specified ad or campaign is examined as well. In addition, when set to false, the status field is examined as well, along with the enabledByDefault field. This parameter can not be set to true when adId is specified as ads do not define their own even tags.
45881    ///
45882    /// Sets the *definitions only* query property to the given value.
45883    pub fn definitions_only(mut self, new_value: bool) -> EventTagListCall<'a, C> {
45884        self._definitions_only = Some(new_value);
45885        self
45886    }
45887    /// Select only event tags that belong to this campaign.
45888    ///
45889    /// Sets the *campaign id* query property to the given value.
45890    pub fn campaign_id(mut self, new_value: i64) -> EventTagListCall<'a, C> {
45891        self._campaign_id = Some(new_value);
45892        self
45893    }
45894    /// Select only event tags that belong to this advertiser.
45895    ///
45896    /// Sets the *advertiser id* query property to the given value.
45897    pub fn advertiser_id(mut self, new_value: i64) -> EventTagListCall<'a, C> {
45898        self._advertiser_id = Some(new_value);
45899        self
45900    }
45901    /// Select only event tags that belong to this ad.
45902    ///
45903    /// Sets the *ad id* query property to the given value.
45904    pub fn ad_id(mut self, new_value: i64) -> EventTagListCall<'a, C> {
45905        self._ad_id = Some(new_value);
45906        self
45907    }
45908    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
45909    /// while executing the actual API request.
45910    ///
45911    /// ````text
45912    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
45913    /// ````
45914    ///
45915    /// Sets the *delegate* property to the given value.
45916    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> EventTagListCall<'a, C> {
45917        self._delegate = Some(new_value);
45918        self
45919    }
45920
45921    /// Set any additional parameter of the query string used in the request.
45922    /// It should be used to set parameters which are not yet available through their own
45923    /// setters.
45924    ///
45925    /// Please note that this method must not be used to set any of the known parameters
45926    /// which have their own setter method. If done anyway, the request will fail.
45927    ///
45928    /// # Additional Parameters
45929    ///
45930    /// * *$.xgafv* (query-string) - V1 error format.
45931    /// * *access_token* (query-string) - OAuth access token.
45932    /// * *alt* (query-string) - Data format for response.
45933    /// * *callback* (query-string) - JSONP
45934    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
45935    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
45936    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
45937    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
45938    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
45939    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
45940    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
45941    pub fn param<T>(mut self, name: T, value: T) -> EventTagListCall<'a, C>
45942    where
45943        T: AsRef<str>,
45944    {
45945        self._additional_params
45946            .insert(name.as_ref().to_string(), value.as_ref().to_string());
45947        self
45948    }
45949
45950    /// Identifies the authorization scope for the method you are building.
45951    ///
45952    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
45953    /// [`Scope::Dfatrafficking`].
45954    ///
45955    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
45956    /// tokens for more than one scope.
45957    ///
45958    /// Usually there is more than one suitable scope to authorize an operation, some of which may
45959    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
45960    /// sufficient, a read-write scope will do as well.
45961    pub fn add_scope<St>(mut self, scope: St) -> EventTagListCall<'a, C>
45962    where
45963        St: AsRef<str>,
45964    {
45965        self._scopes.insert(String::from(scope.as_ref()));
45966        self
45967    }
45968    /// Identifies the authorization scope(s) for the method you are building.
45969    ///
45970    /// See [`Self::add_scope()`] for details.
45971    pub fn add_scopes<I, St>(mut self, scopes: I) -> EventTagListCall<'a, C>
45972    where
45973        I: IntoIterator<Item = St>,
45974        St: AsRef<str>,
45975    {
45976        self._scopes
45977            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
45978        self
45979    }
45980
45981    /// Removes all scopes, and no default scope will be used either.
45982    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
45983    /// for details).
45984    pub fn clear_scopes(mut self) -> EventTagListCall<'a, C> {
45985        self._scopes.clear();
45986        self
45987    }
45988}
45989
45990/// Updates an existing event tag. This method supports patch semantics.
45991///
45992/// A builder for the *patch* method supported by a *eventTag* resource.
45993/// It is not used directly, but through a [`EventTagMethods`] instance.
45994///
45995/// # Example
45996///
45997/// Instantiate a resource method builder
45998///
45999/// ```test_harness,no_run
46000/// # extern crate hyper;
46001/// # extern crate hyper_rustls;
46002/// # extern crate google_dfareporting3d3 as dfareporting3d3;
46003/// use dfareporting3d3::api::EventTag;
46004/// # async fn dox() {
46005/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
46006///
46007/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
46008/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
46009/// #     secret,
46010/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
46011/// # ).build().await.unwrap();
46012///
46013/// # let client = hyper_util::client::legacy::Client::builder(
46014/// #     hyper_util::rt::TokioExecutor::new()
46015/// # )
46016/// # .build(
46017/// #     hyper_rustls::HttpsConnectorBuilder::new()
46018/// #         .with_native_roots()
46019/// #         .unwrap()
46020/// #         .https_or_http()
46021/// #         .enable_http1()
46022/// #         .build()
46023/// # );
46024/// # let mut hub = Dfareporting::new(client, auth);
46025/// // As the method needs a request, you would usually fill it with the desired information
46026/// // into the respective structure. Some of the parts shown here might not be applicable !
46027/// // Values shown here are possibly random and not representative !
46028/// let mut req = EventTag::default();
46029///
46030/// // You can configure optional parameters by calling the respective setters at will, and
46031/// // execute the final call using `doit()`.
46032/// // Values shown here are possibly random and not representative !
46033/// let result = hub.event_tags().patch(req, -87, -18)
46034///              .doit().await;
46035/// # }
46036/// ```
46037pub struct EventTagPatchCall<'a, C>
46038where
46039    C: 'a,
46040{
46041    hub: &'a Dfareporting<C>,
46042    _request: EventTag,
46043    _profile_id: i64,
46044    _id: i64,
46045    _delegate: Option<&'a mut dyn common::Delegate>,
46046    _additional_params: HashMap<String, String>,
46047    _scopes: BTreeSet<String>,
46048}
46049
46050impl<'a, C> common::CallBuilder for EventTagPatchCall<'a, C> {}
46051
46052impl<'a, C> EventTagPatchCall<'a, C>
46053where
46054    C: common::Connector,
46055{
46056    /// Perform the operation you have build so far.
46057    pub async fn doit(mut self) -> common::Result<(common::Response, EventTag)> {
46058        use std::borrow::Cow;
46059        use std::io::{Read, Seek};
46060
46061        use common::{url::Params, ToParts};
46062        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
46063
46064        let mut dd = common::DefaultDelegate;
46065        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
46066        dlg.begin(common::MethodInfo {
46067            id: "dfareporting.eventTags.patch",
46068            http_method: hyper::Method::PATCH,
46069        });
46070
46071        for &field in ["alt", "profileId", "id"].iter() {
46072            if self._additional_params.contains_key(field) {
46073                dlg.finished(false);
46074                return Err(common::Error::FieldClash(field));
46075            }
46076        }
46077
46078        let mut params = Params::with_capacity(5 + self._additional_params.len());
46079        params.push("profileId", self._profile_id.to_string());
46080        params.push("id", self._id.to_string());
46081
46082        params.extend(self._additional_params.iter());
46083
46084        params.push("alt", "json");
46085        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/eventTags";
46086        if self._scopes.is_empty() {
46087            self._scopes
46088                .insert(Scope::Dfatrafficking.as_ref().to_string());
46089        }
46090
46091        #[allow(clippy::single_element_loop)]
46092        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
46093            url = params.uri_replacement(url, param_name, find_this, false);
46094        }
46095        {
46096            let to_remove = ["profileId"];
46097            params.remove_params(&to_remove);
46098        }
46099
46100        let url = params.parse_with_url(&url);
46101
46102        let mut json_mime_type = mime::APPLICATION_JSON;
46103        let mut request_value_reader = {
46104            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
46105            common::remove_json_null_values(&mut value);
46106            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
46107            serde_json::to_writer(&mut dst, &value).unwrap();
46108            dst
46109        };
46110        let request_size = request_value_reader
46111            .seek(std::io::SeekFrom::End(0))
46112            .unwrap();
46113        request_value_reader
46114            .seek(std::io::SeekFrom::Start(0))
46115            .unwrap();
46116
46117        loop {
46118            let token = match self
46119                .hub
46120                .auth
46121                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
46122                .await
46123            {
46124                Ok(token) => token,
46125                Err(e) => match dlg.token(e) {
46126                    Ok(token) => token,
46127                    Err(e) => {
46128                        dlg.finished(false);
46129                        return Err(common::Error::MissingToken(e));
46130                    }
46131                },
46132            };
46133            request_value_reader
46134                .seek(std::io::SeekFrom::Start(0))
46135                .unwrap();
46136            let mut req_result = {
46137                let client = &self.hub.client;
46138                dlg.pre_request();
46139                let mut req_builder = hyper::Request::builder()
46140                    .method(hyper::Method::PATCH)
46141                    .uri(url.as_str())
46142                    .header(USER_AGENT, self.hub._user_agent.clone());
46143
46144                if let Some(token) = token.as_ref() {
46145                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
46146                }
46147
46148                let request = req_builder
46149                    .header(CONTENT_TYPE, json_mime_type.to_string())
46150                    .header(CONTENT_LENGTH, request_size as u64)
46151                    .body(common::to_body(
46152                        request_value_reader.get_ref().clone().into(),
46153                    ));
46154
46155                client.request(request.unwrap()).await
46156            };
46157
46158            match req_result {
46159                Err(err) => {
46160                    if let common::Retry::After(d) = dlg.http_error(&err) {
46161                        sleep(d).await;
46162                        continue;
46163                    }
46164                    dlg.finished(false);
46165                    return Err(common::Error::HttpError(err));
46166                }
46167                Ok(res) => {
46168                    let (mut parts, body) = res.into_parts();
46169                    let mut body = common::Body::new(body);
46170                    if !parts.status.is_success() {
46171                        let bytes = common::to_bytes(body).await.unwrap_or_default();
46172                        let error = serde_json::from_str(&common::to_string(&bytes));
46173                        let response = common::to_response(parts, bytes.into());
46174
46175                        if let common::Retry::After(d) =
46176                            dlg.http_failure(&response, error.as_ref().ok())
46177                        {
46178                            sleep(d).await;
46179                            continue;
46180                        }
46181
46182                        dlg.finished(false);
46183
46184                        return Err(match error {
46185                            Ok(value) => common::Error::BadRequest(value),
46186                            _ => common::Error::Failure(response),
46187                        });
46188                    }
46189                    let response = {
46190                        let bytes = common::to_bytes(body).await.unwrap_or_default();
46191                        let encoded = common::to_string(&bytes);
46192                        match serde_json::from_str(&encoded) {
46193                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
46194                            Err(error) => {
46195                                dlg.response_json_decode_error(&encoded, &error);
46196                                return Err(common::Error::JsonDecodeError(
46197                                    encoded.to_string(),
46198                                    error,
46199                                ));
46200                            }
46201                        }
46202                    };
46203
46204                    dlg.finished(true);
46205                    return Ok(response);
46206                }
46207            }
46208        }
46209    }
46210
46211    ///
46212    /// Sets the *request* property to the given value.
46213    ///
46214    /// Even though the property as already been set when instantiating this call,
46215    /// we provide this method for API completeness.
46216    pub fn request(mut self, new_value: EventTag) -> EventTagPatchCall<'a, C> {
46217        self._request = new_value;
46218        self
46219    }
46220    /// User profile ID associated with this request.
46221    ///
46222    /// Sets the *profile id* path property to the given value.
46223    ///
46224    /// Even though the property as already been set when instantiating this call,
46225    /// we provide this method for API completeness.
46226    pub fn profile_id(mut self, new_value: i64) -> EventTagPatchCall<'a, C> {
46227        self._profile_id = new_value;
46228        self
46229    }
46230    /// EventTag ID.
46231    ///
46232    /// Sets the *id* query property to the given value.
46233    ///
46234    /// Even though the property as already been set when instantiating this call,
46235    /// we provide this method for API completeness.
46236    pub fn id(mut self, new_value: i64) -> EventTagPatchCall<'a, C> {
46237        self._id = new_value;
46238        self
46239    }
46240    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
46241    /// while executing the actual API request.
46242    ///
46243    /// ````text
46244    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
46245    /// ````
46246    ///
46247    /// Sets the *delegate* property to the given value.
46248    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> EventTagPatchCall<'a, C> {
46249        self._delegate = Some(new_value);
46250        self
46251    }
46252
46253    /// Set any additional parameter of the query string used in the request.
46254    /// It should be used to set parameters which are not yet available through their own
46255    /// setters.
46256    ///
46257    /// Please note that this method must not be used to set any of the known parameters
46258    /// which have their own setter method. If done anyway, the request will fail.
46259    ///
46260    /// # Additional Parameters
46261    ///
46262    /// * *$.xgafv* (query-string) - V1 error format.
46263    /// * *access_token* (query-string) - OAuth access token.
46264    /// * *alt* (query-string) - Data format for response.
46265    /// * *callback* (query-string) - JSONP
46266    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
46267    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
46268    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
46269    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
46270    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
46271    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
46272    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
46273    pub fn param<T>(mut self, name: T, value: T) -> EventTagPatchCall<'a, C>
46274    where
46275        T: AsRef<str>,
46276    {
46277        self._additional_params
46278            .insert(name.as_ref().to_string(), value.as_ref().to_string());
46279        self
46280    }
46281
46282    /// Identifies the authorization scope for the method you are building.
46283    ///
46284    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
46285    /// [`Scope::Dfatrafficking`].
46286    ///
46287    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
46288    /// tokens for more than one scope.
46289    ///
46290    /// Usually there is more than one suitable scope to authorize an operation, some of which may
46291    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
46292    /// sufficient, a read-write scope will do as well.
46293    pub fn add_scope<St>(mut self, scope: St) -> EventTagPatchCall<'a, C>
46294    where
46295        St: AsRef<str>,
46296    {
46297        self._scopes.insert(String::from(scope.as_ref()));
46298        self
46299    }
46300    /// Identifies the authorization scope(s) for the method you are building.
46301    ///
46302    /// See [`Self::add_scope()`] for details.
46303    pub fn add_scopes<I, St>(mut self, scopes: I) -> EventTagPatchCall<'a, C>
46304    where
46305        I: IntoIterator<Item = St>,
46306        St: AsRef<str>,
46307    {
46308        self._scopes
46309            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
46310        self
46311    }
46312
46313    /// Removes all scopes, and no default scope will be used either.
46314    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
46315    /// for details).
46316    pub fn clear_scopes(mut self) -> EventTagPatchCall<'a, C> {
46317        self._scopes.clear();
46318        self
46319    }
46320}
46321
46322/// Updates an existing event tag.
46323///
46324/// A builder for the *update* method supported by a *eventTag* resource.
46325/// It is not used directly, but through a [`EventTagMethods`] instance.
46326///
46327/// # Example
46328///
46329/// Instantiate a resource method builder
46330///
46331/// ```test_harness,no_run
46332/// # extern crate hyper;
46333/// # extern crate hyper_rustls;
46334/// # extern crate google_dfareporting3d3 as dfareporting3d3;
46335/// use dfareporting3d3::api::EventTag;
46336/// # async fn dox() {
46337/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
46338///
46339/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
46340/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
46341/// #     secret,
46342/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
46343/// # ).build().await.unwrap();
46344///
46345/// # let client = hyper_util::client::legacy::Client::builder(
46346/// #     hyper_util::rt::TokioExecutor::new()
46347/// # )
46348/// # .build(
46349/// #     hyper_rustls::HttpsConnectorBuilder::new()
46350/// #         .with_native_roots()
46351/// #         .unwrap()
46352/// #         .https_or_http()
46353/// #         .enable_http1()
46354/// #         .build()
46355/// # );
46356/// # let mut hub = Dfareporting::new(client, auth);
46357/// // As the method needs a request, you would usually fill it with the desired information
46358/// // into the respective structure. Some of the parts shown here might not be applicable !
46359/// // Values shown here are possibly random and not representative !
46360/// let mut req = EventTag::default();
46361///
46362/// // You can configure optional parameters by calling the respective setters at will, and
46363/// // execute the final call using `doit()`.
46364/// // Values shown here are possibly random and not representative !
46365/// let result = hub.event_tags().update(req, -51)
46366///              .doit().await;
46367/// # }
46368/// ```
46369pub struct EventTagUpdateCall<'a, C>
46370where
46371    C: 'a,
46372{
46373    hub: &'a Dfareporting<C>,
46374    _request: EventTag,
46375    _profile_id: i64,
46376    _delegate: Option<&'a mut dyn common::Delegate>,
46377    _additional_params: HashMap<String, String>,
46378    _scopes: BTreeSet<String>,
46379}
46380
46381impl<'a, C> common::CallBuilder for EventTagUpdateCall<'a, C> {}
46382
46383impl<'a, C> EventTagUpdateCall<'a, C>
46384where
46385    C: common::Connector,
46386{
46387    /// Perform the operation you have build so far.
46388    pub async fn doit(mut self) -> common::Result<(common::Response, EventTag)> {
46389        use std::borrow::Cow;
46390        use std::io::{Read, Seek};
46391
46392        use common::{url::Params, ToParts};
46393        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
46394
46395        let mut dd = common::DefaultDelegate;
46396        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
46397        dlg.begin(common::MethodInfo {
46398            id: "dfareporting.eventTags.update",
46399            http_method: hyper::Method::PUT,
46400        });
46401
46402        for &field in ["alt", "profileId"].iter() {
46403            if self._additional_params.contains_key(field) {
46404                dlg.finished(false);
46405                return Err(common::Error::FieldClash(field));
46406            }
46407        }
46408
46409        let mut params = Params::with_capacity(4 + self._additional_params.len());
46410        params.push("profileId", self._profile_id.to_string());
46411
46412        params.extend(self._additional_params.iter());
46413
46414        params.push("alt", "json");
46415        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/eventTags";
46416        if self._scopes.is_empty() {
46417            self._scopes
46418                .insert(Scope::Dfatrafficking.as_ref().to_string());
46419        }
46420
46421        #[allow(clippy::single_element_loop)]
46422        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
46423            url = params.uri_replacement(url, param_name, find_this, false);
46424        }
46425        {
46426            let to_remove = ["profileId"];
46427            params.remove_params(&to_remove);
46428        }
46429
46430        let url = params.parse_with_url(&url);
46431
46432        let mut json_mime_type = mime::APPLICATION_JSON;
46433        let mut request_value_reader = {
46434            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
46435            common::remove_json_null_values(&mut value);
46436            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
46437            serde_json::to_writer(&mut dst, &value).unwrap();
46438            dst
46439        };
46440        let request_size = request_value_reader
46441            .seek(std::io::SeekFrom::End(0))
46442            .unwrap();
46443        request_value_reader
46444            .seek(std::io::SeekFrom::Start(0))
46445            .unwrap();
46446
46447        loop {
46448            let token = match self
46449                .hub
46450                .auth
46451                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
46452                .await
46453            {
46454                Ok(token) => token,
46455                Err(e) => match dlg.token(e) {
46456                    Ok(token) => token,
46457                    Err(e) => {
46458                        dlg.finished(false);
46459                        return Err(common::Error::MissingToken(e));
46460                    }
46461                },
46462            };
46463            request_value_reader
46464                .seek(std::io::SeekFrom::Start(0))
46465                .unwrap();
46466            let mut req_result = {
46467                let client = &self.hub.client;
46468                dlg.pre_request();
46469                let mut req_builder = hyper::Request::builder()
46470                    .method(hyper::Method::PUT)
46471                    .uri(url.as_str())
46472                    .header(USER_AGENT, self.hub._user_agent.clone());
46473
46474                if let Some(token) = token.as_ref() {
46475                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
46476                }
46477
46478                let request = req_builder
46479                    .header(CONTENT_TYPE, json_mime_type.to_string())
46480                    .header(CONTENT_LENGTH, request_size as u64)
46481                    .body(common::to_body(
46482                        request_value_reader.get_ref().clone().into(),
46483                    ));
46484
46485                client.request(request.unwrap()).await
46486            };
46487
46488            match req_result {
46489                Err(err) => {
46490                    if let common::Retry::After(d) = dlg.http_error(&err) {
46491                        sleep(d).await;
46492                        continue;
46493                    }
46494                    dlg.finished(false);
46495                    return Err(common::Error::HttpError(err));
46496                }
46497                Ok(res) => {
46498                    let (mut parts, body) = res.into_parts();
46499                    let mut body = common::Body::new(body);
46500                    if !parts.status.is_success() {
46501                        let bytes = common::to_bytes(body).await.unwrap_or_default();
46502                        let error = serde_json::from_str(&common::to_string(&bytes));
46503                        let response = common::to_response(parts, bytes.into());
46504
46505                        if let common::Retry::After(d) =
46506                            dlg.http_failure(&response, error.as_ref().ok())
46507                        {
46508                            sleep(d).await;
46509                            continue;
46510                        }
46511
46512                        dlg.finished(false);
46513
46514                        return Err(match error {
46515                            Ok(value) => common::Error::BadRequest(value),
46516                            _ => common::Error::Failure(response),
46517                        });
46518                    }
46519                    let response = {
46520                        let bytes = common::to_bytes(body).await.unwrap_or_default();
46521                        let encoded = common::to_string(&bytes);
46522                        match serde_json::from_str(&encoded) {
46523                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
46524                            Err(error) => {
46525                                dlg.response_json_decode_error(&encoded, &error);
46526                                return Err(common::Error::JsonDecodeError(
46527                                    encoded.to_string(),
46528                                    error,
46529                                ));
46530                            }
46531                        }
46532                    };
46533
46534                    dlg.finished(true);
46535                    return Ok(response);
46536                }
46537            }
46538        }
46539    }
46540
46541    ///
46542    /// Sets the *request* property to the given value.
46543    ///
46544    /// Even though the property as already been set when instantiating this call,
46545    /// we provide this method for API completeness.
46546    pub fn request(mut self, new_value: EventTag) -> EventTagUpdateCall<'a, C> {
46547        self._request = new_value;
46548        self
46549    }
46550    /// User profile ID associated with this request.
46551    ///
46552    /// Sets the *profile id* path property to the given value.
46553    ///
46554    /// Even though the property as already been set when instantiating this call,
46555    /// we provide this method for API completeness.
46556    pub fn profile_id(mut self, new_value: i64) -> EventTagUpdateCall<'a, C> {
46557        self._profile_id = new_value;
46558        self
46559    }
46560    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
46561    /// while executing the actual API request.
46562    ///
46563    /// ````text
46564    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
46565    /// ````
46566    ///
46567    /// Sets the *delegate* property to the given value.
46568    pub fn delegate(
46569        mut self,
46570        new_value: &'a mut dyn common::Delegate,
46571    ) -> EventTagUpdateCall<'a, C> {
46572        self._delegate = Some(new_value);
46573        self
46574    }
46575
46576    /// Set any additional parameter of the query string used in the request.
46577    /// It should be used to set parameters which are not yet available through their own
46578    /// setters.
46579    ///
46580    /// Please note that this method must not be used to set any of the known parameters
46581    /// which have their own setter method. If done anyway, the request will fail.
46582    ///
46583    /// # Additional Parameters
46584    ///
46585    /// * *$.xgafv* (query-string) - V1 error format.
46586    /// * *access_token* (query-string) - OAuth access token.
46587    /// * *alt* (query-string) - Data format for response.
46588    /// * *callback* (query-string) - JSONP
46589    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
46590    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
46591    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
46592    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
46593    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
46594    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
46595    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
46596    pub fn param<T>(mut self, name: T, value: T) -> EventTagUpdateCall<'a, C>
46597    where
46598        T: AsRef<str>,
46599    {
46600        self._additional_params
46601            .insert(name.as_ref().to_string(), value.as_ref().to_string());
46602        self
46603    }
46604
46605    /// Identifies the authorization scope for the method you are building.
46606    ///
46607    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
46608    /// [`Scope::Dfatrafficking`].
46609    ///
46610    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
46611    /// tokens for more than one scope.
46612    ///
46613    /// Usually there is more than one suitable scope to authorize an operation, some of which may
46614    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
46615    /// sufficient, a read-write scope will do as well.
46616    pub fn add_scope<St>(mut self, scope: St) -> EventTagUpdateCall<'a, C>
46617    where
46618        St: AsRef<str>,
46619    {
46620        self._scopes.insert(String::from(scope.as_ref()));
46621        self
46622    }
46623    /// Identifies the authorization scope(s) for the method you are building.
46624    ///
46625    /// See [`Self::add_scope()`] for details.
46626    pub fn add_scopes<I, St>(mut self, scopes: I) -> EventTagUpdateCall<'a, C>
46627    where
46628        I: IntoIterator<Item = St>,
46629        St: AsRef<str>,
46630    {
46631        self._scopes
46632            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
46633        self
46634    }
46635
46636    /// Removes all scopes, and no default scope will be used either.
46637    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
46638    /// for details).
46639    pub fn clear_scopes(mut self) -> EventTagUpdateCall<'a, C> {
46640        self._scopes.clear();
46641        self
46642    }
46643}
46644
46645/// Retrieves a report file by its report ID and file ID. This method supports media download.
46646///
46647/// This method supports **media download**. To enable it, adjust the builder like this:
46648/// `.param("alt", "media")`.
46649/// Please note that due to missing multi-part support on the server side, you will only receive the media,
46650/// but not the `File` structure that you would usually get. The latter will be a default value.
46651///
46652/// A builder for the *get* method supported by a *file* resource.
46653/// It is not used directly, but through a [`FileMethods`] instance.
46654///
46655/// # Example
46656///
46657/// Instantiate a resource method builder
46658///
46659/// ```test_harness,no_run
46660/// # extern crate hyper;
46661/// # extern crate hyper_rustls;
46662/// # extern crate google_dfareporting3d3 as dfareporting3d3;
46663/// # async fn dox() {
46664/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
46665///
46666/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
46667/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
46668/// #     secret,
46669/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
46670/// # ).build().await.unwrap();
46671///
46672/// # let client = hyper_util::client::legacy::Client::builder(
46673/// #     hyper_util::rt::TokioExecutor::new()
46674/// # )
46675/// # .build(
46676/// #     hyper_rustls::HttpsConnectorBuilder::new()
46677/// #         .with_native_roots()
46678/// #         .unwrap()
46679/// #         .https_or_http()
46680/// #         .enable_http1()
46681/// #         .build()
46682/// # );
46683/// # let mut hub = Dfareporting::new(client, auth);
46684/// // You can configure optional parameters by calling the respective setters at will, and
46685/// // execute the final call using `doit()`.
46686/// // Values shown here are possibly random and not representative !
46687/// let result = hub.files().get(-66, -35)
46688///              .doit().await;
46689/// # }
46690/// ```
46691pub struct FileGetCall<'a, C>
46692where
46693    C: 'a,
46694{
46695    hub: &'a Dfareporting<C>,
46696    _report_id: i64,
46697    _file_id: i64,
46698    _delegate: Option<&'a mut dyn common::Delegate>,
46699    _additional_params: HashMap<String, String>,
46700    _scopes: BTreeSet<String>,
46701}
46702
46703impl<'a, C> common::CallBuilder for FileGetCall<'a, C> {}
46704
46705impl<'a, C> FileGetCall<'a, C>
46706where
46707    C: common::Connector,
46708{
46709    /// Perform the operation you have build so far.
46710    pub async fn doit(mut self) -> common::Result<(common::Response, File)> {
46711        use std::borrow::Cow;
46712        use std::io::{Read, Seek};
46713
46714        use common::{url::Params, ToParts};
46715        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
46716
46717        let mut dd = common::DefaultDelegate;
46718        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
46719        dlg.begin(common::MethodInfo {
46720            id: "dfareporting.files.get",
46721            http_method: hyper::Method::GET,
46722        });
46723
46724        for &field in ["reportId", "fileId"].iter() {
46725            if self._additional_params.contains_key(field) {
46726                dlg.finished(false);
46727                return Err(common::Error::FieldClash(field));
46728            }
46729        }
46730
46731        let mut params = Params::with_capacity(3 + self._additional_params.len());
46732        params.push("reportId", self._report_id.to_string());
46733        params.push("fileId", self._file_id.to_string());
46734
46735        params.extend(self._additional_params.iter());
46736
46737        let (alt_field_missing, enable_resource_parsing) = {
46738            if let Some(value) = params.get("alt") {
46739                (false, value == "json")
46740            } else {
46741                (true, true)
46742            }
46743        };
46744        if alt_field_missing {
46745            params.push("alt", "json");
46746        }
46747        let mut url = self.hub._base_url.clone() + "reports/{reportId}/files/{fileId}";
46748        if self._scopes.is_empty() {
46749            self._scopes.insert(Scope::Full.as_ref().to_string());
46750        }
46751
46752        #[allow(clippy::single_element_loop)]
46753        for &(find_this, param_name) in [("{reportId}", "reportId"), ("{fileId}", "fileId")].iter()
46754        {
46755            url = params.uri_replacement(url, param_name, find_this, false);
46756        }
46757        {
46758            let to_remove = ["fileId", "reportId"];
46759            params.remove_params(&to_remove);
46760        }
46761
46762        let url = params.parse_with_url(&url);
46763
46764        loop {
46765            let token = match self
46766                .hub
46767                .auth
46768                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
46769                .await
46770            {
46771                Ok(token) => token,
46772                Err(e) => match dlg.token(e) {
46773                    Ok(token) => token,
46774                    Err(e) => {
46775                        dlg.finished(false);
46776                        return Err(common::Error::MissingToken(e));
46777                    }
46778                },
46779            };
46780            let mut req_result = {
46781                let client = &self.hub.client;
46782                dlg.pre_request();
46783                let mut req_builder = hyper::Request::builder()
46784                    .method(hyper::Method::GET)
46785                    .uri(url.as_str())
46786                    .header(USER_AGENT, self.hub._user_agent.clone());
46787
46788                if let Some(token) = token.as_ref() {
46789                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
46790                }
46791
46792                let request = req_builder
46793                    .header(CONTENT_LENGTH, 0_u64)
46794                    .body(common::to_body::<String>(None));
46795
46796                client.request(request.unwrap()).await
46797            };
46798
46799            match req_result {
46800                Err(err) => {
46801                    if let common::Retry::After(d) = dlg.http_error(&err) {
46802                        sleep(d).await;
46803                        continue;
46804                    }
46805                    dlg.finished(false);
46806                    return Err(common::Error::HttpError(err));
46807                }
46808                Ok(res) => {
46809                    let (mut parts, body) = res.into_parts();
46810                    let mut body = common::Body::new(body);
46811                    if !parts.status.is_success() {
46812                        let bytes = common::to_bytes(body).await.unwrap_or_default();
46813                        let error = serde_json::from_str(&common::to_string(&bytes));
46814                        let response = common::to_response(parts, bytes.into());
46815
46816                        if let common::Retry::After(d) =
46817                            dlg.http_failure(&response, error.as_ref().ok())
46818                        {
46819                            sleep(d).await;
46820                            continue;
46821                        }
46822
46823                        dlg.finished(false);
46824
46825                        return Err(match error {
46826                            Ok(value) => common::Error::BadRequest(value),
46827                            _ => common::Error::Failure(response),
46828                        });
46829                    }
46830                    let response = if enable_resource_parsing {
46831                        let bytes = common::to_bytes(body).await.unwrap_or_default();
46832                        let encoded = common::to_string(&bytes);
46833                        match serde_json::from_str(&encoded) {
46834                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
46835                            Err(error) => {
46836                                dlg.response_json_decode_error(&encoded, &error);
46837                                return Err(common::Error::JsonDecodeError(
46838                                    encoded.to_string(),
46839                                    error,
46840                                ));
46841                            }
46842                        }
46843                    } else {
46844                        (
46845                            common::Response::from_parts(parts, body),
46846                            Default::default(),
46847                        )
46848                    };
46849
46850                    dlg.finished(true);
46851                    return Ok(response);
46852                }
46853            }
46854        }
46855    }
46856
46857    /// The ID of the report.
46858    ///
46859    /// Sets the *report id* path property to the given value.
46860    ///
46861    /// Even though the property as already been set when instantiating this call,
46862    /// we provide this method for API completeness.
46863    pub fn report_id(mut self, new_value: i64) -> FileGetCall<'a, C> {
46864        self._report_id = new_value;
46865        self
46866    }
46867    /// The ID of the report file.
46868    ///
46869    /// Sets the *file id* path property to the given value.
46870    ///
46871    /// Even though the property as already been set when instantiating this call,
46872    /// we provide this method for API completeness.
46873    pub fn file_id(mut self, new_value: i64) -> FileGetCall<'a, C> {
46874        self._file_id = new_value;
46875        self
46876    }
46877    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
46878    /// while executing the actual API request.
46879    ///
46880    /// ````text
46881    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
46882    /// ````
46883    ///
46884    /// Sets the *delegate* property to the given value.
46885    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> FileGetCall<'a, C> {
46886        self._delegate = Some(new_value);
46887        self
46888    }
46889
46890    /// Set any additional parameter of the query string used in the request.
46891    /// It should be used to set parameters which are not yet available through their own
46892    /// setters.
46893    ///
46894    /// Please note that this method must not be used to set any of the known parameters
46895    /// which have their own setter method. If done anyway, the request will fail.
46896    ///
46897    /// # Additional Parameters
46898    ///
46899    /// * *$.xgafv* (query-string) - V1 error format.
46900    /// * *access_token* (query-string) - OAuth access token.
46901    /// * *alt* (query-string) - Data format for response.
46902    /// * *callback* (query-string) - JSONP
46903    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
46904    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
46905    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
46906    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
46907    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
46908    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
46909    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
46910    pub fn param<T>(mut self, name: T, value: T) -> FileGetCall<'a, C>
46911    where
46912        T: AsRef<str>,
46913    {
46914        self._additional_params
46915            .insert(name.as_ref().to_string(), value.as_ref().to_string());
46916        self
46917    }
46918
46919    /// Identifies the authorization scope for the method you are building.
46920    ///
46921    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
46922    /// [`Scope::Full`].
46923    ///
46924    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
46925    /// tokens for more than one scope.
46926    ///
46927    /// Usually there is more than one suitable scope to authorize an operation, some of which may
46928    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
46929    /// sufficient, a read-write scope will do as well.
46930    pub fn add_scope<St>(mut self, scope: St) -> FileGetCall<'a, C>
46931    where
46932        St: AsRef<str>,
46933    {
46934        self._scopes.insert(String::from(scope.as_ref()));
46935        self
46936    }
46937    /// Identifies the authorization scope(s) for the method you are building.
46938    ///
46939    /// See [`Self::add_scope()`] for details.
46940    pub fn add_scopes<I, St>(mut self, scopes: I) -> FileGetCall<'a, C>
46941    where
46942        I: IntoIterator<Item = St>,
46943        St: AsRef<str>,
46944    {
46945        self._scopes
46946            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
46947        self
46948    }
46949
46950    /// Removes all scopes, and no default scope will be used either.
46951    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
46952    /// for details).
46953    pub fn clear_scopes(mut self) -> FileGetCall<'a, C> {
46954        self._scopes.clear();
46955        self
46956    }
46957}
46958
46959/// Lists files for a user profile.
46960///
46961/// A builder for the *list* method supported by a *file* resource.
46962/// It is not used directly, but through a [`FileMethods`] instance.
46963///
46964/// # Example
46965///
46966/// Instantiate a resource method builder
46967///
46968/// ```test_harness,no_run
46969/// # extern crate hyper;
46970/// # extern crate hyper_rustls;
46971/// # extern crate google_dfareporting3d3 as dfareporting3d3;
46972/// # async fn dox() {
46973/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
46974///
46975/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
46976/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
46977/// #     secret,
46978/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
46979/// # ).build().await.unwrap();
46980///
46981/// # let client = hyper_util::client::legacy::Client::builder(
46982/// #     hyper_util::rt::TokioExecutor::new()
46983/// # )
46984/// # .build(
46985/// #     hyper_rustls::HttpsConnectorBuilder::new()
46986/// #         .with_native_roots()
46987/// #         .unwrap()
46988/// #         .https_or_http()
46989/// #         .enable_http1()
46990/// #         .build()
46991/// # );
46992/// # let mut hub = Dfareporting::new(client, auth);
46993/// // You can configure optional parameters by calling the respective setters at will, and
46994/// // execute the final call using `doit()`.
46995/// // Values shown here are possibly random and not representative !
46996/// let result = hub.files().list(-30)
46997///              .sort_order("Stet")
46998///              .sort_field("aliquyam")
46999///              .scope("kasd")
47000///              .page_token("Lorem")
47001///              .max_results(-48)
47002///              .doit().await;
47003/// # }
47004/// ```
47005pub struct FileListCall<'a, C>
47006where
47007    C: 'a,
47008{
47009    hub: &'a Dfareporting<C>,
47010    _profile_id: i64,
47011    _sort_order: Option<String>,
47012    _sort_field: Option<String>,
47013    _scope: Option<String>,
47014    _page_token: Option<String>,
47015    _max_results: Option<i32>,
47016    _delegate: Option<&'a mut dyn common::Delegate>,
47017    _additional_params: HashMap<String, String>,
47018    _scopes: BTreeSet<String>,
47019}
47020
47021impl<'a, C> common::CallBuilder for FileListCall<'a, C> {}
47022
47023impl<'a, C> FileListCall<'a, C>
47024where
47025    C: common::Connector,
47026{
47027    /// Perform the operation you have build so far.
47028    pub async fn doit(mut self) -> common::Result<(common::Response, FileList)> {
47029        use std::borrow::Cow;
47030        use std::io::{Read, Seek};
47031
47032        use common::{url::Params, ToParts};
47033        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
47034
47035        let mut dd = common::DefaultDelegate;
47036        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
47037        dlg.begin(common::MethodInfo {
47038            id: "dfareporting.files.list",
47039            http_method: hyper::Method::GET,
47040        });
47041
47042        for &field in [
47043            "alt",
47044            "profileId",
47045            "sortOrder",
47046            "sortField",
47047            "scope",
47048            "pageToken",
47049            "maxResults",
47050        ]
47051        .iter()
47052        {
47053            if self._additional_params.contains_key(field) {
47054                dlg.finished(false);
47055                return Err(common::Error::FieldClash(field));
47056            }
47057        }
47058
47059        let mut params = Params::with_capacity(8 + self._additional_params.len());
47060        params.push("profileId", self._profile_id.to_string());
47061        if let Some(value) = self._sort_order.as_ref() {
47062            params.push("sortOrder", value);
47063        }
47064        if let Some(value) = self._sort_field.as_ref() {
47065            params.push("sortField", value);
47066        }
47067        if let Some(value) = self._scope.as_ref() {
47068            params.push("scope", value);
47069        }
47070        if let Some(value) = self._page_token.as_ref() {
47071            params.push("pageToken", value);
47072        }
47073        if let Some(value) = self._max_results.as_ref() {
47074            params.push("maxResults", value.to_string());
47075        }
47076
47077        params.extend(self._additional_params.iter());
47078
47079        params.push("alt", "json");
47080        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/files";
47081        if self._scopes.is_empty() {
47082            self._scopes.insert(Scope::Full.as_ref().to_string());
47083        }
47084
47085        #[allow(clippy::single_element_loop)]
47086        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
47087            url = params.uri_replacement(url, param_name, find_this, false);
47088        }
47089        {
47090            let to_remove = ["profileId"];
47091            params.remove_params(&to_remove);
47092        }
47093
47094        let url = params.parse_with_url(&url);
47095
47096        loop {
47097            let token = match self
47098                .hub
47099                .auth
47100                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
47101                .await
47102            {
47103                Ok(token) => token,
47104                Err(e) => match dlg.token(e) {
47105                    Ok(token) => token,
47106                    Err(e) => {
47107                        dlg.finished(false);
47108                        return Err(common::Error::MissingToken(e));
47109                    }
47110                },
47111            };
47112            let mut req_result = {
47113                let client = &self.hub.client;
47114                dlg.pre_request();
47115                let mut req_builder = hyper::Request::builder()
47116                    .method(hyper::Method::GET)
47117                    .uri(url.as_str())
47118                    .header(USER_AGENT, self.hub._user_agent.clone());
47119
47120                if let Some(token) = token.as_ref() {
47121                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
47122                }
47123
47124                let request = req_builder
47125                    .header(CONTENT_LENGTH, 0_u64)
47126                    .body(common::to_body::<String>(None));
47127
47128                client.request(request.unwrap()).await
47129            };
47130
47131            match req_result {
47132                Err(err) => {
47133                    if let common::Retry::After(d) = dlg.http_error(&err) {
47134                        sleep(d).await;
47135                        continue;
47136                    }
47137                    dlg.finished(false);
47138                    return Err(common::Error::HttpError(err));
47139                }
47140                Ok(res) => {
47141                    let (mut parts, body) = res.into_parts();
47142                    let mut body = common::Body::new(body);
47143                    if !parts.status.is_success() {
47144                        let bytes = common::to_bytes(body).await.unwrap_or_default();
47145                        let error = serde_json::from_str(&common::to_string(&bytes));
47146                        let response = common::to_response(parts, bytes.into());
47147
47148                        if let common::Retry::After(d) =
47149                            dlg.http_failure(&response, error.as_ref().ok())
47150                        {
47151                            sleep(d).await;
47152                            continue;
47153                        }
47154
47155                        dlg.finished(false);
47156
47157                        return Err(match error {
47158                            Ok(value) => common::Error::BadRequest(value),
47159                            _ => common::Error::Failure(response),
47160                        });
47161                    }
47162                    let response = {
47163                        let bytes = common::to_bytes(body).await.unwrap_or_default();
47164                        let encoded = common::to_string(&bytes);
47165                        match serde_json::from_str(&encoded) {
47166                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
47167                            Err(error) => {
47168                                dlg.response_json_decode_error(&encoded, &error);
47169                                return Err(common::Error::JsonDecodeError(
47170                                    encoded.to_string(),
47171                                    error,
47172                                ));
47173                            }
47174                        }
47175                    };
47176
47177                    dlg.finished(true);
47178                    return Ok(response);
47179                }
47180            }
47181        }
47182    }
47183
47184    /// The Campaign Manager 360 user profile ID.
47185    ///
47186    /// Sets the *profile id* path property to the given value.
47187    ///
47188    /// Even though the property as already been set when instantiating this call,
47189    /// we provide this method for API completeness.
47190    pub fn profile_id(mut self, new_value: i64) -> FileListCall<'a, C> {
47191        self._profile_id = new_value;
47192        self
47193    }
47194    /// Order of sorted results.
47195    ///
47196    /// Sets the *sort order* query property to the given value.
47197    pub fn sort_order(mut self, new_value: &str) -> FileListCall<'a, C> {
47198        self._sort_order = Some(new_value.to_string());
47199        self
47200    }
47201    /// The field by which to sort the list.
47202    ///
47203    /// Sets the *sort field* query property to the given value.
47204    pub fn sort_field(mut self, new_value: &str) -> FileListCall<'a, C> {
47205        self._sort_field = Some(new_value.to_string());
47206        self
47207    }
47208    /// The scope that defines which results are returned.
47209    ///
47210    /// Sets the *scope* query property to the given value.
47211    pub fn scope(mut self, new_value: &str) -> FileListCall<'a, C> {
47212        self._scope = Some(new_value.to_string());
47213        self
47214    }
47215    /// The value of the nextToken from the previous result page.
47216    ///
47217    /// Sets the *page token* query property to the given value.
47218    pub fn page_token(mut self, new_value: &str) -> FileListCall<'a, C> {
47219        self._page_token = Some(new_value.to_string());
47220        self
47221    }
47222    /// Maximum number of results to return.
47223    ///
47224    /// Sets the *max results* query property to the given value.
47225    pub fn max_results(mut self, new_value: i32) -> FileListCall<'a, C> {
47226        self._max_results = Some(new_value);
47227        self
47228    }
47229    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
47230    /// while executing the actual API request.
47231    ///
47232    /// ````text
47233    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
47234    /// ````
47235    ///
47236    /// Sets the *delegate* property to the given value.
47237    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> FileListCall<'a, C> {
47238        self._delegate = Some(new_value);
47239        self
47240    }
47241
47242    /// Set any additional parameter of the query string used in the request.
47243    /// It should be used to set parameters which are not yet available through their own
47244    /// setters.
47245    ///
47246    /// Please note that this method must not be used to set any of the known parameters
47247    /// which have their own setter method. If done anyway, the request will fail.
47248    ///
47249    /// # Additional Parameters
47250    ///
47251    /// * *$.xgafv* (query-string) - V1 error format.
47252    /// * *access_token* (query-string) - OAuth access token.
47253    /// * *alt* (query-string) - Data format for response.
47254    /// * *callback* (query-string) - JSONP
47255    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
47256    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
47257    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
47258    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
47259    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
47260    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
47261    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
47262    pub fn param<T>(mut self, name: T, value: T) -> FileListCall<'a, C>
47263    where
47264        T: AsRef<str>,
47265    {
47266        self._additional_params
47267            .insert(name.as_ref().to_string(), value.as_ref().to_string());
47268        self
47269    }
47270
47271    /// Identifies the authorization scope for the method you are building.
47272    ///
47273    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
47274    /// [`Scope::Full`].
47275    ///
47276    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
47277    /// tokens for more than one scope.
47278    ///
47279    /// Usually there is more than one suitable scope to authorize an operation, some of which may
47280    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
47281    /// sufficient, a read-write scope will do as well.
47282    pub fn add_scope<St>(mut self, scope: St) -> FileListCall<'a, C>
47283    where
47284        St: AsRef<str>,
47285    {
47286        self._scopes.insert(String::from(scope.as_ref()));
47287        self
47288    }
47289    /// Identifies the authorization scope(s) for the method you are building.
47290    ///
47291    /// See [`Self::add_scope()`] for details.
47292    pub fn add_scopes<I, St>(mut self, scopes: I) -> FileListCall<'a, C>
47293    where
47294        I: IntoIterator<Item = St>,
47295        St: AsRef<str>,
47296    {
47297        self._scopes
47298            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
47299        self
47300    }
47301
47302    /// Removes all scopes, and no default scope will be used either.
47303    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
47304    /// for details).
47305    pub fn clear_scopes(mut self) -> FileListCall<'a, C> {
47306        self._scopes.clear();
47307        self
47308    }
47309}
47310
47311/// Deletes an existing floodlight activity.
47312///
47313/// A builder for the *delete* method supported by a *floodlightActivity* resource.
47314/// It is not used directly, but through a [`FloodlightActivityMethods`] instance.
47315///
47316/// # Example
47317///
47318/// Instantiate a resource method builder
47319///
47320/// ```test_harness,no_run
47321/// # extern crate hyper;
47322/// # extern crate hyper_rustls;
47323/// # extern crate google_dfareporting3d3 as dfareporting3d3;
47324/// # async fn dox() {
47325/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
47326///
47327/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
47328/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
47329/// #     secret,
47330/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
47331/// # ).build().await.unwrap();
47332///
47333/// # let client = hyper_util::client::legacy::Client::builder(
47334/// #     hyper_util::rt::TokioExecutor::new()
47335/// # )
47336/// # .build(
47337/// #     hyper_rustls::HttpsConnectorBuilder::new()
47338/// #         .with_native_roots()
47339/// #         .unwrap()
47340/// #         .https_or_http()
47341/// #         .enable_http1()
47342/// #         .build()
47343/// # );
47344/// # let mut hub = Dfareporting::new(client, auth);
47345/// // You can configure optional parameters by calling the respective setters at will, and
47346/// // execute the final call using `doit()`.
47347/// // Values shown here are possibly random and not representative !
47348/// let result = hub.floodlight_activities().delete(-63, -39)
47349///              .doit().await;
47350/// # }
47351/// ```
47352pub struct FloodlightActivityDeleteCall<'a, C>
47353where
47354    C: 'a,
47355{
47356    hub: &'a Dfareporting<C>,
47357    _profile_id: i64,
47358    _id: i64,
47359    _delegate: Option<&'a mut dyn common::Delegate>,
47360    _additional_params: HashMap<String, String>,
47361    _scopes: BTreeSet<String>,
47362}
47363
47364impl<'a, C> common::CallBuilder for FloodlightActivityDeleteCall<'a, C> {}
47365
47366impl<'a, C> FloodlightActivityDeleteCall<'a, C>
47367where
47368    C: common::Connector,
47369{
47370    /// Perform the operation you have build so far.
47371    pub async fn doit(mut self) -> common::Result<common::Response> {
47372        use std::borrow::Cow;
47373        use std::io::{Read, Seek};
47374
47375        use common::{url::Params, ToParts};
47376        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
47377
47378        let mut dd = common::DefaultDelegate;
47379        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
47380        dlg.begin(common::MethodInfo {
47381            id: "dfareporting.floodlightActivities.delete",
47382            http_method: hyper::Method::DELETE,
47383        });
47384
47385        for &field in ["profileId", "id"].iter() {
47386            if self._additional_params.contains_key(field) {
47387                dlg.finished(false);
47388                return Err(common::Error::FieldClash(field));
47389            }
47390        }
47391
47392        let mut params = Params::with_capacity(3 + self._additional_params.len());
47393        params.push("profileId", self._profile_id.to_string());
47394        params.push("id", self._id.to_string());
47395
47396        params.extend(self._additional_params.iter());
47397
47398        let mut url =
47399            self.hub._base_url.clone() + "userprofiles/{profileId}/floodlightActivities/{id}";
47400        if self._scopes.is_empty() {
47401            self._scopes
47402                .insert(Scope::Dfatrafficking.as_ref().to_string());
47403        }
47404
47405        #[allow(clippy::single_element_loop)]
47406        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
47407            url = params.uri_replacement(url, param_name, find_this, false);
47408        }
47409        {
47410            let to_remove = ["id", "profileId"];
47411            params.remove_params(&to_remove);
47412        }
47413
47414        let url = params.parse_with_url(&url);
47415
47416        loop {
47417            let token = match self
47418                .hub
47419                .auth
47420                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
47421                .await
47422            {
47423                Ok(token) => token,
47424                Err(e) => match dlg.token(e) {
47425                    Ok(token) => token,
47426                    Err(e) => {
47427                        dlg.finished(false);
47428                        return Err(common::Error::MissingToken(e));
47429                    }
47430                },
47431            };
47432            let mut req_result = {
47433                let client = &self.hub.client;
47434                dlg.pre_request();
47435                let mut req_builder = hyper::Request::builder()
47436                    .method(hyper::Method::DELETE)
47437                    .uri(url.as_str())
47438                    .header(USER_AGENT, self.hub._user_agent.clone());
47439
47440                if let Some(token) = token.as_ref() {
47441                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
47442                }
47443
47444                let request = req_builder
47445                    .header(CONTENT_LENGTH, 0_u64)
47446                    .body(common::to_body::<String>(None));
47447
47448                client.request(request.unwrap()).await
47449            };
47450
47451            match req_result {
47452                Err(err) => {
47453                    if let common::Retry::After(d) = dlg.http_error(&err) {
47454                        sleep(d).await;
47455                        continue;
47456                    }
47457                    dlg.finished(false);
47458                    return Err(common::Error::HttpError(err));
47459                }
47460                Ok(res) => {
47461                    let (mut parts, body) = res.into_parts();
47462                    let mut body = common::Body::new(body);
47463                    if !parts.status.is_success() {
47464                        let bytes = common::to_bytes(body).await.unwrap_or_default();
47465                        let error = serde_json::from_str(&common::to_string(&bytes));
47466                        let response = common::to_response(parts, bytes.into());
47467
47468                        if let common::Retry::After(d) =
47469                            dlg.http_failure(&response, error.as_ref().ok())
47470                        {
47471                            sleep(d).await;
47472                            continue;
47473                        }
47474
47475                        dlg.finished(false);
47476
47477                        return Err(match error {
47478                            Ok(value) => common::Error::BadRequest(value),
47479                            _ => common::Error::Failure(response),
47480                        });
47481                    }
47482                    let response = common::Response::from_parts(parts, body);
47483
47484                    dlg.finished(true);
47485                    return Ok(response);
47486                }
47487            }
47488        }
47489    }
47490
47491    /// User profile ID associated with this request.
47492    ///
47493    /// Sets the *profile id* path property to the given value.
47494    ///
47495    /// Even though the property as already been set when instantiating this call,
47496    /// we provide this method for API completeness.
47497    pub fn profile_id(mut self, new_value: i64) -> FloodlightActivityDeleteCall<'a, C> {
47498        self._profile_id = new_value;
47499        self
47500    }
47501    /// Floodlight activity ID.
47502    ///
47503    /// Sets the *id* path property to the given value.
47504    ///
47505    /// Even though the property as already been set when instantiating this call,
47506    /// we provide this method for API completeness.
47507    pub fn id(mut self, new_value: i64) -> FloodlightActivityDeleteCall<'a, C> {
47508        self._id = new_value;
47509        self
47510    }
47511    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
47512    /// while executing the actual API request.
47513    ///
47514    /// ````text
47515    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
47516    /// ````
47517    ///
47518    /// Sets the *delegate* property to the given value.
47519    pub fn delegate(
47520        mut self,
47521        new_value: &'a mut dyn common::Delegate,
47522    ) -> FloodlightActivityDeleteCall<'a, C> {
47523        self._delegate = Some(new_value);
47524        self
47525    }
47526
47527    /// Set any additional parameter of the query string used in the request.
47528    /// It should be used to set parameters which are not yet available through their own
47529    /// setters.
47530    ///
47531    /// Please note that this method must not be used to set any of the known parameters
47532    /// which have their own setter method. If done anyway, the request will fail.
47533    ///
47534    /// # Additional Parameters
47535    ///
47536    /// * *$.xgafv* (query-string) - V1 error format.
47537    /// * *access_token* (query-string) - OAuth access token.
47538    /// * *alt* (query-string) - Data format for response.
47539    /// * *callback* (query-string) - JSONP
47540    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
47541    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
47542    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
47543    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
47544    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
47545    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
47546    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
47547    pub fn param<T>(mut self, name: T, value: T) -> FloodlightActivityDeleteCall<'a, C>
47548    where
47549        T: AsRef<str>,
47550    {
47551        self._additional_params
47552            .insert(name.as_ref().to_string(), value.as_ref().to_string());
47553        self
47554    }
47555
47556    /// Identifies the authorization scope for the method you are building.
47557    ///
47558    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
47559    /// [`Scope::Dfatrafficking`].
47560    ///
47561    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
47562    /// tokens for more than one scope.
47563    ///
47564    /// Usually there is more than one suitable scope to authorize an operation, some of which may
47565    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
47566    /// sufficient, a read-write scope will do as well.
47567    pub fn add_scope<St>(mut self, scope: St) -> FloodlightActivityDeleteCall<'a, C>
47568    where
47569        St: AsRef<str>,
47570    {
47571        self._scopes.insert(String::from(scope.as_ref()));
47572        self
47573    }
47574    /// Identifies the authorization scope(s) for the method you are building.
47575    ///
47576    /// See [`Self::add_scope()`] for details.
47577    pub fn add_scopes<I, St>(mut self, scopes: I) -> FloodlightActivityDeleteCall<'a, C>
47578    where
47579        I: IntoIterator<Item = St>,
47580        St: AsRef<str>,
47581    {
47582        self._scopes
47583            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
47584        self
47585    }
47586
47587    /// Removes all scopes, and no default scope will be used either.
47588    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
47589    /// for details).
47590    pub fn clear_scopes(mut self) -> FloodlightActivityDeleteCall<'a, C> {
47591        self._scopes.clear();
47592        self
47593    }
47594}
47595
47596/// Generates a tag for a floodlight activity.
47597///
47598/// A builder for the *generatetag* method supported by a *floodlightActivity* resource.
47599/// It is not used directly, but through a [`FloodlightActivityMethods`] instance.
47600///
47601/// # Example
47602///
47603/// Instantiate a resource method builder
47604///
47605/// ```test_harness,no_run
47606/// # extern crate hyper;
47607/// # extern crate hyper_rustls;
47608/// # extern crate google_dfareporting3d3 as dfareporting3d3;
47609/// # async fn dox() {
47610/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
47611///
47612/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
47613/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
47614/// #     secret,
47615/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
47616/// # ).build().await.unwrap();
47617///
47618/// # let client = hyper_util::client::legacy::Client::builder(
47619/// #     hyper_util::rt::TokioExecutor::new()
47620/// # )
47621/// # .build(
47622/// #     hyper_rustls::HttpsConnectorBuilder::new()
47623/// #         .with_native_roots()
47624/// #         .unwrap()
47625/// #         .https_or_http()
47626/// #         .enable_http1()
47627/// #         .build()
47628/// # );
47629/// # let mut hub = Dfareporting::new(client, auth);
47630/// // You can configure optional parameters by calling the respective setters at will, and
47631/// // execute the final call using `doit()`.
47632/// // Values shown here are possibly random and not representative !
47633/// let result = hub.floodlight_activities().generatetag(-54)
47634///              .floodlight_activity_id(-97)
47635///              .doit().await;
47636/// # }
47637/// ```
47638pub struct FloodlightActivityGeneratetagCall<'a, C>
47639where
47640    C: 'a,
47641{
47642    hub: &'a Dfareporting<C>,
47643    _profile_id: i64,
47644    _floodlight_activity_id: Option<i64>,
47645    _delegate: Option<&'a mut dyn common::Delegate>,
47646    _additional_params: HashMap<String, String>,
47647    _scopes: BTreeSet<String>,
47648}
47649
47650impl<'a, C> common::CallBuilder for FloodlightActivityGeneratetagCall<'a, C> {}
47651
47652impl<'a, C> FloodlightActivityGeneratetagCall<'a, C>
47653where
47654    C: common::Connector,
47655{
47656    /// Perform the operation you have build so far.
47657    pub async fn doit(
47658        mut self,
47659    ) -> common::Result<(common::Response, FloodlightActivitiesGenerateTagResponse)> {
47660        use std::borrow::Cow;
47661        use std::io::{Read, Seek};
47662
47663        use common::{url::Params, ToParts};
47664        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
47665
47666        let mut dd = common::DefaultDelegate;
47667        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
47668        dlg.begin(common::MethodInfo {
47669            id: "dfareporting.floodlightActivities.generatetag",
47670            http_method: hyper::Method::POST,
47671        });
47672
47673        for &field in ["alt", "profileId", "floodlightActivityId"].iter() {
47674            if self._additional_params.contains_key(field) {
47675                dlg.finished(false);
47676                return Err(common::Error::FieldClash(field));
47677            }
47678        }
47679
47680        let mut params = Params::with_capacity(4 + self._additional_params.len());
47681        params.push("profileId", self._profile_id.to_string());
47682        if let Some(value) = self._floodlight_activity_id.as_ref() {
47683            params.push("floodlightActivityId", value.to_string());
47684        }
47685
47686        params.extend(self._additional_params.iter());
47687
47688        params.push("alt", "json");
47689        let mut url = self.hub._base_url.clone()
47690            + "userprofiles/{profileId}/floodlightActivities/generatetag";
47691        if self._scopes.is_empty() {
47692            self._scopes
47693                .insert(Scope::Dfatrafficking.as_ref().to_string());
47694        }
47695
47696        #[allow(clippy::single_element_loop)]
47697        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
47698            url = params.uri_replacement(url, param_name, find_this, false);
47699        }
47700        {
47701            let to_remove = ["profileId"];
47702            params.remove_params(&to_remove);
47703        }
47704
47705        let url = params.parse_with_url(&url);
47706
47707        loop {
47708            let token = match self
47709                .hub
47710                .auth
47711                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
47712                .await
47713            {
47714                Ok(token) => token,
47715                Err(e) => match dlg.token(e) {
47716                    Ok(token) => token,
47717                    Err(e) => {
47718                        dlg.finished(false);
47719                        return Err(common::Error::MissingToken(e));
47720                    }
47721                },
47722            };
47723            let mut req_result = {
47724                let client = &self.hub.client;
47725                dlg.pre_request();
47726                let mut req_builder = hyper::Request::builder()
47727                    .method(hyper::Method::POST)
47728                    .uri(url.as_str())
47729                    .header(USER_AGENT, self.hub._user_agent.clone());
47730
47731                if let Some(token) = token.as_ref() {
47732                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
47733                }
47734
47735                let request = req_builder
47736                    .header(CONTENT_LENGTH, 0_u64)
47737                    .body(common::to_body::<String>(None));
47738
47739                client.request(request.unwrap()).await
47740            };
47741
47742            match req_result {
47743                Err(err) => {
47744                    if let common::Retry::After(d) = dlg.http_error(&err) {
47745                        sleep(d).await;
47746                        continue;
47747                    }
47748                    dlg.finished(false);
47749                    return Err(common::Error::HttpError(err));
47750                }
47751                Ok(res) => {
47752                    let (mut parts, body) = res.into_parts();
47753                    let mut body = common::Body::new(body);
47754                    if !parts.status.is_success() {
47755                        let bytes = common::to_bytes(body).await.unwrap_or_default();
47756                        let error = serde_json::from_str(&common::to_string(&bytes));
47757                        let response = common::to_response(parts, bytes.into());
47758
47759                        if let common::Retry::After(d) =
47760                            dlg.http_failure(&response, error.as_ref().ok())
47761                        {
47762                            sleep(d).await;
47763                            continue;
47764                        }
47765
47766                        dlg.finished(false);
47767
47768                        return Err(match error {
47769                            Ok(value) => common::Error::BadRequest(value),
47770                            _ => common::Error::Failure(response),
47771                        });
47772                    }
47773                    let response = {
47774                        let bytes = common::to_bytes(body).await.unwrap_or_default();
47775                        let encoded = common::to_string(&bytes);
47776                        match serde_json::from_str(&encoded) {
47777                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
47778                            Err(error) => {
47779                                dlg.response_json_decode_error(&encoded, &error);
47780                                return Err(common::Error::JsonDecodeError(
47781                                    encoded.to_string(),
47782                                    error,
47783                                ));
47784                            }
47785                        }
47786                    };
47787
47788                    dlg.finished(true);
47789                    return Ok(response);
47790                }
47791            }
47792        }
47793    }
47794
47795    /// User profile ID associated with this request.
47796    ///
47797    /// Sets the *profile id* path property to the given value.
47798    ///
47799    /// Even though the property as already been set when instantiating this call,
47800    /// we provide this method for API completeness.
47801    pub fn profile_id(mut self, new_value: i64) -> FloodlightActivityGeneratetagCall<'a, C> {
47802        self._profile_id = new_value;
47803        self
47804    }
47805    /// Floodlight activity ID for which we want to generate a tag.
47806    ///
47807    /// Sets the *floodlight activity id* query property to the given value.
47808    pub fn floodlight_activity_id(
47809        mut self,
47810        new_value: i64,
47811    ) -> FloodlightActivityGeneratetagCall<'a, C> {
47812        self._floodlight_activity_id = Some(new_value);
47813        self
47814    }
47815    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
47816    /// while executing the actual API request.
47817    ///
47818    /// ````text
47819    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
47820    /// ````
47821    ///
47822    /// Sets the *delegate* property to the given value.
47823    pub fn delegate(
47824        mut self,
47825        new_value: &'a mut dyn common::Delegate,
47826    ) -> FloodlightActivityGeneratetagCall<'a, C> {
47827        self._delegate = Some(new_value);
47828        self
47829    }
47830
47831    /// Set any additional parameter of the query string used in the request.
47832    /// It should be used to set parameters which are not yet available through their own
47833    /// setters.
47834    ///
47835    /// Please note that this method must not be used to set any of the known parameters
47836    /// which have their own setter method. If done anyway, the request will fail.
47837    ///
47838    /// # Additional Parameters
47839    ///
47840    /// * *$.xgafv* (query-string) - V1 error format.
47841    /// * *access_token* (query-string) - OAuth access token.
47842    /// * *alt* (query-string) - Data format for response.
47843    /// * *callback* (query-string) - JSONP
47844    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
47845    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
47846    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
47847    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
47848    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
47849    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
47850    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
47851    pub fn param<T>(mut self, name: T, value: T) -> FloodlightActivityGeneratetagCall<'a, C>
47852    where
47853        T: AsRef<str>,
47854    {
47855        self._additional_params
47856            .insert(name.as_ref().to_string(), value.as_ref().to_string());
47857        self
47858    }
47859
47860    /// Identifies the authorization scope for the method you are building.
47861    ///
47862    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
47863    /// [`Scope::Dfatrafficking`].
47864    ///
47865    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
47866    /// tokens for more than one scope.
47867    ///
47868    /// Usually there is more than one suitable scope to authorize an operation, some of which may
47869    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
47870    /// sufficient, a read-write scope will do as well.
47871    pub fn add_scope<St>(mut self, scope: St) -> FloodlightActivityGeneratetagCall<'a, C>
47872    where
47873        St: AsRef<str>,
47874    {
47875        self._scopes.insert(String::from(scope.as_ref()));
47876        self
47877    }
47878    /// Identifies the authorization scope(s) for the method you are building.
47879    ///
47880    /// See [`Self::add_scope()`] for details.
47881    pub fn add_scopes<I, St>(mut self, scopes: I) -> FloodlightActivityGeneratetagCall<'a, C>
47882    where
47883        I: IntoIterator<Item = St>,
47884        St: AsRef<str>,
47885    {
47886        self._scopes
47887            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
47888        self
47889    }
47890
47891    /// Removes all scopes, and no default scope will be used either.
47892    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
47893    /// for details).
47894    pub fn clear_scopes(mut self) -> FloodlightActivityGeneratetagCall<'a, C> {
47895        self._scopes.clear();
47896        self
47897    }
47898}
47899
47900/// Gets one floodlight activity by ID.
47901///
47902/// A builder for the *get* method supported by a *floodlightActivity* resource.
47903/// It is not used directly, but through a [`FloodlightActivityMethods`] instance.
47904///
47905/// # Example
47906///
47907/// Instantiate a resource method builder
47908///
47909/// ```test_harness,no_run
47910/// # extern crate hyper;
47911/// # extern crate hyper_rustls;
47912/// # extern crate google_dfareporting3d3 as dfareporting3d3;
47913/// # async fn dox() {
47914/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
47915///
47916/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
47917/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
47918/// #     secret,
47919/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
47920/// # ).build().await.unwrap();
47921///
47922/// # let client = hyper_util::client::legacy::Client::builder(
47923/// #     hyper_util::rt::TokioExecutor::new()
47924/// # )
47925/// # .build(
47926/// #     hyper_rustls::HttpsConnectorBuilder::new()
47927/// #         .with_native_roots()
47928/// #         .unwrap()
47929/// #         .https_or_http()
47930/// #         .enable_http1()
47931/// #         .build()
47932/// # );
47933/// # let mut hub = Dfareporting::new(client, auth);
47934/// // You can configure optional parameters by calling the respective setters at will, and
47935/// // execute the final call using `doit()`.
47936/// // Values shown here are possibly random and not representative !
47937/// let result = hub.floodlight_activities().get(-3, -16)
47938///              .doit().await;
47939/// # }
47940/// ```
47941pub struct FloodlightActivityGetCall<'a, C>
47942where
47943    C: 'a,
47944{
47945    hub: &'a Dfareporting<C>,
47946    _profile_id: i64,
47947    _id: i64,
47948    _delegate: Option<&'a mut dyn common::Delegate>,
47949    _additional_params: HashMap<String, String>,
47950    _scopes: BTreeSet<String>,
47951}
47952
47953impl<'a, C> common::CallBuilder for FloodlightActivityGetCall<'a, C> {}
47954
47955impl<'a, C> FloodlightActivityGetCall<'a, C>
47956where
47957    C: common::Connector,
47958{
47959    /// Perform the operation you have build so far.
47960    pub async fn doit(mut self) -> common::Result<(common::Response, FloodlightActivity)> {
47961        use std::borrow::Cow;
47962        use std::io::{Read, Seek};
47963
47964        use common::{url::Params, ToParts};
47965        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
47966
47967        let mut dd = common::DefaultDelegate;
47968        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
47969        dlg.begin(common::MethodInfo {
47970            id: "dfareporting.floodlightActivities.get",
47971            http_method: hyper::Method::GET,
47972        });
47973
47974        for &field in ["alt", "profileId", "id"].iter() {
47975            if self._additional_params.contains_key(field) {
47976                dlg.finished(false);
47977                return Err(common::Error::FieldClash(field));
47978            }
47979        }
47980
47981        let mut params = Params::with_capacity(4 + self._additional_params.len());
47982        params.push("profileId", self._profile_id.to_string());
47983        params.push("id", self._id.to_string());
47984
47985        params.extend(self._additional_params.iter());
47986
47987        params.push("alt", "json");
47988        let mut url =
47989            self.hub._base_url.clone() + "userprofiles/{profileId}/floodlightActivities/{id}";
47990        if self._scopes.is_empty() {
47991            self._scopes
47992                .insert(Scope::Dfatrafficking.as_ref().to_string());
47993        }
47994
47995        #[allow(clippy::single_element_loop)]
47996        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
47997            url = params.uri_replacement(url, param_name, find_this, false);
47998        }
47999        {
48000            let to_remove = ["id", "profileId"];
48001            params.remove_params(&to_remove);
48002        }
48003
48004        let url = params.parse_with_url(&url);
48005
48006        loop {
48007            let token = match self
48008                .hub
48009                .auth
48010                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
48011                .await
48012            {
48013                Ok(token) => token,
48014                Err(e) => match dlg.token(e) {
48015                    Ok(token) => token,
48016                    Err(e) => {
48017                        dlg.finished(false);
48018                        return Err(common::Error::MissingToken(e));
48019                    }
48020                },
48021            };
48022            let mut req_result = {
48023                let client = &self.hub.client;
48024                dlg.pre_request();
48025                let mut req_builder = hyper::Request::builder()
48026                    .method(hyper::Method::GET)
48027                    .uri(url.as_str())
48028                    .header(USER_AGENT, self.hub._user_agent.clone());
48029
48030                if let Some(token) = token.as_ref() {
48031                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
48032                }
48033
48034                let request = req_builder
48035                    .header(CONTENT_LENGTH, 0_u64)
48036                    .body(common::to_body::<String>(None));
48037
48038                client.request(request.unwrap()).await
48039            };
48040
48041            match req_result {
48042                Err(err) => {
48043                    if let common::Retry::After(d) = dlg.http_error(&err) {
48044                        sleep(d).await;
48045                        continue;
48046                    }
48047                    dlg.finished(false);
48048                    return Err(common::Error::HttpError(err));
48049                }
48050                Ok(res) => {
48051                    let (mut parts, body) = res.into_parts();
48052                    let mut body = common::Body::new(body);
48053                    if !parts.status.is_success() {
48054                        let bytes = common::to_bytes(body).await.unwrap_or_default();
48055                        let error = serde_json::from_str(&common::to_string(&bytes));
48056                        let response = common::to_response(parts, bytes.into());
48057
48058                        if let common::Retry::After(d) =
48059                            dlg.http_failure(&response, error.as_ref().ok())
48060                        {
48061                            sleep(d).await;
48062                            continue;
48063                        }
48064
48065                        dlg.finished(false);
48066
48067                        return Err(match error {
48068                            Ok(value) => common::Error::BadRequest(value),
48069                            _ => common::Error::Failure(response),
48070                        });
48071                    }
48072                    let response = {
48073                        let bytes = common::to_bytes(body).await.unwrap_or_default();
48074                        let encoded = common::to_string(&bytes);
48075                        match serde_json::from_str(&encoded) {
48076                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
48077                            Err(error) => {
48078                                dlg.response_json_decode_error(&encoded, &error);
48079                                return Err(common::Error::JsonDecodeError(
48080                                    encoded.to_string(),
48081                                    error,
48082                                ));
48083                            }
48084                        }
48085                    };
48086
48087                    dlg.finished(true);
48088                    return Ok(response);
48089                }
48090            }
48091        }
48092    }
48093
48094    /// User profile ID associated with this request.
48095    ///
48096    /// Sets the *profile id* path property to the given value.
48097    ///
48098    /// Even though the property as already been set when instantiating this call,
48099    /// we provide this method for API completeness.
48100    pub fn profile_id(mut self, new_value: i64) -> FloodlightActivityGetCall<'a, C> {
48101        self._profile_id = new_value;
48102        self
48103    }
48104    /// Floodlight activity ID.
48105    ///
48106    /// Sets the *id* path property to the given value.
48107    ///
48108    /// Even though the property as already been set when instantiating this call,
48109    /// we provide this method for API completeness.
48110    pub fn id(mut self, new_value: i64) -> FloodlightActivityGetCall<'a, C> {
48111        self._id = new_value;
48112        self
48113    }
48114    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
48115    /// while executing the actual API request.
48116    ///
48117    /// ````text
48118    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
48119    /// ````
48120    ///
48121    /// Sets the *delegate* property to the given value.
48122    pub fn delegate(
48123        mut self,
48124        new_value: &'a mut dyn common::Delegate,
48125    ) -> FloodlightActivityGetCall<'a, C> {
48126        self._delegate = Some(new_value);
48127        self
48128    }
48129
48130    /// Set any additional parameter of the query string used in the request.
48131    /// It should be used to set parameters which are not yet available through their own
48132    /// setters.
48133    ///
48134    /// Please note that this method must not be used to set any of the known parameters
48135    /// which have their own setter method. If done anyway, the request will fail.
48136    ///
48137    /// # Additional Parameters
48138    ///
48139    /// * *$.xgafv* (query-string) - V1 error format.
48140    /// * *access_token* (query-string) - OAuth access token.
48141    /// * *alt* (query-string) - Data format for response.
48142    /// * *callback* (query-string) - JSONP
48143    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
48144    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
48145    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
48146    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
48147    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
48148    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
48149    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
48150    pub fn param<T>(mut self, name: T, value: T) -> FloodlightActivityGetCall<'a, C>
48151    where
48152        T: AsRef<str>,
48153    {
48154        self._additional_params
48155            .insert(name.as_ref().to_string(), value.as_ref().to_string());
48156        self
48157    }
48158
48159    /// Identifies the authorization scope for the method you are building.
48160    ///
48161    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
48162    /// [`Scope::Dfatrafficking`].
48163    ///
48164    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
48165    /// tokens for more than one scope.
48166    ///
48167    /// Usually there is more than one suitable scope to authorize an operation, some of which may
48168    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
48169    /// sufficient, a read-write scope will do as well.
48170    pub fn add_scope<St>(mut self, scope: St) -> FloodlightActivityGetCall<'a, C>
48171    where
48172        St: AsRef<str>,
48173    {
48174        self._scopes.insert(String::from(scope.as_ref()));
48175        self
48176    }
48177    /// Identifies the authorization scope(s) for the method you are building.
48178    ///
48179    /// See [`Self::add_scope()`] for details.
48180    pub fn add_scopes<I, St>(mut self, scopes: I) -> FloodlightActivityGetCall<'a, C>
48181    where
48182        I: IntoIterator<Item = St>,
48183        St: AsRef<str>,
48184    {
48185        self._scopes
48186            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
48187        self
48188    }
48189
48190    /// Removes all scopes, and no default scope will be used either.
48191    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
48192    /// for details).
48193    pub fn clear_scopes(mut self) -> FloodlightActivityGetCall<'a, C> {
48194        self._scopes.clear();
48195        self
48196    }
48197}
48198
48199/// Inserts a new floodlight activity.
48200///
48201/// A builder for the *insert* method supported by a *floodlightActivity* resource.
48202/// It is not used directly, but through a [`FloodlightActivityMethods`] instance.
48203///
48204/// # Example
48205///
48206/// Instantiate a resource method builder
48207///
48208/// ```test_harness,no_run
48209/// # extern crate hyper;
48210/// # extern crate hyper_rustls;
48211/// # extern crate google_dfareporting3d3 as dfareporting3d3;
48212/// use dfareporting3d3::api::FloodlightActivity;
48213/// # async fn dox() {
48214/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
48215///
48216/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
48217/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
48218/// #     secret,
48219/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
48220/// # ).build().await.unwrap();
48221///
48222/// # let client = hyper_util::client::legacy::Client::builder(
48223/// #     hyper_util::rt::TokioExecutor::new()
48224/// # )
48225/// # .build(
48226/// #     hyper_rustls::HttpsConnectorBuilder::new()
48227/// #         .with_native_roots()
48228/// #         .unwrap()
48229/// #         .https_or_http()
48230/// #         .enable_http1()
48231/// #         .build()
48232/// # );
48233/// # let mut hub = Dfareporting::new(client, auth);
48234/// // As the method needs a request, you would usually fill it with the desired information
48235/// // into the respective structure. Some of the parts shown here might not be applicable !
48236/// // Values shown here are possibly random and not representative !
48237/// let mut req = FloodlightActivity::default();
48238///
48239/// // You can configure optional parameters by calling the respective setters at will, and
48240/// // execute the final call using `doit()`.
48241/// // Values shown here are possibly random and not representative !
48242/// let result = hub.floodlight_activities().insert(req, -60)
48243///              .doit().await;
48244/// # }
48245/// ```
48246pub struct FloodlightActivityInsertCall<'a, C>
48247where
48248    C: 'a,
48249{
48250    hub: &'a Dfareporting<C>,
48251    _request: FloodlightActivity,
48252    _profile_id: i64,
48253    _delegate: Option<&'a mut dyn common::Delegate>,
48254    _additional_params: HashMap<String, String>,
48255    _scopes: BTreeSet<String>,
48256}
48257
48258impl<'a, C> common::CallBuilder for FloodlightActivityInsertCall<'a, C> {}
48259
48260impl<'a, C> FloodlightActivityInsertCall<'a, C>
48261where
48262    C: common::Connector,
48263{
48264    /// Perform the operation you have build so far.
48265    pub async fn doit(mut self) -> common::Result<(common::Response, FloodlightActivity)> {
48266        use std::borrow::Cow;
48267        use std::io::{Read, Seek};
48268
48269        use common::{url::Params, ToParts};
48270        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
48271
48272        let mut dd = common::DefaultDelegate;
48273        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
48274        dlg.begin(common::MethodInfo {
48275            id: "dfareporting.floodlightActivities.insert",
48276            http_method: hyper::Method::POST,
48277        });
48278
48279        for &field in ["alt", "profileId"].iter() {
48280            if self._additional_params.contains_key(field) {
48281                dlg.finished(false);
48282                return Err(common::Error::FieldClash(field));
48283            }
48284        }
48285
48286        let mut params = Params::with_capacity(4 + self._additional_params.len());
48287        params.push("profileId", self._profile_id.to_string());
48288
48289        params.extend(self._additional_params.iter());
48290
48291        params.push("alt", "json");
48292        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/floodlightActivities";
48293        if self._scopes.is_empty() {
48294            self._scopes
48295                .insert(Scope::Dfatrafficking.as_ref().to_string());
48296        }
48297
48298        #[allow(clippy::single_element_loop)]
48299        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
48300            url = params.uri_replacement(url, param_name, find_this, false);
48301        }
48302        {
48303            let to_remove = ["profileId"];
48304            params.remove_params(&to_remove);
48305        }
48306
48307        let url = params.parse_with_url(&url);
48308
48309        let mut json_mime_type = mime::APPLICATION_JSON;
48310        let mut request_value_reader = {
48311            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
48312            common::remove_json_null_values(&mut value);
48313            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
48314            serde_json::to_writer(&mut dst, &value).unwrap();
48315            dst
48316        };
48317        let request_size = request_value_reader
48318            .seek(std::io::SeekFrom::End(0))
48319            .unwrap();
48320        request_value_reader
48321            .seek(std::io::SeekFrom::Start(0))
48322            .unwrap();
48323
48324        loop {
48325            let token = match self
48326                .hub
48327                .auth
48328                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
48329                .await
48330            {
48331                Ok(token) => token,
48332                Err(e) => match dlg.token(e) {
48333                    Ok(token) => token,
48334                    Err(e) => {
48335                        dlg.finished(false);
48336                        return Err(common::Error::MissingToken(e));
48337                    }
48338                },
48339            };
48340            request_value_reader
48341                .seek(std::io::SeekFrom::Start(0))
48342                .unwrap();
48343            let mut req_result = {
48344                let client = &self.hub.client;
48345                dlg.pre_request();
48346                let mut req_builder = hyper::Request::builder()
48347                    .method(hyper::Method::POST)
48348                    .uri(url.as_str())
48349                    .header(USER_AGENT, self.hub._user_agent.clone());
48350
48351                if let Some(token) = token.as_ref() {
48352                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
48353                }
48354
48355                let request = req_builder
48356                    .header(CONTENT_TYPE, json_mime_type.to_string())
48357                    .header(CONTENT_LENGTH, request_size as u64)
48358                    .body(common::to_body(
48359                        request_value_reader.get_ref().clone().into(),
48360                    ));
48361
48362                client.request(request.unwrap()).await
48363            };
48364
48365            match req_result {
48366                Err(err) => {
48367                    if let common::Retry::After(d) = dlg.http_error(&err) {
48368                        sleep(d).await;
48369                        continue;
48370                    }
48371                    dlg.finished(false);
48372                    return Err(common::Error::HttpError(err));
48373                }
48374                Ok(res) => {
48375                    let (mut parts, body) = res.into_parts();
48376                    let mut body = common::Body::new(body);
48377                    if !parts.status.is_success() {
48378                        let bytes = common::to_bytes(body).await.unwrap_or_default();
48379                        let error = serde_json::from_str(&common::to_string(&bytes));
48380                        let response = common::to_response(parts, bytes.into());
48381
48382                        if let common::Retry::After(d) =
48383                            dlg.http_failure(&response, error.as_ref().ok())
48384                        {
48385                            sleep(d).await;
48386                            continue;
48387                        }
48388
48389                        dlg.finished(false);
48390
48391                        return Err(match error {
48392                            Ok(value) => common::Error::BadRequest(value),
48393                            _ => common::Error::Failure(response),
48394                        });
48395                    }
48396                    let response = {
48397                        let bytes = common::to_bytes(body).await.unwrap_or_default();
48398                        let encoded = common::to_string(&bytes);
48399                        match serde_json::from_str(&encoded) {
48400                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
48401                            Err(error) => {
48402                                dlg.response_json_decode_error(&encoded, &error);
48403                                return Err(common::Error::JsonDecodeError(
48404                                    encoded.to_string(),
48405                                    error,
48406                                ));
48407                            }
48408                        }
48409                    };
48410
48411                    dlg.finished(true);
48412                    return Ok(response);
48413                }
48414            }
48415        }
48416    }
48417
48418    ///
48419    /// Sets the *request* property to the given value.
48420    ///
48421    /// Even though the property as already been set when instantiating this call,
48422    /// we provide this method for API completeness.
48423    pub fn request(mut self, new_value: FloodlightActivity) -> FloodlightActivityInsertCall<'a, C> {
48424        self._request = new_value;
48425        self
48426    }
48427    /// User profile ID associated with this request.
48428    ///
48429    /// Sets the *profile id* path property to the given value.
48430    ///
48431    /// Even though the property as already been set when instantiating this call,
48432    /// we provide this method for API completeness.
48433    pub fn profile_id(mut self, new_value: i64) -> FloodlightActivityInsertCall<'a, C> {
48434        self._profile_id = new_value;
48435        self
48436    }
48437    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
48438    /// while executing the actual API request.
48439    ///
48440    /// ````text
48441    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
48442    /// ````
48443    ///
48444    /// Sets the *delegate* property to the given value.
48445    pub fn delegate(
48446        mut self,
48447        new_value: &'a mut dyn common::Delegate,
48448    ) -> FloodlightActivityInsertCall<'a, C> {
48449        self._delegate = Some(new_value);
48450        self
48451    }
48452
48453    /// Set any additional parameter of the query string used in the request.
48454    /// It should be used to set parameters which are not yet available through their own
48455    /// setters.
48456    ///
48457    /// Please note that this method must not be used to set any of the known parameters
48458    /// which have their own setter method. If done anyway, the request will fail.
48459    ///
48460    /// # Additional Parameters
48461    ///
48462    /// * *$.xgafv* (query-string) - V1 error format.
48463    /// * *access_token* (query-string) - OAuth access token.
48464    /// * *alt* (query-string) - Data format for response.
48465    /// * *callback* (query-string) - JSONP
48466    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
48467    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
48468    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
48469    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
48470    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
48471    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
48472    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
48473    pub fn param<T>(mut self, name: T, value: T) -> FloodlightActivityInsertCall<'a, C>
48474    where
48475        T: AsRef<str>,
48476    {
48477        self._additional_params
48478            .insert(name.as_ref().to_string(), value.as_ref().to_string());
48479        self
48480    }
48481
48482    /// Identifies the authorization scope for the method you are building.
48483    ///
48484    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
48485    /// [`Scope::Dfatrafficking`].
48486    ///
48487    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
48488    /// tokens for more than one scope.
48489    ///
48490    /// Usually there is more than one suitable scope to authorize an operation, some of which may
48491    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
48492    /// sufficient, a read-write scope will do as well.
48493    pub fn add_scope<St>(mut self, scope: St) -> FloodlightActivityInsertCall<'a, C>
48494    where
48495        St: AsRef<str>,
48496    {
48497        self._scopes.insert(String::from(scope.as_ref()));
48498        self
48499    }
48500    /// Identifies the authorization scope(s) for the method you are building.
48501    ///
48502    /// See [`Self::add_scope()`] for details.
48503    pub fn add_scopes<I, St>(mut self, scopes: I) -> FloodlightActivityInsertCall<'a, C>
48504    where
48505        I: IntoIterator<Item = St>,
48506        St: AsRef<str>,
48507    {
48508        self._scopes
48509            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
48510        self
48511    }
48512
48513    /// Removes all scopes, and no default scope will be used either.
48514    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
48515    /// for details).
48516    pub fn clear_scopes(mut self) -> FloodlightActivityInsertCall<'a, C> {
48517        self._scopes.clear();
48518        self
48519    }
48520}
48521
48522/// Retrieves a list of floodlight activities, possibly filtered. This method supports paging.
48523///
48524/// A builder for the *list* method supported by a *floodlightActivity* resource.
48525/// It is not used directly, but through a [`FloodlightActivityMethods`] instance.
48526///
48527/// # Example
48528///
48529/// Instantiate a resource method builder
48530///
48531/// ```test_harness,no_run
48532/// # extern crate hyper;
48533/// # extern crate hyper_rustls;
48534/// # extern crate google_dfareporting3d3 as dfareporting3d3;
48535/// # async fn dox() {
48536/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
48537///
48538/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
48539/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
48540/// #     secret,
48541/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
48542/// # ).build().await.unwrap();
48543///
48544/// # let client = hyper_util::client::legacy::Client::builder(
48545/// #     hyper_util::rt::TokioExecutor::new()
48546/// # )
48547/// # .build(
48548/// #     hyper_rustls::HttpsConnectorBuilder::new()
48549/// #         .with_native_roots()
48550/// #         .unwrap()
48551/// #         .https_or_http()
48552/// #         .enable_http1()
48553/// #         .build()
48554/// # );
48555/// # let mut hub = Dfareporting::new(client, auth);
48556/// // You can configure optional parameters by calling the respective setters at will, and
48557/// // execute the final call using `doit()`.
48558/// // Values shown here are possibly random and not representative !
48559/// let result = hub.floodlight_activities().list(-100)
48560///              .tag_string("ipsum")
48561///              .sort_order("et")
48562///              .sort_field("elitr")
48563///              .search_string("eirmod")
48564///              .page_token("dolor")
48565///              .max_results(-95)
48566///              .add_ids(-4)
48567///              .floodlight_configuration_id(-54)
48568///              .floodlight_activity_group_type("consetetur")
48569///              .floodlight_activity_group_tag_string("et")
48570///              .floodlight_activity_group_name("sit")
48571///              .add_floodlight_activity_group_ids(-51)
48572///              .advertiser_id(-41)
48573///              .doit().await;
48574/// # }
48575/// ```
48576pub struct FloodlightActivityListCall<'a, C>
48577where
48578    C: 'a,
48579{
48580    hub: &'a Dfareporting<C>,
48581    _profile_id: i64,
48582    _tag_string: Option<String>,
48583    _sort_order: Option<String>,
48584    _sort_field: Option<String>,
48585    _search_string: Option<String>,
48586    _page_token: Option<String>,
48587    _max_results: Option<i32>,
48588    _ids: Vec<i64>,
48589    _floodlight_configuration_id: Option<i64>,
48590    _floodlight_activity_group_type: Option<String>,
48591    _floodlight_activity_group_tag_string: Option<String>,
48592    _floodlight_activity_group_name: Option<String>,
48593    _floodlight_activity_group_ids: Vec<i64>,
48594    _advertiser_id: Option<i64>,
48595    _delegate: Option<&'a mut dyn common::Delegate>,
48596    _additional_params: HashMap<String, String>,
48597    _scopes: BTreeSet<String>,
48598}
48599
48600impl<'a, C> common::CallBuilder for FloodlightActivityListCall<'a, C> {}
48601
48602impl<'a, C> FloodlightActivityListCall<'a, C>
48603where
48604    C: common::Connector,
48605{
48606    /// Perform the operation you have build so far.
48607    pub async fn doit(
48608        mut self,
48609    ) -> common::Result<(common::Response, FloodlightActivitiesListResponse)> {
48610        use std::borrow::Cow;
48611        use std::io::{Read, Seek};
48612
48613        use common::{url::Params, ToParts};
48614        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
48615
48616        let mut dd = common::DefaultDelegate;
48617        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
48618        dlg.begin(common::MethodInfo {
48619            id: "dfareporting.floodlightActivities.list",
48620            http_method: hyper::Method::GET,
48621        });
48622
48623        for &field in [
48624            "alt",
48625            "profileId",
48626            "tagString",
48627            "sortOrder",
48628            "sortField",
48629            "searchString",
48630            "pageToken",
48631            "maxResults",
48632            "ids",
48633            "floodlightConfigurationId",
48634            "floodlightActivityGroupType",
48635            "floodlightActivityGroupTagString",
48636            "floodlightActivityGroupName",
48637            "floodlightActivityGroupIds",
48638            "advertiserId",
48639        ]
48640        .iter()
48641        {
48642            if self._additional_params.contains_key(field) {
48643                dlg.finished(false);
48644                return Err(common::Error::FieldClash(field));
48645            }
48646        }
48647
48648        let mut params = Params::with_capacity(16 + self._additional_params.len());
48649        params.push("profileId", self._profile_id.to_string());
48650        if let Some(value) = self._tag_string.as_ref() {
48651            params.push("tagString", value);
48652        }
48653        if let Some(value) = self._sort_order.as_ref() {
48654            params.push("sortOrder", value);
48655        }
48656        if let Some(value) = self._sort_field.as_ref() {
48657            params.push("sortField", value);
48658        }
48659        if let Some(value) = self._search_string.as_ref() {
48660            params.push("searchString", value);
48661        }
48662        if let Some(value) = self._page_token.as_ref() {
48663            params.push("pageToken", value);
48664        }
48665        if let Some(value) = self._max_results.as_ref() {
48666            params.push("maxResults", value.to_string());
48667        }
48668        if !self._ids.is_empty() {
48669            for f in self._ids.iter() {
48670                params.push("ids", f.to_string());
48671            }
48672        }
48673        if let Some(value) = self._floodlight_configuration_id.as_ref() {
48674            params.push("floodlightConfigurationId", value.to_string());
48675        }
48676        if let Some(value) = self._floodlight_activity_group_type.as_ref() {
48677            params.push("floodlightActivityGroupType", value);
48678        }
48679        if let Some(value) = self._floodlight_activity_group_tag_string.as_ref() {
48680            params.push("floodlightActivityGroupTagString", value);
48681        }
48682        if let Some(value) = self._floodlight_activity_group_name.as_ref() {
48683            params.push("floodlightActivityGroupName", value);
48684        }
48685        if !self._floodlight_activity_group_ids.is_empty() {
48686            for f in self._floodlight_activity_group_ids.iter() {
48687                params.push("floodlightActivityGroupIds", f.to_string());
48688            }
48689        }
48690        if let Some(value) = self._advertiser_id.as_ref() {
48691            params.push("advertiserId", value.to_string());
48692        }
48693
48694        params.extend(self._additional_params.iter());
48695
48696        params.push("alt", "json");
48697        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/floodlightActivities";
48698        if self._scopes.is_empty() {
48699            self._scopes
48700                .insert(Scope::Dfatrafficking.as_ref().to_string());
48701        }
48702
48703        #[allow(clippy::single_element_loop)]
48704        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
48705            url = params.uri_replacement(url, param_name, find_this, false);
48706        }
48707        {
48708            let to_remove = ["profileId"];
48709            params.remove_params(&to_remove);
48710        }
48711
48712        let url = params.parse_with_url(&url);
48713
48714        loop {
48715            let token = match self
48716                .hub
48717                .auth
48718                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
48719                .await
48720            {
48721                Ok(token) => token,
48722                Err(e) => match dlg.token(e) {
48723                    Ok(token) => token,
48724                    Err(e) => {
48725                        dlg.finished(false);
48726                        return Err(common::Error::MissingToken(e));
48727                    }
48728                },
48729            };
48730            let mut req_result = {
48731                let client = &self.hub.client;
48732                dlg.pre_request();
48733                let mut req_builder = hyper::Request::builder()
48734                    .method(hyper::Method::GET)
48735                    .uri(url.as_str())
48736                    .header(USER_AGENT, self.hub._user_agent.clone());
48737
48738                if let Some(token) = token.as_ref() {
48739                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
48740                }
48741
48742                let request = req_builder
48743                    .header(CONTENT_LENGTH, 0_u64)
48744                    .body(common::to_body::<String>(None));
48745
48746                client.request(request.unwrap()).await
48747            };
48748
48749            match req_result {
48750                Err(err) => {
48751                    if let common::Retry::After(d) = dlg.http_error(&err) {
48752                        sleep(d).await;
48753                        continue;
48754                    }
48755                    dlg.finished(false);
48756                    return Err(common::Error::HttpError(err));
48757                }
48758                Ok(res) => {
48759                    let (mut parts, body) = res.into_parts();
48760                    let mut body = common::Body::new(body);
48761                    if !parts.status.is_success() {
48762                        let bytes = common::to_bytes(body).await.unwrap_or_default();
48763                        let error = serde_json::from_str(&common::to_string(&bytes));
48764                        let response = common::to_response(parts, bytes.into());
48765
48766                        if let common::Retry::After(d) =
48767                            dlg.http_failure(&response, error.as_ref().ok())
48768                        {
48769                            sleep(d).await;
48770                            continue;
48771                        }
48772
48773                        dlg.finished(false);
48774
48775                        return Err(match error {
48776                            Ok(value) => common::Error::BadRequest(value),
48777                            _ => common::Error::Failure(response),
48778                        });
48779                    }
48780                    let response = {
48781                        let bytes = common::to_bytes(body).await.unwrap_or_default();
48782                        let encoded = common::to_string(&bytes);
48783                        match serde_json::from_str(&encoded) {
48784                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
48785                            Err(error) => {
48786                                dlg.response_json_decode_error(&encoded, &error);
48787                                return Err(common::Error::JsonDecodeError(
48788                                    encoded.to_string(),
48789                                    error,
48790                                ));
48791                            }
48792                        }
48793                    };
48794
48795                    dlg.finished(true);
48796                    return Ok(response);
48797                }
48798            }
48799        }
48800    }
48801
48802    /// User profile ID associated with this request.
48803    ///
48804    /// Sets the *profile id* path property to the given value.
48805    ///
48806    /// Even though the property as already been set when instantiating this call,
48807    /// we provide this method for API completeness.
48808    pub fn profile_id(mut self, new_value: i64) -> FloodlightActivityListCall<'a, C> {
48809        self._profile_id = new_value;
48810        self
48811    }
48812    /// Select only floodlight activities with the specified tag string.
48813    ///
48814    /// Sets the *tag string* query property to the given value.
48815    pub fn tag_string(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C> {
48816        self._tag_string = Some(new_value.to_string());
48817        self
48818    }
48819    /// Order of sorted results.
48820    ///
48821    /// Sets the *sort order* query property to the given value.
48822    pub fn sort_order(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C> {
48823        self._sort_order = Some(new_value.to_string());
48824        self
48825    }
48826    /// Field by which to sort the list.
48827    ///
48828    /// Sets the *sort field* query property to the given value.
48829    pub fn sort_field(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C> {
48830        self._sort_field = Some(new_value.to_string());
48831        self
48832    }
48833    /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "floodlightactivity*2015" will return objects with names like "floodlightactivity June 2015", "floodlightactivity April 2015", or simply "floodlightactivity 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "floodlightactivity" will match objects with name "my floodlightactivity activity", "floodlightactivity 2015", or simply "floodlightactivity".
48834    ///
48835    /// Sets the *search string* query property to the given value.
48836    pub fn search_string(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C> {
48837        self._search_string = Some(new_value.to_string());
48838        self
48839    }
48840    /// Value of the nextPageToken from the previous result page.
48841    ///
48842    /// Sets the *page token* query property to the given value.
48843    pub fn page_token(mut self, new_value: &str) -> FloodlightActivityListCall<'a, C> {
48844        self._page_token = Some(new_value.to_string());
48845        self
48846    }
48847    /// Maximum number of results to return.
48848    ///
48849    /// Sets the *max results* query property to the given value.
48850    pub fn max_results(mut self, new_value: i32) -> FloodlightActivityListCall<'a, C> {
48851        self._max_results = Some(new_value);
48852        self
48853    }
48854    /// Select only floodlight activities with the specified IDs. Must specify either ids, advertiserId, or floodlightConfigurationId for a non-empty result.
48855    ///
48856    /// Append the given value to the *ids* query property.
48857    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
48858    pub fn add_ids(mut self, new_value: i64) -> FloodlightActivityListCall<'a, C> {
48859        self._ids.push(new_value);
48860        self
48861    }
48862    /// Select only floodlight activities for the specified floodlight configuration ID. Must specify either ids, advertiserId, or floodlightConfigurationId for a non-empty result.
48863    ///
48864    /// Sets the *floodlight configuration id* query property to the given value.
48865    pub fn floodlight_configuration_id(
48866        mut self,
48867        new_value: i64,
48868    ) -> FloodlightActivityListCall<'a, C> {
48869        self._floodlight_configuration_id = Some(new_value);
48870        self
48871    }
48872    /// Select only floodlight activities with the specified floodlight activity group type.
48873    ///
48874    /// Sets the *floodlight activity group type* query property to the given value.
48875    pub fn floodlight_activity_group_type(
48876        mut self,
48877        new_value: &str,
48878    ) -> FloodlightActivityListCall<'a, C> {
48879        self._floodlight_activity_group_type = Some(new_value.to_string());
48880        self
48881    }
48882    /// Select only floodlight activities with the specified floodlight activity group tag string.
48883    ///
48884    /// Sets the *floodlight activity group tag string* query property to the given value.
48885    pub fn floodlight_activity_group_tag_string(
48886        mut self,
48887        new_value: &str,
48888    ) -> FloodlightActivityListCall<'a, C> {
48889        self._floodlight_activity_group_tag_string = Some(new_value.to_string());
48890        self
48891    }
48892    /// Select only floodlight activities with the specified floodlight activity group name.
48893    ///
48894    /// Sets the *floodlight activity group name* query property to the given value.
48895    pub fn floodlight_activity_group_name(
48896        mut self,
48897        new_value: &str,
48898    ) -> FloodlightActivityListCall<'a, C> {
48899        self._floodlight_activity_group_name = Some(new_value.to_string());
48900        self
48901    }
48902    /// Select only floodlight activities with the specified floodlight activity group IDs.
48903    ///
48904    /// Append the given value to the *floodlight activity group ids* query property.
48905    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
48906    pub fn add_floodlight_activity_group_ids(
48907        mut self,
48908        new_value: i64,
48909    ) -> FloodlightActivityListCall<'a, C> {
48910        self._floodlight_activity_group_ids.push(new_value);
48911        self
48912    }
48913    /// Select only floodlight activities for the specified advertiser ID. Must specify either ids, advertiserId, or floodlightConfigurationId for a non-empty result.
48914    ///
48915    /// Sets the *advertiser id* query property to the given value.
48916    pub fn advertiser_id(mut self, new_value: i64) -> FloodlightActivityListCall<'a, C> {
48917        self._advertiser_id = Some(new_value);
48918        self
48919    }
48920    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
48921    /// while executing the actual API request.
48922    ///
48923    /// ````text
48924    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
48925    /// ````
48926    ///
48927    /// Sets the *delegate* property to the given value.
48928    pub fn delegate(
48929        mut self,
48930        new_value: &'a mut dyn common::Delegate,
48931    ) -> FloodlightActivityListCall<'a, C> {
48932        self._delegate = Some(new_value);
48933        self
48934    }
48935
48936    /// Set any additional parameter of the query string used in the request.
48937    /// It should be used to set parameters which are not yet available through their own
48938    /// setters.
48939    ///
48940    /// Please note that this method must not be used to set any of the known parameters
48941    /// which have their own setter method. If done anyway, the request will fail.
48942    ///
48943    /// # Additional Parameters
48944    ///
48945    /// * *$.xgafv* (query-string) - V1 error format.
48946    /// * *access_token* (query-string) - OAuth access token.
48947    /// * *alt* (query-string) - Data format for response.
48948    /// * *callback* (query-string) - JSONP
48949    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
48950    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
48951    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
48952    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
48953    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
48954    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
48955    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
48956    pub fn param<T>(mut self, name: T, value: T) -> FloodlightActivityListCall<'a, C>
48957    where
48958        T: AsRef<str>,
48959    {
48960        self._additional_params
48961            .insert(name.as_ref().to_string(), value.as_ref().to_string());
48962        self
48963    }
48964
48965    /// Identifies the authorization scope for the method you are building.
48966    ///
48967    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
48968    /// [`Scope::Dfatrafficking`].
48969    ///
48970    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
48971    /// tokens for more than one scope.
48972    ///
48973    /// Usually there is more than one suitable scope to authorize an operation, some of which may
48974    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
48975    /// sufficient, a read-write scope will do as well.
48976    pub fn add_scope<St>(mut self, scope: St) -> FloodlightActivityListCall<'a, C>
48977    where
48978        St: AsRef<str>,
48979    {
48980        self._scopes.insert(String::from(scope.as_ref()));
48981        self
48982    }
48983    /// Identifies the authorization scope(s) for the method you are building.
48984    ///
48985    /// See [`Self::add_scope()`] for details.
48986    pub fn add_scopes<I, St>(mut self, scopes: I) -> FloodlightActivityListCall<'a, C>
48987    where
48988        I: IntoIterator<Item = St>,
48989        St: AsRef<str>,
48990    {
48991        self._scopes
48992            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
48993        self
48994    }
48995
48996    /// Removes all scopes, and no default scope will be used either.
48997    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
48998    /// for details).
48999    pub fn clear_scopes(mut self) -> FloodlightActivityListCall<'a, C> {
49000        self._scopes.clear();
49001        self
49002    }
49003}
49004
49005/// Updates an existing floodlight activity. This method supports patch semantics.
49006///
49007/// A builder for the *patch* method supported by a *floodlightActivity* resource.
49008/// It is not used directly, but through a [`FloodlightActivityMethods`] instance.
49009///
49010/// # Example
49011///
49012/// Instantiate a resource method builder
49013///
49014/// ```test_harness,no_run
49015/// # extern crate hyper;
49016/// # extern crate hyper_rustls;
49017/// # extern crate google_dfareporting3d3 as dfareporting3d3;
49018/// use dfareporting3d3::api::FloodlightActivity;
49019/// # async fn dox() {
49020/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
49021///
49022/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
49023/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
49024/// #     secret,
49025/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
49026/// # ).build().await.unwrap();
49027///
49028/// # let client = hyper_util::client::legacy::Client::builder(
49029/// #     hyper_util::rt::TokioExecutor::new()
49030/// # )
49031/// # .build(
49032/// #     hyper_rustls::HttpsConnectorBuilder::new()
49033/// #         .with_native_roots()
49034/// #         .unwrap()
49035/// #         .https_or_http()
49036/// #         .enable_http1()
49037/// #         .build()
49038/// # );
49039/// # let mut hub = Dfareporting::new(client, auth);
49040/// // As the method needs a request, you would usually fill it with the desired information
49041/// // into the respective structure. Some of the parts shown here might not be applicable !
49042/// // Values shown here are possibly random and not representative !
49043/// let mut req = FloodlightActivity::default();
49044///
49045/// // You can configure optional parameters by calling the respective setters at will, and
49046/// // execute the final call using `doit()`.
49047/// // Values shown here are possibly random and not representative !
49048/// let result = hub.floodlight_activities().patch(req, -79, -100)
49049///              .doit().await;
49050/// # }
49051/// ```
49052pub struct FloodlightActivityPatchCall<'a, C>
49053where
49054    C: 'a,
49055{
49056    hub: &'a Dfareporting<C>,
49057    _request: FloodlightActivity,
49058    _profile_id: i64,
49059    _id: i64,
49060    _delegate: Option<&'a mut dyn common::Delegate>,
49061    _additional_params: HashMap<String, String>,
49062    _scopes: BTreeSet<String>,
49063}
49064
49065impl<'a, C> common::CallBuilder for FloodlightActivityPatchCall<'a, C> {}
49066
49067impl<'a, C> FloodlightActivityPatchCall<'a, C>
49068where
49069    C: common::Connector,
49070{
49071    /// Perform the operation you have build so far.
49072    pub async fn doit(mut self) -> common::Result<(common::Response, FloodlightActivity)> {
49073        use std::borrow::Cow;
49074        use std::io::{Read, Seek};
49075
49076        use common::{url::Params, ToParts};
49077        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
49078
49079        let mut dd = common::DefaultDelegate;
49080        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
49081        dlg.begin(common::MethodInfo {
49082            id: "dfareporting.floodlightActivities.patch",
49083            http_method: hyper::Method::PATCH,
49084        });
49085
49086        for &field in ["alt", "profileId", "id"].iter() {
49087            if self._additional_params.contains_key(field) {
49088                dlg.finished(false);
49089                return Err(common::Error::FieldClash(field));
49090            }
49091        }
49092
49093        let mut params = Params::with_capacity(5 + self._additional_params.len());
49094        params.push("profileId", self._profile_id.to_string());
49095        params.push("id", self._id.to_string());
49096
49097        params.extend(self._additional_params.iter());
49098
49099        params.push("alt", "json");
49100        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/floodlightActivities";
49101        if self._scopes.is_empty() {
49102            self._scopes
49103                .insert(Scope::Dfatrafficking.as_ref().to_string());
49104        }
49105
49106        #[allow(clippy::single_element_loop)]
49107        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
49108            url = params.uri_replacement(url, param_name, find_this, false);
49109        }
49110        {
49111            let to_remove = ["profileId"];
49112            params.remove_params(&to_remove);
49113        }
49114
49115        let url = params.parse_with_url(&url);
49116
49117        let mut json_mime_type = mime::APPLICATION_JSON;
49118        let mut request_value_reader = {
49119            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
49120            common::remove_json_null_values(&mut value);
49121            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
49122            serde_json::to_writer(&mut dst, &value).unwrap();
49123            dst
49124        };
49125        let request_size = request_value_reader
49126            .seek(std::io::SeekFrom::End(0))
49127            .unwrap();
49128        request_value_reader
49129            .seek(std::io::SeekFrom::Start(0))
49130            .unwrap();
49131
49132        loop {
49133            let token = match self
49134                .hub
49135                .auth
49136                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
49137                .await
49138            {
49139                Ok(token) => token,
49140                Err(e) => match dlg.token(e) {
49141                    Ok(token) => token,
49142                    Err(e) => {
49143                        dlg.finished(false);
49144                        return Err(common::Error::MissingToken(e));
49145                    }
49146                },
49147            };
49148            request_value_reader
49149                .seek(std::io::SeekFrom::Start(0))
49150                .unwrap();
49151            let mut req_result = {
49152                let client = &self.hub.client;
49153                dlg.pre_request();
49154                let mut req_builder = hyper::Request::builder()
49155                    .method(hyper::Method::PATCH)
49156                    .uri(url.as_str())
49157                    .header(USER_AGENT, self.hub._user_agent.clone());
49158
49159                if let Some(token) = token.as_ref() {
49160                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
49161                }
49162
49163                let request = req_builder
49164                    .header(CONTENT_TYPE, json_mime_type.to_string())
49165                    .header(CONTENT_LENGTH, request_size as u64)
49166                    .body(common::to_body(
49167                        request_value_reader.get_ref().clone().into(),
49168                    ));
49169
49170                client.request(request.unwrap()).await
49171            };
49172
49173            match req_result {
49174                Err(err) => {
49175                    if let common::Retry::After(d) = dlg.http_error(&err) {
49176                        sleep(d).await;
49177                        continue;
49178                    }
49179                    dlg.finished(false);
49180                    return Err(common::Error::HttpError(err));
49181                }
49182                Ok(res) => {
49183                    let (mut parts, body) = res.into_parts();
49184                    let mut body = common::Body::new(body);
49185                    if !parts.status.is_success() {
49186                        let bytes = common::to_bytes(body).await.unwrap_or_default();
49187                        let error = serde_json::from_str(&common::to_string(&bytes));
49188                        let response = common::to_response(parts, bytes.into());
49189
49190                        if let common::Retry::After(d) =
49191                            dlg.http_failure(&response, error.as_ref().ok())
49192                        {
49193                            sleep(d).await;
49194                            continue;
49195                        }
49196
49197                        dlg.finished(false);
49198
49199                        return Err(match error {
49200                            Ok(value) => common::Error::BadRequest(value),
49201                            _ => common::Error::Failure(response),
49202                        });
49203                    }
49204                    let response = {
49205                        let bytes = common::to_bytes(body).await.unwrap_or_default();
49206                        let encoded = common::to_string(&bytes);
49207                        match serde_json::from_str(&encoded) {
49208                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
49209                            Err(error) => {
49210                                dlg.response_json_decode_error(&encoded, &error);
49211                                return Err(common::Error::JsonDecodeError(
49212                                    encoded.to_string(),
49213                                    error,
49214                                ));
49215                            }
49216                        }
49217                    };
49218
49219                    dlg.finished(true);
49220                    return Ok(response);
49221                }
49222            }
49223        }
49224    }
49225
49226    ///
49227    /// Sets the *request* property to the given value.
49228    ///
49229    /// Even though the property as already been set when instantiating this call,
49230    /// we provide this method for API completeness.
49231    pub fn request(mut self, new_value: FloodlightActivity) -> FloodlightActivityPatchCall<'a, C> {
49232        self._request = new_value;
49233        self
49234    }
49235    /// User profile ID associated with this request.
49236    ///
49237    /// Sets the *profile id* path property to the given value.
49238    ///
49239    /// Even though the property as already been set when instantiating this call,
49240    /// we provide this method for API completeness.
49241    pub fn profile_id(mut self, new_value: i64) -> FloodlightActivityPatchCall<'a, C> {
49242        self._profile_id = new_value;
49243        self
49244    }
49245    /// FloodlightActivity ID.
49246    ///
49247    /// Sets the *id* query property to the given value.
49248    ///
49249    /// Even though the property as already been set when instantiating this call,
49250    /// we provide this method for API completeness.
49251    pub fn id(mut self, new_value: i64) -> FloodlightActivityPatchCall<'a, C> {
49252        self._id = new_value;
49253        self
49254    }
49255    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
49256    /// while executing the actual API request.
49257    ///
49258    /// ````text
49259    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
49260    /// ````
49261    ///
49262    /// Sets the *delegate* property to the given value.
49263    pub fn delegate(
49264        mut self,
49265        new_value: &'a mut dyn common::Delegate,
49266    ) -> FloodlightActivityPatchCall<'a, C> {
49267        self._delegate = Some(new_value);
49268        self
49269    }
49270
49271    /// Set any additional parameter of the query string used in the request.
49272    /// It should be used to set parameters which are not yet available through their own
49273    /// setters.
49274    ///
49275    /// Please note that this method must not be used to set any of the known parameters
49276    /// which have their own setter method. If done anyway, the request will fail.
49277    ///
49278    /// # Additional Parameters
49279    ///
49280    /// * *$.xgafv* (query-string) - V1 error format.
49281    /// * *access_token* (query-string) - OAuth access token.
49282    /// * *alt* (query-string) - Data format for response.
49283    /// * *callback* (query-string) - JSONP
49284    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
49285    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
49286    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
49287    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
49288    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
49289    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
49290    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
49291    pub fn param<T>(mut self, name: T, value: T) -> FloodlightActivityPatchCall<'a, C>
49292    where
49293        T: AsRef<str>,
49294    {
49295        self._additional_params
49296            .insert(name.as_ref().to_string(), value.as_ref().to_string());
49297        self
49298    }
49299
49300    /// Identifies the authorization scope for the method you are building.
49301    ///
49302    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
49303    /// [`Scope::Dfatrafficking`].
49304    ///
49305    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
49306    /// tokens for more than one scope.
49307    ///
49308    /// Usually there is more than one suitable scope to authorize an operation, some of which may
49309    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
49310    /// sufficient, a read-write scope will do as well.
49311    pub fn add_scope<St>(mut self, scope: St) -> FloodlightActivityPatchCall<'a, C>
49312    where
49313        St: AsRef<str>,
49314    {
49315        self._scopes.insert(String::from(scope.as_ref()));
49316        self
49317    }
49318    /// Identifies the authorization scope(s) for the method you are building.
49319    ///
49320    /// See [`Self::add_scope()`] for details.
49321    pub fn add_scopes<I, St>(mut self, scopes: I) -> FloodlightActivityPatchCall<'a, C>
49322    where
49323        I: IntoIterator<Item = St>,
49324        St: AsRef<str>,
49325    {
49326        self._scopes
49327            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
49328        self
49329    }
49330
49331    /// Removes all scopes, and no default scope will be used either.
49332    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
49333    /// for details).
49334    pub fn clear_scopes(mut self) -> FloodlightActivityPatchCall<'a, C> {
49335        self._scopes.clear();
49336        self
49337    }
49338}
49339
49340/// Updates an existing floodlight activity.
49341///
49342/// A builder for the *update* method supported by a *floodlightActivity* resource.
49343/// It is not used directly, but through a [`FloodlightActivityMethods`] instance.
49344///
49345/// # Example
49346///
49347/// Instantiate a resource method builder
49348///
49349/// ```test_harness,no_run
49350/// # extern crate hyper;
49351/// # extern crate hyper_rustls;
49352/// # extern crate google_dfareporting3d3 as dfareporting3d3;
49353/// use dfareporting3d3::api::FloodlightActivity;
49354/// # async fn dox() {
49355/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
49356///
49357/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
49358/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
49359/// #     secret,
49360/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
49361/// # ).build().await.unwrap();
49362///
49363/// # let client = hyper_util::client::legacy::Client::builder(
49364/// #     hyper_util::rt::TokioExecutor::new()
49365/// # )
49366/// # .build(
49367/// #     hyper_rustls::HttpsConnectorBuilder::new()
49368/// #         .with_native_roots()
49369/// #         .unwrap()
49370/// #         .https_or_http()
49371/// #         .enable_http1()
49372/// #         .build()
49373/// # );
49374/// # let mut hub = Dfareporting::new(client, auth);
49375/// // As the method needs a request, you would usually fill it with the desired information
49376/// // into the respective structure. Some of the parts shown here might not be applicable !
49377/// // Values shown here are possibly random and not representative !
49378/// let mut req = FloodlightActivity::default();
49379///
49380/// // You can configure optional parameters by calling the respective setters at will, and
49381/// // execute the final call using `doit()`.
49382/// // Values shown here are possibly random and not representative !
49383/// let result = hub.floodlight_activities().update(req, -38)
49384///              .doit().await;
49385/// # }
49386/// ```
49387pub struct FloodlightActivityUpdateCall<'a, C>
49388where
49389    C: 'a,
49390{
49391    hub: &'a Dfareporting<C>,
49392    _request: FloodlightActivity,
49393    _profile_id: i64,
49394    _delegate: Option<&'a mut dyn common::Delegate>,
49395    _additional_params: HashMap<String, String>,
49396    _scopes: BTreeSet<String>,
49397}
49398
49399impl<'a, C> common::CallBuilder for FloodlightActivityUpdateCall<'a, C> {}
49400
49401impl<'a, C> FloodlightActivityUpdateCall<'a, C>
49402where
49403    C: common::Connector,
49404{
49405    /// Perform the operation you have build so far.
49406    pub async fn doit(mut self) -> common::Result<(common::Response, FloodlightActivity)> {
49407        use std::borrow::Cow;
49408        use std::io::{Read, Seek};
49409
49410        use common::{url::Params, ToParts};
49411        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
49412
49413        let mut dd = common::DefaultDelegate;
49414        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
49415        dlg.begin(common::MethodInfo {
49416            id: "dfareporting.floodlightActivities.update",
49417            http_method: hyper::Method::PUT,
49418        });
49419
49420        for &field in ["alt", "profileId"].iter() {
49421            if self._additional_params.contains_key(field) {
49422                dlg.finished(false);
49423                return Err(common::Error::FieldClash(field));
49424            }
49425        }
49426
49427        let mut params = Params::with_capacity(4 + self._additional_params.len());
49428        params.push("profileId", self._profile_id.to_string());
49429
49430        params.extend(self._additional_params.iter());
49431
49432        params.push("alt", "json");
49433        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/floodlightActivities";
49434        if self._scopes.is_empty() {
49435            self._scopes
49436                .insert(Scope::Dfatrafficking.as_ref().to_string());
49437        }
49438
49439        #[allow(clippy::single_element_loop)]
49440        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
49441            url = params.uri_replacement(url, param_name, find_this, false);
49442        }
49443        {
49444            let to_remove = ["profileId"];
49445            params.remove_params(&to_remove);
49446        }
49447
49448        let url = params.parse_with_url(&url);
49449
49450        let mut json_mime_type = mime::APPLICATION_JSON;
49451        let mut request_value_reader = {
49452            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
49453            common::remove_json_null_values(&mut value);
49454            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
49455            serde_json::to_writer(&mut dst, &value).unwrap();
49456            dst
49457        };
49458        let request_size = request_value_reader
49459            .seek(std::io::SeekFrom::End(0))
49460            .unwrap();
49461        request_value_reader
49462            .seek(std::io::SeekFrom::Start(0))
49463            .unwrap();
49464
49465        loop {
49466            let token = match self
49467                .hub
49468                .auth
49469                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
49470                .await
49471            {
49472                Ok(token) => token,
49473                Err(e) => match dlg.token(e) {
49474                    Ok(token) => token,
49475                    Err(e) => {
49476                        dlg.finished(false);
49477                        return Err(common::Error::MissingToken(e));
49478                    }
49479                },
49480            };
49481            request_value_reader
49482                .seek(std::io::SeekFrom::Start(0))
49483                .unwrap();
49484            let mut req_result = {
49485                let client = &self.hub.client;
49486                dlg.pre_request();
49487                let mut req_builder = hyper::Request::builder()
49488                    .method(hyper::Method::PUT)
49489                    .uri(url.as_str())
49490                    .header(USER_AGENT, self.hub._user_agent.clone());
49491
49492                if let Some(token) = token.as_ref() {
49493                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
49494                }
49495
49496                let request = req_builder
49497                    .header(CONTENT_TYPE, json_mime_type.to_string())
49498                    .header(CONTENT_LENGTH, request_size as u64)
49499                    .body(common::to_body(
49500                        request_value_reader.get_ref().clone().into(),
49501                    ));
49502
49503                client.request(request.unwrap()).await
49504            };
49505
49506            match req_result {
49507                Err(err) => {
49508                    if let common::Retry::After(d) = dlg.http_error(&err) {
49509                        sleep(d).await;
49510                        continue;
49511                    }
49512                    dlg.finished(false);
49513                    return Err(common::Error::HttpError(err));
49514                }
49515                Ok(res) => {
49516                    let (mut parts, body) = res.into_parts();
49517                    let mut body = common::Body::new(body);
49518                    if !parts.status.is_success() {
49519                        let bytes = common::to_bytes(body).await.unwrap_or_default();
49520                        let error = serde_json::from_str(&common::to_string(&bytes));
49521                        let response = common::to_response(parts, bytes.into());
49522
49523                        if let common::Retry::After(d) =
49524                            dlg.http_failure(&response, error.as_ref().ok())
49525                        {
49526                            sleep(d).await;
49527                            continue;
49528                        }
49529
49530                        dlg.finished(false);
49531
49532                        return Err(match error {
49533                            Ok(value) => common::Error::BadRequest(value),
49534                            _ => common::Error::Failure(response),
49535                        });
49536                    }
49537                    let response = {
49538                        let bytes = common::to_bytes(body).await.unwrap_or_default();
49539                        let encoded = common::to_string(&bytes);
49540                        match serde_json::from_str(&encoded) {
49541                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
49542                            Err(error) => {
49543                                dlg.response_json_decode_error(&encoded, &error);
49544                                return Err(common::Error::JsonDecodeError(
49545                                    encoded.to_string(),
49546                                    error,
49547                                ));
49548                            }
49549                        }
49550                    };
49551
49552                    dlg.finished(true);
49553                    return Ok(response);
49554                }
49555            }
49556        }
49557    }
49558
49559    ///
49560    /// Sets the *request* property to the given value.
49561    ///
49562    /// Even though the property as already been set when instantiating this call,
49563    /// we provide this method for API completeness.
49564    pub fn request(mut self, new_value: FloodlightActivity) -> FloodlightActivityUpdateCall<'a, C> {
49565        self._request = new_value;
49566        self
49567    }
49568    /// User profile ID associated with this request.
49569    ///
49570    /// Sets the *profile id* path property to the given value.
49571    ///
49572    /// Even though the property as already been set when instantiating this call,
49573    /// we provide this method for API completeness.
49574    pub fn profile_id(mut self, new_value: i64) -> FloodlightActivityUpdateCall<'a, C> {
49575        self._profile_id = new_value;
49576        self
49577    }
49578    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
49579    /// while executing the actual API request.
49580    ///
49581    /// ````text
49582    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
49583    /// ````
49584    ///
49585    /// Sets the *delegate* property to the given value.
49586    pub fn delegate(
49587        mut self,
49588        new_value: &'a mut dyn common::Delegate,
49589    ) -> FloodlightActivityUpdateCall<'a, C> {
49590        self._delegate = Some(new_value);
49591        self
49592    }
49593
49594    /// Set any additional parameter of the query string used in the request.
49595    /// It should be used to set parameters which are not yet available through their own
49596    /// setters.
49597    ///
49598    /// Please note that this method must not be used to set any of the known parameters
49599    /// which have their own setter method. If done anyway, the request will fail.
49600    ///
49601    /// # Additional Parameters
49602    ///
49603    /// * *$.xgafv* (query-string) - V1 error format.
49604    /// * *access_token* (query-string) - OAuth access token.
49605    /// * *alt* (query-string) - Data format for response.
49606    /// * *callback* (query-string) - JSONP
49607    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
49608    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
49609    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
49610    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
49611    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
49612    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
49613    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
49614    pub fn param<T>(mut self, name: T, value: T) -> FloodlightActivityUpdateCall<'a, C>
49615    where
49616        T: AsRef<str>,
49617    {
49618        self._additional_params
49619            .insert(name.as_ref().to_string(), value.as_ref().to_string());
49620        self
49621    }
49622
49623    /// Identifies the authorization scope for the method you are building.
49624    ///
49625    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
49626    /// [`Scope::Dfatrafficking`].
49627    ///
49628    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
49629    /// tokens for more than one scope.
49630    ///
49631    /// Usually there is more than one suitable scope to authorize an operation, some of which may
49632    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
49633    /// sufficient, a read-write scope will do as well.
49634    pub fn add_scope<St>(mut self, scope: St) -> FloodlightActivityUpdateCall<'a, C>
49635    where
49636        St: AsRef<str>,
49637    {
49638        self._scopes.insert(String::from(scope.as_ref()));
49639        self
49640    }
49641    /// Identifies the authorization scope(s) for the method you are building.
49642    ///
49643    /// See [`Self::add_scope()`] for details.
49644    pub fn add_scopes<I, St>(mut self, scopes: I) -> FloodlightActivityUpdateCall<'a, C>
49645    where
49646        I: IntoIterator<Item = St>,
49647        St: AsRef<str>,
49648    {
49649        self._scopes
49650            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
49651        self
49652    }
49653
49654    /// Removes all scopes, and no default scope will be used either.
49655    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
49656    /// for details).
49657    pub fn clear_scopes(mut self) -> FloodlightActivityUpdateCall<'a, C> {
49658        self._scopes.clear();
49659        self
49660    }
49661}
49662
49663/// Gets one floodlight activity group by ID.
49664///
49665/// A builder for the *get* method supported by a *floodlightActivityGroup* resource.
49666/// It is not used directly, but through a [`FloodlightActivityGroupMethods`] instance.
49667///
49668/// # Example
49669///
49670/// Instantiate a resource method builder
49671///
49672/// ```test_harness,no_run
49673/// # extern crate hyper;
49674/// # extern crate hyper_rustls;
49675/// # extern crate google_dfareporting3d3 as dfareporting3d3;
49676/// # async fn dox() {
49677/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
49678///
49679/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
49680/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
49681/// #     secret,
49682/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
49683/// # ).build().await.unwrap();
49684///
49685/// # let client = hyper_util::client::legacy::Client::builder(
49686/// #     hyper_util::rt::TokioExecutor::new()
49687/// # )
49688/// # .build(
49689/// #     hyper_rustls::HttpsConnectorBuilder::new()
49690/// #         .with_native_roots()
49691/// #         .unwrap()
49692/// #         .https_or_http()
49693/// #         .enable_http1()
49694/// #         .build()
49695/// # );
49696/// # let mut hub = Dfareporting::new(client, auth);
49697/// // You can configure optional parameters by calling the respective setters at will, and
49698/// // execute the final call using `doit()`.
49699/// // Values shown here are possibly random and not representative !
49700/// let result = hub.floodlight_activity_groups().get(-15, -78)
49701///              .doit().await;
49702/// # }
49703/// ```
49704pub struct FloodlightActivityGroupGetCall<'a, C>
49705where
49706    C: 'a,
49707{
49708    hub: &'a Dfareporting<C>,
49709    _profile_id: i64,
49710    _id: i64,
49711    _delegate: Option<&'a mut dyn common::Delegate>,
49712    _additional_params: HashMap<String, String>,
49713    _scopes: BTreeSet<String>,
49714}
49715
49716impl<'a, C> common::CallBuilder for FloodlightActivityGroupGetCall<'a, C> {}
49717
49718impl<'a, C> FloodlightActivityGroupGetCall<'a, C>
49719where
49720    C: common::Connector,
49721{
49722    /// Perform the operation you have build so far.
49723    pub async fn doit(mut self) -> common::Result<(common::Response, FloodlightActivityGroup)> {
49724        use std::borrow::Cow;
49725        use std::io::{Read, Seek};
49726
49727        use common::{url::Params, ToParts};
49728        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
49729
49730        let mut dd = common::DefaultDelegate;
49731        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
49732        dlg.begin(common::MethodInfo {
49733            id: "dfareporting.floodlightActivityGroups.get",
49734            http_method: hyper::Method::GET,
49735        });
49736
49737        for &field in ["alt", "profileId", "id"].iter() {
49738            if self._additional_params.contains_key(field) {
49739                dlg.finished(false);
49740                return Err(common::Error::FieldClash(field));
49741            }
49742        }
49743
49744        let mut params = Params::with_capacity(4 + self._additional_params.len());
49745        params.push("profileId", self._profile_id.to_string());
49746        params.push("id", self._id.to_string());
49747
49748        params.extend(self._additional_params.iter());
49749
49750        params.push("alt", "json");
49751        let mut url =
49752            self.hub._base_url.clone() + "userprofiles/{profileId}/floodlightActivityGroups/{id}";
49753        if self._scopes.is_empty() {
49754            self._scopes
49755                .insert(Scope::Dfatrafficking.as_ref().to_string());
49756        }
49757
49758        #[allow(clippy::single_element_loop)]
49759        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
49760            url = params.uri_replacement(url, param_name, find_this, false);
49761        }
49762        {
49763            let to_remove = ["id", "profileId"];
49764            params.remove_params(&to_remove);
49765        }
49766
49767        let url = params.parse_with_url(&url);
49768
49769        loop {
49770            let token = match self
49771                .hub
49772                .auth
49773                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
49774                .await
49775            {
49776                Ok(token) => token,
49777                Err(e) => match dlg.token(e) {
49778                    Ok(token) => token,
49779                    Err(e) => {
49780                        dlg.finished(false);
49781                        return Err(common::Error::MissingToken(e));
49782                    }
49783                },
49784            };
49785            let mut req_result = {
49786                let client = &self.hub.client;
49787                dlg.pre_request();
49788                let mut req_builder = hyper::Request::builder()
49789                    .method(hyper::Method::GET)
49790                    .uri(url.as_str())
49791                    .header(USER_AGENT, self.hub._user_agent.clone());
49792
49793                if let Some(token) = token.as_ref() {
49794                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
49795                }
49796
49797                let request = req_builder
49798                    .header(CONTENT_LENGTH, 0_u64)
49799                    .body(common::to_body::<String>(None));
49800
49801                client.request(request.unwrap()).await
49802            };
49803
49804            match req_result {
49805                Err(err) => {
49806                    if let common::Retry::After(d) = dlg.http_error(&err) {
49807                        sleep(d).await;
49808                        continue;
49809                    }
49810                    dlg.finished(false);
49811                    return Err(common::Error::HttpError(err));
49812                }
49813                Ok(res) => {
49814                    let (mut parts, body) = res.into_parts();
49815                    let mut body = common::Body::new(body);
49816                    if !parts.status.is_success() {
49817                        let bytes = common::to_bytes(body).await.unwrap_or_default();
49818                        let error = serde_json::from_str(&common::to_string(&bytes));
49819                        let response = common::to_response(parts, bytes.into());
49820
49821                        if let common::Retry::After(d) =
49822                            dlg.http_failure(&response, error.as_ref().ok())
49823                        {
49824                            sleep(d).await;
49825                            continue;
49826                        }
49827
49828                        dlg.finished(false);
49829
49830                        return Err(match error {
49831                            Ok(value) => common::Error::BadRequest(value),
49832                            _ => common::Error::Failure(response),
49833                        });
49834                    }
49835                    let response = {
49836                        let bytes = common::to_bytes(body).await.unwrap_or_default();
49837                        let encoded = common::to_string(&bytes);
49838                        match serde_json::from_str(&encoded) {
49839                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
49840                            Err(error) => {
49841                                dlg.response_json_decode_error(&encoded, &error);
49842                                return Err(common::Error::JsonDecodeError(
49843                                    encoded.to_string(),
49844                                    error,
49845                                ));
49846                            }
49847                        }
49848                    };
49849
49850                    dlg.finished(true);
49851                    return Ok(response);
49852                }
49853            }
49854        }
49855    }
49856
49857    /// User profile ID associated with this request.
49858    ///
49859    /// Sets the *profile id* path property to the given value.
49860    ///
49861    /// Even though the property as already been set when instantiating this call,
49862    /// we provide this method for API completeness.
49863    pub fn profile_id(mut self, new_value: i64) -> FloodlightActivityGroupGetCall<'a, C> {
49864        self._profile_id = new_value;
49865        self
49866    }
49867    /// Floodlight activity Group ID.
49868    ///
49869    /// Sets the *id* path property to the given value.
49870    ///
49871    /// Even though the property as already been set when instantiating this call,
49872    /// we provide this method for API completeness.
49873    pub fn id(mut self, new_value: i64) -> FloodlightActivityGroupGetCall<'a, C> {
49874        self._id = new_value;
49875        self
49876    }
49877    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
49878    /// while executing the actual API request.
49879    ///
49880    /// ````text
49881    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
49882    /// ````
49883    ///
49884    /// Sets the *delegate* property to the given value.
49885    pub fn delegate(
49886        mut self,
49887        new_value: &'a mut dyn common::Delegate,
49888    ) -> FloodlightActivityGroupGetCall<'a, C> {
49889        self._delegate = Some(new_value);
49890        self
49891    }
49892
49893    /// Set any additional parameter of the query string used in the request.
49894    /// It should be used to set parameters which are not yet available through their own
49895    /// setters.
49896    ///
49897    /// Please note that this method must not be used to set any of the known parameters
49898    /// which have their own setter method. If done anyway, the request will fail.
49899    ///
49900    /// # Additional Parameters
49901    ///
49902    /// * *$.xgafv* (query-string) - V1 error format.
49903    /// * *access_token* (query-string) - OAuth access token.
49904    /// * *alt* (query-string) - Data format for response.
49905    /// * *callback* (query-string) - JSONP
49906    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
49907    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
49908    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
49909    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
49910    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
49911    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
49912    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
49913    pub fn param<T>(mut self, name: T, value: T) -> FloodlightActivityGroupGetCall<'a, C>
49914    where
49915        T: AsRef<str>,
49916    {
49917        self._additional_params
49918            .insert(name.as_ref().to_string(), value.as_ref().to_string());
49919        self
49920    }
49921
49922    /// Identifies the authorization scope for the method you are building.
49923    ///
49924    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
49925    /// [`Scope::Dfatrafficking`].
49926    ///
49927    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
49928    /// tokens for more than one scope.
49929    ///
49930    /// Usually there is more than one suitable scope to authorize an operation, some of which may
49931    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
49932    /// sufficient, a read-write scope will do as well.
49933    pub fn add_scope<St>(mut self, scope: St) -> FloodlightActivityGroupGetCall<'a, C>
49934    where
49935        St: AsRef<str>,
49936    {
49937        self._scopes.insert(String::from(scope.as_ref()));
49938        self
49939    }
49940    /// Identifies the authorization scope(s) for the method you are building.
49941    ///
49942    /// See [`Self::add_scope()`] for details.
49943    pub fn add_scopes<I, St>(mut self, scopes: I) -> FloodlightActivityGroupGetCall<'a, C>
49944    where
49945        I: IntoIterator<Item = St>,
49946        St: AsRef<str>,
49947    {
49948        self._scopes
49949            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
49950        self
49951    }
49952
49953    /// Removes all scopes, and no default scope will be used either.
49954    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
49955    /// for details).
49956    pub fn clear_scopes(mut self) -> FloodlightActivityGroupGetCall<'a, C> {
49957        self._scopes.clear();
49958        self
49959    }
49960}
49961
49962/// Inserts a new floodlight activity group.
49963///
49964/// A builder for the *insert* method supported by a *floodlightActivityGroup* resource.
49965/// It is not used directly, but through a [`FloodlightActivityGroupMethods`] instance.
49966///
49967/// # Example
49968///
49969/// Instantiate a resource method builder
49970///
49971/// ```test_harness,no_run
49972/// # extern crate hyper;
49973/// # extern crate hyper_rustls;
49974/// # extern crate google_dfareporting3d3 as dfareporting3d3;
49975/// use dfareporting3d3::api::FloodlightActivityGroup;
49976/// # async fn dox() {
49977/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
49978///
49979/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
49980/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
49981/// #     secret,
49982/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
49983/// # ).build().await.unwrap();
49984///
49985/// # let client = hyper_util::client::legacy::Client::builder(
49986/// #     hyper_util::rt::TokioExecutor::new()
49987/// # )
49988/// # .build(
49989/// #     hyper_rustls::HttpsConnectorBuilder::new()
49990/// #         .with_native_roots()
49991/// #         .unwrap()
49992/// #         .https_or_http()
49993/// #         .enable_http1()
49994/// #         .build()
49995/// # );
49996/// # let mut hub = Dfareporting::new(client, auth);
49997/// // As the method needs a request, you would usually fill it with the desired information
49998/// // into the respective structure. Some of the parts shown here might not be applicable !
49999/// // Values shown here are possibly random and not representative !
50000/// let mut req = FloodlightActivityGroup::default();
50001///
50002/// // You can configure optional parameters by calling the respective setters at will, and
50003/// // execute the final call using `doit()`.
50004/// // Values shown here are possibly random and not representative !
50005/// let result = hub.floodlight_activity_groups().insert(req, -77)
50006///              .doit().await;
50007/// # }
50008/// ```
50009pub struct FloodlightActivityGroupInsertCall<'a, C>
50010where
50011    C: 'a,
50012{
50013    hub: &'a Dfareporting<C>,
50014    _request: FloodlightActivityGroup,
50015    _profile_id: i64,
50016    _delegate: Option<&'a mut dyn common::Delegate>,
50017    _additional_params: HashMap<String, String>,
50018    _scopes: BTreeSet<String>,
50019}
50020
50021impl<'a, C> common::CallBuilder for FloodlightActivityGroupInsertCall<'a, C> {}
50022
50023impl<'a, C> FloodlightActivityGroupInsertCall<'a, C>
50024where
50025    C: common::Connector,
50026{
50027    /// Perform the operation you have build so far.
50028    pub async fn doit(mut self) -> common::Result<(common::Response, FloodlightActivityGroup)> {
50029        use std::borrow::Cow;
50030        use std::io::{Read, Seek};
50031
50032        use common::{url::Params, ToParts};
50033        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
50034
50035        let mut dd = common::DefaultDelegate;
50036        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
50037        dlg.begin(common::MethodInfo {
50038            id: "dfareporting.floodlightActivityGroups.insert",
50039            http_method: hyper::Method::POST,
50040        });
50041
50042        for &field in ["alt", "profileId"].iter() {
50043            if self._additional_params.contains_key(field) {
50044                dlg.finished(false);
50045                return Err(common::Error::FieldClash(field));
50046            }
50047        }
50048
50049        let mut params = Params::with_capacity(4 + self._additional_params.len());
50050        params.push("profileId", self._profile_id.to_string());
50051
50052        params.extend(self._additional_params.iter());
50053
50054        params.push("alt", "json");
50055        let mut url =
50056            self.hub._base_url.clone() + "userprofiles/{profileId}/floodlightActivityGroups";
50057        if self._scopes.is_empty() {
50058            self._scopes
50059                .insert(Scope::Dfatrafficking.as_ref().to_string());
50060        }
50061
50062        #[allow(clippy::single_element_loop)]
50063        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
50064            url = params.uri_replacement(url, param_name, find_this, false);
50065        }
50066        {
50067            let to_remove = ["profileId"];
50068            params.remove_params(&to_remove);
50069        }
50070
50071        let url = params.parse_with_url(&url);
50072
50073        let mut json_mime_type = mime::APPLICATION_JSON;
50074        let mut request_value_reader = {
50075            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
50076            common::remove_json_null_values(&mut value);
50077            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
50078            serde_json::to_writer(&mut dst, &value).unwrap();
50079            dst
50080        };
50081        let request_size = request_value_reader
50082            .seek(std::io::SeekFrom::End(0))
50083            .unwrap();
50084        request_value_reader
50085            .seek(std::io::SeekFrom::Start(0))
50086            .unwrap();
50087
50088        loop {
50089            let token = match self
50090                .hub
50091                .auth
50092                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
50093                .await
50094            {
50095                Ok(token) => token,
50096                Err(e) => match dlg.token(e) {
50097                    Ok(token) => token,
50098                    Err(e) => {
50099                        dlg.finished(false);
50100                        return Err(common::Error::MissingToken(e));
50101                    }
50102                },
50103            };
50104            request_value_reader
50105                .seek(std::io::SeekFrom::Start(0))
50106                .unwrap();
50107            let mut req_result = {
50108                let client = &self.hub.client;
50109                dlg.pre_request();
50110                let mut req_builder = hyper::Request::builder()
50111                    .method(hyper::Method::POST)
50112                    .uri(url.as_str())
50113                    .header(USER_AGENT, self.hub._user_agent.clone());
50114
50115                if let Some(token) = token.as_ref() {
50116                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
50117                }
50118
50119                let request = req_builder
50120                    .header(CONTENT_TYPE, json_mime_type.to_string())
50121                    .header(CONTENT_LENGTH, request_size as u64)
50122                    .body(common::to_body(
50123                        request_value_reader.get_ref().clone().into(),
50124                    ));
50125
50126                client.request(request.unwrap()).await
50127            };
50128
50129            match req_result {
50130                Err(err) => {
50131                    if let common::Retry::After(d) = dlg.http_error(&err) {
50132                        sleep(d).await;
50133                        continue;
50134                    }
50135                    dlg.finished(false);
50136                    return Err(common::Error::HttpError(err));
50137                }
50138                Ok(res) => {
50139                    let (mut parts, body) = res.into_parts();
50140                    let mut body = common::Body::new(body);
50141                    if !parts.status.is_success() {
50142                        let bytes = common::to_bytes(body).await.unwrap_or_default();
50143                        let error = serde_json::from_str(&common::to_string(&bytes));
50144                        let response = common::to_response(parts, bytes.into());
50145
50146                        if let common::Retry::After(d) =
50147                            dlg.http_failure(&response, error.as_ref().ok())
50148                        {
50149                            sleep(d).await;
50150                            continue;
50151                        }
50152
50153                        dlg.finished(false);
50154
50155                        return Err(match error {
50156                            Ok(value) => common::Error::BadRequest(value),
50157                            _ => common::Error::Failure(response),
50158                        });
50159                    }
50160                    let response = {
50161                        let bytes = common::to_bytes(body).await.unwrap_or_default();
50162                        let encoded = common::to_string(&bytes);
50163                        match serde_json::from_str(&encoded) {
50164                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
50165                            Err(error) => {
50166                                dlg.response_json_decode_error(&encoded, &error);
50167                                return Err(common::Error::JsonDecodeError(
50168                                    encoded.to_string(),
50169                                    error,
50170                                ));
50171                            }
50172                        }
50173                    };
50174
50175                    dlg.finished(true);
50176                    return Ok(response);
50177                }
50178            }
50179        }
50180    }
50181
50182    ///
50183    /// Sets the *request* property to the given value.
50184    ///
50185    /// Even though the property as already been set when instantiating this call,
50186    /// we provide this method for API completeness.
50187    pub fn request(
50188        mut self,
50189        new_value: FloodlightActivityGroup,
50190    ) -> FloodlightActivityGroupInsertCall<'a, C> {
50191        self._request = new_value;
50192        self
50193    }
50194    /// User profile ID associated with this request.
50195    ///
50196    /// Sets the *profile id* path property to the given value.
50197    ///
50198    /// Even though the property as already been set when instantiating this call,
50199    /// we provide this method for API completeness.
50200    pub fn profile_id(mut self, new_value: i64) -> FloodlightActivityGroupInsertCall<'a, C> {
50201        self._profile_id = new_value;
50202        self
50203    }
50204    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
50205    /// while executing the actual API request.
50206    ///
50207    /// ````text
50208    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
50209    /// ````
50210    ///
50211    /// Sets the *delegate* property to the given value.
50212    pub fn delegate(
50213        mut self,
50214        new_value: &'a mut dyn common::Delegate,
50215    ) -> FloodlightActivityGroupInsertCall<'a, C> {
50216        self._delegate = Some(new_value);
50217        self
50218    }
50219
50220    /// Set any additional parameter of the query string used in the request.
50221    /// It should be used to set parameters which are not yet available through their own
50222    /// setters.
50223    ///
50224    /// Please note that this method must not be used to set any of the known parameters
50225    /// which have their own setter method. If done anyway, the request will fail.
50226    ///
50227    /// # Additional Parameters
50228    ///
50229    /// * *$.xgafv* (query-string) - V1 error format.
50230    /// * *access_token* (query-string) - OAuth access token.
50231    /// * *alt* (query-string) - Data format for response.
50232    /// * *callback* (query-string) - JSONP
50233    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
50234    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
50235    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
50236    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
50237    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
50238    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
50239    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
50240    pub fn param<T>(mut self, name: T, value: T) -> FloodlightActivityGroupInsertCall<'a, C>
50241    where
50242        T: AsRef<str>,
50243    {
50244        self._additional_params
50245            .insert(name.as_ref().to_string(), value.as_ref().to_string());
50246        self
50247    }
50248
50249    /// Identifies the authorization scope for the method you are building.
50250    ///
50251    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
50252    /// [`Scope::Dfatrafficking`].
50253    ///
50254    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
50255    /// tokens for more than one scope.
50256    ///
50257    /// Usually there is more than one suitable scope to authorize an operation, some of which may
50258    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
50259    /// sufficient, a read-write scope will do as well.
50260    pub fn add_scope<St>(mut self, scope: St) -> FloodlightActivityGroupInsertCall<'a, C>
50261    where
50262        St: AsRef<str>,
50263    {
50264        self._scopes.insert(String::from(scope.as_ref()));
50265        self
50266    }
50267    /// Identifies the authorization scope(s) for the method you are building.
50268    ///
50269    /// See [`Self::add_scope()`] for details.
50270    pub fn add_scopes<I, St>(mut self, scopes: I) -> FloodlightActivityGroupInsertCall<'a, C>
50271    where
50272        I: IntoIterator<Item = St>,
50273        St: AsRef<str>,
50274    {
50275        self._scopes
50276            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
50277        self
50278    }
50279
50280    /// Removes all scopes, and no default scope will be used either.
50281    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
50282    /// for details).
50283    pub fn clear_scopes(mut self) -> FloodlightActivityGroupInsertCall<'a, C> {
50284        self._scopes.clear();
50285        self
50286    }
50287}
50288
50289/// Retrieves a list of floodlight activity groups, possibly filtered. This method supports paging.
50290///
50291/// A builder for the *list* method supported by a *floodlightActivityGroup* resource.
50292/// It is not used directly, but through a [`FloodlightActivityGroupMethods`] instance.
50293///
50294/// # Example
50295///
50296/// Instantiate a resource method builder
50297///
50298/// ```test_harness,no_run
50299/// # extern crate hyper;
50300/// # extern crate hyper_rustls;
50301/// # extern crate google_dfareporting3d3 as dfareporting3d3;
50302/// # async fn dox() {
50303/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
50304///
50305/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
50306/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
50307/// #     secret,
50308/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
50309/// # ).build().await.unwrap();
50310///
50311/// # let client = hyper_util::client::legacy::Client::builder(
50312/// #     hyper_util::rt::TokioExecutor::new()
50313/// # )
50314/// # .build(
50315/// #     hyper_rustls::HttpsConnectorBuilder::new()
50316/// #         .with_native_roots()
50317/// #         .unwrap()
50318/// #         .https_or_http()
50319/// #         .enable_http1()
50320/// #         .build()
50321/// # );
50322/// # let mut hub = Dfareporting::new(client, auth);
50323/// // You can configure optional parameters by calling the respective setters at will, and
50324/// // execute the final call using `doit()`.
50325/// // Values shown here are possibly random and not representative !
50326/// let result = hub.floodlight_activity_groups().list(-92)
50327///              .type_("amet")
50328///              .sort_order("At")
50329///              .sort_field("eirmod")
50330///              .search_string("erat")
50331///              .page_token("duo")
50332///              .max_results(-35)
50333///              .add_ids(-1)
50334///              .floodlight_configuration_id(-81)
50335///              .advertiser_id(-48)
50336///              .doit().await;
50337/// # }
50338/// ```
50339pub struct FloodlightActivityGroupListCall<'a, C>
50340where
50341    C: 'a,
50342{
50343    hub: &'a Dfareporting<C>,
50344    _profile_id: i64,
50345    _type_: Option<String>,
50346    _sort_order: Option<String>,
50347    _sort_field: Option<String>,
50348    _search_string: Option<String>,
50349    _page_token: Option<String>,
50350    _max_results: Option<i32>,
50351    _ids: Vec<i64>,
50352    _floodlight_configuration_id: Option<i64>,
50353    _advertiser_id: Option<i64>,
50354    _delegate: Option<&'a mut dyn common::Delegate>,
50355    _additional_params: HashMap<String, String>,
50356    _scopes: BTreeSet<String>,
50357}
50358
50359impl<'a, C> common::CallBuilder for FloodlightActivityGroupListCall<'a, C> {}
50360
50361impl<'a, C> FloodlightActivityGroupListCall<'a, C>
50362where
50363    C: common::Connector,
50364{
50365    /// Perform the operation you have build so far.
50366    pub async fn doit(
50367        mut self,
50368    ) -> common::Result<(common::Response, FloodlightActivityGroupsListResponse)> {
50369        use std::borrow::Cow;
50370        use std::io::{Read, Seek};
50371
50372        use common::{url::Params, ToParts};
50373        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
50374
50375        let mut dd = common::DefaultDelegate;
50376        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
50377        dlg.begin(common::MethodInfo {
50378            id: "dfareporting.floodlightActivityGroups.list",
50379            http_method: hyper::Method::GET,
50380        });
50381
50382        for &field in [
50383            "alt",
50384            "profileId",
50385            "type",
50386            "sortOrder",
50387            "sortField",
50388            "searchString",
50389            "pageToken",
50390            "maxResults",
50391            "ids",
50392            "floodlightConfigurationId",
50393            "advertiserId",
50394        ]
50395        .iter()
50396        {
50397            if self._additional_params.contains_key(field) {
50398                dlg.finished(false);
50399                return Err(common::Error::FieldClash(field));
50400            }
50401        }
50402
50403        let mut params = Params::with_capacity(12 + self._additional_params.len());
50404        params.push("profileId", self._profile_id.to_string());
50405        if let Some(value) = self._type_.as_ref() {
50406            params.push("type", value);
50407        }
50408        if let Some(value) = self._sort_order.as_ref() {
50409            params.push("sortOrder", value);
50410        }
50411        if let Some(value) = self._sort_field.as_ref() {
50412            params.push("sortField", value);
50413        }
50414        if let Some(value) = self._search_string.as_ref() {
50415            params.push("searchString", value);
50416        }
50417        if let Some(value) = self._page_token.as_ref() {
50418            params.push("pageToken", value);
50419        }
50420        if let Some(value) = self._max_results.as_ref() {
50421            params.push("maxResults", value.to_string());
50422        }
50423        if !self._ids.is_empty() {
50424            for f in self._ids.iter() {
50425                params.push("ids", f.to_string());
50426            }
50427        }
50428        if let Some(value) = self._floodlight_configuration_id.as_ref() {
50429            params.push("floodlightConfigurationId", value.to_string());
50430        }
50431        if let Some(value) = self._advertiser_id.as_ref() {
50432            params.push("advertiserId", value.to_string());
50433        }
50434
50435        params.extend(self._additional_params.iter());
50436
50437        params.push("alt", "json");
50438        let mut url =
50439            self.hub._base_url.clone() + "userprofiles/{profileId}/floodlightActivityGroups";
50440        if self._scopes.is_empty() {
50441            self._scopes
50442                .insert(Scope::Dfatrafficking.as_ref().to_string());
50443        }
50444
50445        #[allow(clippy::single_element_loop)]
50446        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
50447            url = params.uri_replacement(url, param_name, find_this, false);
50448        }
50449        {
50450            let to_remove = ["profileId"];
50451            params.remove_params(&to_remove);
50452        }
50453
50454        let url = params.parse_with_url(&url);
50455
50456        loop {
50457            let token = match self
50458                .hub
50459                .auth
50460                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
50461                .await
50462            {
50463                Ok(token) => token,
50464                Err(e) => match dlg.token(e) {
50465                    Ok(token) => token,
50466                    Err(e) => {
50467                        dlg.finished(false);
50468                        return Err(common::Error::MissingToken(e));
50469                    }
50470                },
50471            };
50472            let mut req_result = {
50473                let client = &self.hub.client;
50474                dlg.pre_request();
50475                let mut req_builder = hyper::Request::builder()
50476                    .method(hyper::Method::GET)
50477                    .uri(url.as_str())
50478                    .header(USER_AGENT, self.hub._user_agent.clone());
50479
50480                if let Some(token) = token.as_ref() {
50481                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
50482                }
50483
50484                let request = req_builder
50485                    .header(CONTENT_LENGTH, 0_u64)
50486                    .body(common::to_body::<String>(None));
50487
50488                client.request(request.unwrap()).await
50489            };
50490
50491            match req_result {
50492                Err(err) => {
50493                    if let common::Retry::After(d) = dlg.http_error(&err) {
50494                        sleep(d).await;
50495                        continue;
50496                    }
50497                    dlg.finished(false);
50498                    return Err(common::Error::HttpError(err));
50499                }
50500                Ok(res) => {
50501                    let (mut parts, body) = res.into_parts();
50502                    let mut body = common::Body::new(body);
50503                    if !parts.status.is_success() {
50504                        let bytes = common::to_bytes(body).await.unwrap_or_default();
50505                        let error = serde_json::from_str(&common::to_string(&bytes));
50506                        let response = common::to_response(parts, bytes.into());
50507
50508                        if let common::Retry::After(d) =
50509                            dlg.http_failure(&response, error.as_ref().ok())
50510                        {
50511                            sleep(d).await;
50512                            continue;
50513                        }
50514
50515                        dlg.finished(false);
50516
50517                        return Err(match error {
50518                            Ok(value) => common::Error::BadRequest(value),
50519                            _ => common::Error::Failure(response),
50520                        });
50521                    }
50522                    let response = {
50523                        let bytes = common::to_bytes(body).await.unwrap_or_default();
50524                        let encoded = common::to_string(&bytes);
50525                        match serde_json::from_str(&encoded) {
50526                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
50527                            Err(error) => {
50528                                dlg.response_json_decode_error(&encoded, &error);
50529                                return Err(common::Error::JsonDecodeError(
50530                                    encoded.to_string(),
50531                                    error,
50532                                ));
50533                            }
50534                        }
50535                    };
50536
50537                    dlg.finished(true);
50538                    return Ok(response);
50539                }
50540            }
50541        }
50542    }
50543
50544    /// User profile ID associated with this request.
50545    ///
50546    /// Sets the *profile id* path property to the given value.
50547    ///
50548    /// Even though the property as already been set when instantiating this call,
50549    /// we provide this method for API completeness.
50550    pub fn profile_id(mut self, new_value: i64) -> FloodlightActivityGroupListCall<'a, C> {
50551        self._profile_id = new_value;
50552        self
50553    }
50554    /// Select only floodlight activity groups with the specified floodlight activity group type.
50555    ///
50556    /// Sets the *type* query property to the given value.
50557    pub fn type_(mut self, new_value: &str) -> FloodlightActivityGroupListCall<'a, C> {
50558        self._type_ = Some(new_value.to_string());
50559        self
50560    }
50561    /// Order of sorted results.
50562    ///
50563    /// Sets the *sort order* query property to the given value.
50564    pub fn sort_order(mut self, new_value: &str) -> FloodlightActivityGroupListCall<'a, C> {
50565        self._sort_order = Some(new_value.to_string());
50566        self
50567    }
50568    /// Field by which to sort the list.
50569    ///
50570    /// Sets the *sort field* query property to the given value.
50571    pub fn sort_field(mut self, new_value: &str) -> FloodlightActivityGroupListCall<'a, C> {
50572        self._sort_field = Some(new_value.to_string());
50573        self
50574    }
50575    /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "floodlightactivitygroup*2015" will return objects with names like "floodlightactivitygroup June 2015", "floodlightactivitygroup April 2015", or simply "floodlightactivitygroup 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "floodlightactivitygroup" will match objects with name "my floodlightactivitygroup activity", "floodlightactivitygroup 2015", or simply "floodlightactivitygroup".
50576    ///
50577    /// Sets the *search string* query property to the given value.
50578    pub fn search_string(mut self, new_value: &str) -> FloodlightActivityGroupListCall<'a, C> {
50579        self._search_string = Some(new_value.to_string());
50580        self
50581    }
50582    /// Value of the nextPageToken from the previous result page.
50583    ///
50584    /// Sets the *page token* query property to the given value.
50585    pub fn page_token(mut self, new_value: &str) -> FloodlightActivityGroupListCall<'a, C> {
50586        self._page_token = Some(new_value.to_string());
50587        self
50588    }
50589    /// Maximum number of results to return.
50590    ///
50591    /// Sets the *max results* query property to the given value.
50592    pub fn max_results(mut self, new_value: i32) -> FloodlightActivityGroupListCall<'a, C> {
50593        self._max_results = Some(new_value);
50594        self
50595    }
50596    /// Select only floodlight activity groups with the specified IDs. Must specify either advertiserId or floodlightConfigurationId for a non-empty result.
50597    ///
50598    /// Append the given value to the *ids* query property.
50599    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
50600    pub fn add_ids(mut self, new_value: i64) -> FloodlightActivityGroupListCall<'a, C> {
50601        self._ids.push(new_value);
50602        self
50603    }
50604    /// Select only floodlight activity groups with the specified floodlight configuration ID. Must specify either advertiserId, or floodlightConfigurationId for a non-empty result.
50605    ///
50606    /// Sets the *floodlight configuration id* query property to the given value.
50607    pub fn floodlight_configuration_id(
50608        mut self,
50609        new_value: i64,
50610    ) -> FloodlightActivityGroupListCall<'a, C> {
50611        self._floodlight_configuration_id = Some(new_value);
50612        self
50613    }
50614    /// Select only floodlight activity groups with the specified advertiser ID. Must specify either advertiserId or floodlightConfigurationId for a non-empty result.
50615    ///
50616    /// Sets the *advertiser id* query property to the given value.
50617    pub fn advertiser_id(mut self, new_value: i64) -> FloodlightActivityGroupListCall<'a, C> {
50618        self._advertiser_id = Some(new_value);
50619        self
50620    }
50621    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
50622    /// while executing the actual API request.
50623    ///
50624    /// ````text
50625    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
50626    /// ````
50627    ///
50628    /// Sets the *delegate* property to the given value.
50629    pub fn delegate(
50630        mut self,
50631        new_value: &'a mut dyn common::Delegate,
50632    ) -> FloodlightActivityGroupListCall<'a, C> {
50633        self._delegate = Some(new_value);
50634        self
50635    }
50636
50637    /// Set any additional parameter of the query string used in the request.
50638    /// It should be used to set parameters which are not yet available through their own
50639    /// setters.
50640    ///
50641    /// Please note that this method must not be used to set any of the known parameters
50642    /// which have their own setter method. If done anyway, the request will fail.
50643    ///
50644    /// # Additional Parameters
50645    ///
50646    /// * *$.xgafv* (query-string) - V1 error format.
50647    /// * *access_token* (query-string) - OAuth access token.
50648    /// * *alt* (query-string) - Data format for response.
50649    /// * *callback* (query-string) - JSONP
50650    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
50651    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
50652    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
50653    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
50654    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
50655    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
50656    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
50657    pub fn param<T>(mut self, name: T, value: T) -> FloodlightActivityGroupListCall<'a, C>
50658    where
50659        T: AsRef<str>,
50660    {
50661        self._additional_params
50662            .insert(name.as_ref().to_string(), value.as_ref().to_string());
50663        self
50664    }
50665
50666    /// Identifies the authorization scope for the method you are building.
50667    ///
50668    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
50669    /// [`Scope::Dfatrafficking`].
50670    ///
50671    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
50672    /// tokens for more than one scope.
50673    ///
50674    /// Usually there is more than one suitable scope to authorize an operation, some of which may
50675    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
50676    /// sufficient, a read-write scope will do as well.
50677    pub fn add_scope<St>(mut self, scope: St) -> FloodlightActivityGroupListCall<'a, C>
50678    where
50679        St: AsRef<str>,
50680    {
50681        self._scopes.insert(String::from(scope.as_ref()));
50682        self
50683    }
50684    /// Identifies the authorization scope(s) for the method you are building.
50685    ///
50686    /// See [`Self::add_scope()`] for details.
50687    pub fn add_scopes<I, St>(mut self, scopes: I) -> FloodlightActivityGroupListCall<'a, C>
50688    where
50689        I: IntoIterator<Item = St>,
50690        St: AsRef<str>,
50691    {
50692        self._scopes
50693            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
50694        self
50695    }
50696
50697    /// Removes all scopes, and no default scope will be used either.
50698    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
50699    /// for details).
50700    pub fn clear_scopes(mut self) -> FloodlightActivityGroupListCall<'a, C> {
50701        self._scopes.clear();
50702        self
50703    }
50704}
50705
50706/// Updates an existing floodlight activity group. This method supports patch semantics.
50707///
50708/// A builder for the *patch* method supported by a *floodlightActivityGroup* resource.
50709/// It is not used directly, but through a [`FloodlightActivityGroupMethods`] instance.
50710///
50711/// # Example
50712///
50713/// Instantiate a resource method builder
50714///
50715/// ```test_harness,no_run
50716/// # extern crate hyper;
50717/// # extern crate hyper_rustls;
50718/// # extern crate google_dfareporting3d3 as dfareporting3d3;
50719/// use dfareporting3d3::api::FloodlightActivityGroup;
50720/// # async fn dox() {
50721/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
50722///
50723/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
50724/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
50725/// #     secret,
50726/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
50727/// # ).build().await.unwrap();
50728///
50729/// # let client = hyper_util::client::legacy::Client::builder(
50730/// #     hyper_util::rt::TokioExecutor::new()
50731/// # )
50732/// # .build(
50733/// #     hyper_rustls::HttpsConnectorBuilder::new()
50734/// #         .with_native_roots()
50735/// #         .unwrap()
50736/// #         .https_or_http()
50737/// #         .enable_http1()
50738/// #         .build()
50739/// # );
50740/// # let mut hub = Dfareporting::new(client, auth);
50741/// // As the method needs a request, you would usually fill it with the desired information
50742/// // into the respective structure. Some of the parts shown here might not be applicable !
50743/// // Values shown here are possibly random and not representative !
50744/// let mut req = FloodlightActivityGroup::default();
50745///
50746/// // You can configure optional parameters by calling the respective setters at will, and
50747/// // execute the final call using `doit()`.
50748/// // Values shown here are possibly random and not representative !
50749/// let result = hub.floodlight_activity_groups().patch(req, -73, -24)
50750///              .doit().await;
50751/// # }
50752/// ```
50753pub struct FloodlightActivityGroupPatchCall<'a, C>
50754where
50755    C: 'a,
50756{
50757    hub: &'a Dfareporting<C>,
50758    _request: FloodlightActivityGroup,
50759    _profile_id: i64,
50760    _id: i64,
50761    _delegate: Option<&'a mut dyn common::Delegate>,
50762    _additional_params: HashMap<String, String>,
50763    _scopes: BTreeSet<String>,
50764}
50765
50766impl<'a, C> common::CallBuilder for FloodlightActivityGroupPatchCall<'a, C> {}
50767
50768impl<'a, C> FloodlightActivityGroupPatchCall<'a, C>
50769where
50770    C: common::Connector,
50771{
50772    /// Perform the operation you have build so far.
50773    pub async fn doit(mut self) -> common::Result<(common::Response, FloodlightActivityGroup)> {
50774        use std::borrow::Cow;
50775        use std::io::{Read, Seek};
50776
50777        use common::{url::Params, ToParts};
50778        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
50779
50780        let mut dd = common::DefaultDelegate;
50781        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
50782        dlg.begin(common::MethodInfo {
50783            id: "dfareporting.floodlightActivityGroups.patch",
50784            http_method: hyper::Method::PATCH,
50785        });
50786
50787        for &field in ["alt", "profileId", "id"].iter() {
50788            if self._additional_params.contains_key(field) {
50789                dlg.finished(false);
50790                return Err(common::Error::FieldClash(field));
50791            }
50792        }
50793
50794        let mut params = Params::with_capacity(5 + self._additional_params.len());
50795        params.push("profileId", self._profile_id.to_string());
50796        params.push("id", self._id.to_string());
50797
50798        params.extend(self._additional_params.iter());
50799
50800        params.push("alt", "json");
50801        let mut url =
50802            self.hub._base_url.clone() + "userprofiles/{profileId}/floodlightActivityGroups";
50803        if self._scopes.is_empty() {
50804            self._scopes
50805                .insert(Scope::Dfatrafficking.as_ref().to_string());
50806        }
50807
50808        #[allow(clippy::single_element_loop)]
50809        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
50810            url = params.uri_replacement(url, param_name, find_this, false);
50811        }
50812        {
50813            let to_remove = ["profileId"];
50814            params.remove_params(&to_remove);
50815        }
50816
50817        let url = params.parse_with_url(&url);
50818
50819        let mut json_mime_type = mime::APPLICATION_JSON;
50820        let mut request_value_reader = {
50821            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
50822            common::remove_json_null_values(&mut value);
50823            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
50824            serde_json::to_writer(&mut dst, &value).unwrap();
50825            dst
50826        };
50827        let request_size = request_value_reader
50828            .seek(std::io::SeekFrom::End(0))
50829            .unwrap();
50830        request_value_reader
50831            .seek(std::io::SeekFrom::Start(0))
50832            .unwrap();
50833
50834        loop {
50835            let token = match self
50836                .hub
50837                .auth
50838                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
50839                .await
50840            {
50841                Ok(token) => token,
50842                Err(e) => match dlg.token(e) {
50843                    Ok(token) => token,
50844                    Err(e) => {
50845                        dlg.finished(false);
50846                        return Err(common::Error::MissingToken(e));
50847                    }
50848                },
50849            };
50850            request_value_reader
50851                .seek(std::io::SeekFrom::Start(0))
50852                .unwrap();
50853            let mut req_result = {
50854                let client = &self.hub.client;
50855                dlg.pre_request();
50856                let mut req_builder = hyper::Request::builder()
50857                    .method(hyper::Method::PATCH)
50858                    .uri(url.as_str())
50859                    .header(USER_AGENT, self.hub._user_agent.clone());
50860
50861                if let Some(token) = token.as_ref() {
50862                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
50863                }
50864
50865                let request = req_builder
50866                    .header(CONTENT_TYPE, json_mime_type.to_string())
50867                    .header(CONTENT_LENGTH, request_size as u64)
50868                    .body(common::to_body(
50869                        request_value_reader.get_ref().clone().into(),
50870                    ));
50871
50872                client.request(request.unwrap()).await
50873            };
50874
50875            match req_result {
50876                Err(err) => {
50877                    if let common::Retry::After(d) = dlg.http_error(&err) {
50878                        sleep(d).await;
50879                        continue;
50880                    }
50881                    dlg.finished(false);
50882                    return Err(common::Error::HttpError(err));
50883                }
50884                Ok(res) => {
50885                    let (mut parts, body) = res.into_parts();
50886                    let mut body = common::Body::new(body);
50887                    if !parts.status.is_success() {
50888                        let bytes = common::to_bytes(body).await.unwrap_or_default();
50889                        let error = serde_json::from_str(&common::to_string(&bytes));
50890                        let response = common::to_response(parts, bytes.into());
50891
50892                        if let common::Retry::After(d) =
50893                            dlg.http_failure(&response, error.as_ref().ok())
50894                        {
50895                            sleep(d).await;
50896                            continue;
50897                        }
50898
50899                        dlg.finished(false);
50900
50901                        return Err(match error {
50902                            Ok(value) => common::Error::BadRequest(value),
50903                            _ => common::Error::Failure(response),
50904                        });
50905                    }
50906                    let response = {
50907                        let bytes = common::to_bytes(body).await.unwrap_or_default();
50908                        let encoded = common::to_string(&bytes);
50909                        match serde_json::from_str(&encoded) {
50910                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
50911                            Err(error) => {
50912                                dlg.response_json_decode_error(&encoded, &error);
50913                                return Err(common::Error::JsonDecodeError(
50914                                    encoded.to_string(),
50915                                    error,
50916                                ));
50917                            }
50918                        }
50919                    };
50920
50921                    dlg.finished(true);
50922                    return Ok(response);
50923                }
50924            }
50925        }
50926    }
50927
50928    ///
50929    /// Sets the *request* property to the given value.
50930    ///
50931    /// Even though the property as already been set when instantiating this call,
50932    /// we provide this method for API completeness.
50933    pub fn request(
50934        mut self,
50935        new_value: FloodlightActivityGroup,
50936    ) -> FloodlightActivityGroupPatchCall<'a, C> {
50937        self._request = new_value;
50938        self
50939    }
50940    /// User profile ID associated with this request.
50941    ///
50942    /// Sets the *profile id* path property to the given value.
50943    ///
50944    /// Even though the property as already been set when instantiating this call,
50945    /// we provide this method for API completeness.
50946    pub fn profile_id(mut self, new_value: i64) -> FloodlightActivityGroupPatchCall<'a, C> {
50947        self._profile_id = new_value;
50948        self
50949    }
50950    /// FloodlightActivityGroup ID.
50951    ///
50952    /// Sets the *id* query property to the given value.
50953    ///
50954    /// Even though the property as already been set when instantiating this call,
50955    /// we provide this method for API completeness.
50956    pub fn id(mut self, new_value: i64) -> FloodlightActivityGroupPatchCall<'a, C> {
50957        self._id = new_value;
50958        self
50959    }
50960    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
50961    /// while executing the actual API request.
50962    ///
50963    /// ````text
50964    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
50965    /// ````
50966    ///
50967    /// Sets the *delegate* property to the given value.
50968    pub fn delegate(
50969        mut self,
50970        new_value: &'a mut dyn common::Delegate,
50971    ) -> FloodlightActivityGroupPatchCall<'a, C> {
50972        self._delegate = Some(new_value);
50973        self
50974    }
50975
50976    /// Set any additional parameter of the query string used in the request.
50977    /// It should be used to set parameters which are not yet available through their own
50978    /// setters.
50979    ///
50980    /// Please note that this method must not be used to set any of the known parameters
50981    /// which have their own setter method. If done anyway, the request will fail.
50982    ///
50983    /// # Additional Parameters
50984    ///
50985    /// * *$.xgafv* (query-string) - V1 error format.
50986    /// * *access_token* (query-string) - OAuth access token.
50987    /// * *alt* (query-string) - Data format for response.
50988    /// * *callback* (query-string) - JSONP
50989    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
50990    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
50991    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
50992    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
50993    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
50994    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
50995    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
50996    pub fn param<T>(mut self, name: T, value: T) -> FloodlightActivityGroupPatchCall<'a, C>
50997    where
50998        T: AsRef<str>,
50999    {
51000        self._additional_params
51001            .insert(name.as_ref().to_string(), value.as_ref().to_string());
51002        self
51003    }
51004
51005    /// Identifies the authorization scope for the method you are building.
51006    ///
51007    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
51008    /// [`Scope::Dfatrafficking`].
51009    ///
51010    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
51011    /// tokens for more than one scope.
51012    ///
51013    /// Usually there is more than one suitable scope to authorize an operation, some of which may
51014    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
51015    /// sufficient, a read-write scope will do as well.
51016    pub fn add_scope<St>(mut self, scope: St) -> FloodlightActivityGroupPatchCall<'a, C>
51017    where
51018        St: AsRef<str>,
51019    {
51020        self._scopes.insert(String::from(scope.as_ref()));
51021        self
51022    }
51023    /// Identifies the authorization scope(s) for the method you are building.
51024    ///
51025    /// See [`Self::add_scope()`] for details.
51026    pub fn add_scopes<I, St>(mut self, scopes: I) -> FloodlightActivityGroupPatchCall<'a, C>
51027    where
51028        I: IntoIterator<Item = St>,
51029        St: AsRef<str>,
51030    {
51031        self._scopes
51032            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
51033        self
51034    }
51035
51036    /// Removes all scopes, and no default scope will be used either.
51037    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
51038    /// for details).
51039    pub fn clear_scopes(mut self) -> FloodlightActivityGroupPatchCall<'a, C> {
51040        self._scopes.clear();
51041        self
51042    }
51043}
51044
51045/// Updates an existing floodlight activity group.
51046///
51047/// A builder for the *update* method supported by a *floodlightActivityGroup* resource.
51048/// It is not used directly, but through a [`FloodlightActivityGroupMethods`] instance.
51049///
51050/// # Example
51051///
51052/// Instantiate a resource method builder
51053///
51054/// ```test_harness,no_run
51055/// # extern crate hyper;
51056/// # extern crate hyper_rustls;
51057/// # extern crate google_dfareporting3d3 as dfareporting3d3;
51058/// use dfareporting3d3::api::FloodlightActivityGroup;
51059/// # async fn dox() {
51060/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
51061///
51062/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
51063/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
51064/// #     secret,
51065/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
51066/// # ).build().await.unwrap();
51067///
51068/// # let client = hyper_util::client::legacy::Client::builder(
51069/// #     hyper_util::rt::TokioExecutor::new()
51070/// # )
51071/// # .build(
51072/// #     hyper_rustls::HttpsConnectorBuilder::new()
51073/// #         .with_native_roots()
51074/// #         .unwrap()
51075/// #         .https_or_http()
51076/// #         .enable_http1()
51077/// #         .build()
51078/// # );
51079/// # let mut hub = Dfareporting::new(client, auth);
51080/// // As the method needs a request, you would usually fill it with the desired information
51081/// // into the respective structure. Some of the parts shown here might not be applicable !
51082/// // Values shown here are possibly random and not representative !
51083/// let mut req = FloodlightActivityGroup::default();
51084///
51085/// // You can configure optional parameters by calling the respective setters at will, and
51086/// // execute the final call using `doit()`.
51087/// // Values shown here are possibly random and not representative !
51088/// let result = hub.floodlight_activity_groups().update(req, -91)
51089///              .doit().await;
51090/// # }
51091/// ```
51092pub struct FloodlightActivityGroupUpdateCall<'a, C>
51093where
51094    C: 'a,
51095{
51096    hub: &'a Dfareporting<C>,
51097    _request: FloodlightActivityGroup,
51098    _profile_id: i64,
51099    _delegate: Option<&'a mut dyn common::Delegate>,
51100    _additional_params: HashMap<String, String>,
51101    _scopes: BTreeSet<String>,
51102}
51103
51104impl<'a, C> common::CallBuilder for FloodlightActivityGroupUpdateCall<'a, C> {}
51105
51106impl<'a, C> FloodlightActivityGroupUpdateCall<'a, C>
51107where
51108    C: common::Connector,
51109{
51110    /// Perform the operation you have build so far.
51111    pub async fn doit(mut self) -> common::Result<(common::Response, FloodlightActivityGroup)> {
51112        use std::borrow::Cow;
51113        use std::io::{Read, Seek};
51114
51115        use common::{url::Params, ToParts};
51116        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
51117
51118        let mut dd = common::DefaultDelegate;
51119        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
51120        dlg.begin(common::MethodInfo {
51121            id: "dfareporting.floodlightActivityGroups.update",
51122            http_method: hyper::Method::PUT,
51123        });
51124
51125        for &field in ["alt", "profileId"].iter() {
51126            if self._additional_params.contains_key(field) {
51127                dlg.finished(false);
51128                return Err(common::Error::FieldClash(field));
51129            }
51130        }
51131
51132        let mut params = Params::with_capacity(4 + self._additional_params.len());
51133        params.push("profileId", self._profile_id.to_string());
51134
51135        params.extend(self._additional_params.iter());
51136
51137        params.push("alt", "json");
51138        let mut url =
51139            self.hub._base_url.clone() + "userprofiles/{profileId}/floodlightActivityGroups";
51140        if self._scopes.is_empty() {
51141            self._scopes
51142                .insert(Scope::Dfatrafficking.as_ref().to_string());
51143        }
51144
51145        #[allow(clippy::single_element_loop)]
51146        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
51147            url = params.uri_replacement(url, param_name, find_this, false);
51148        }
51149        {
51150            let to_remove = ["profileId"];
51151            params.remove_params(&to_remove);
51152        }
51153
51154        let url = params.parse_with_url(&url);
51155
51156        let mut json_mime_type = mime::APPLICATION_JSON;
51157        let mut request_value_reader = {
51158            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
51159            common::remove_json_null_values(&mut value);
51160            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
51161            serde_json::to_writer(&mut dst, &value).unwrap();
51162            dst
51163        };
51164        let request_size = request_value_reader
51165            .seek(std::io::SeekFrom::End(0))
51166            .unwrap();
51167        request_value_reader
51168            .seek(std::io::SeekFrom::Start(0))
51169            .unwrap();
51170
51171        loop {
51172            let token = match self
51173                .hub
51174                .auth
51175                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
51176                .await
51177            {
51178                Ok(token) => token,
51179                Err(e) => match dlg.token(e) {
51180                    Ok(token) => token,
51181                    Err(e) => {
51182                        dlg.finished(false);
51183                        return Err(common::Error::MissingToken(e));
51184                    }
51185                },
51186            };
51187            request_value_reader
51188                .seek(std::io::SeekFrom::Start(0))
51189                .unwrap();
51190            let mut req_result = {
51191                let client = &self.hub.client;
51192                dlg.pre_request();
51193                let mut req_builder = hyper::Request::builder()
51194                    .method(hyper::Method::PUT)
51195                    .uri(url.as_str())
51196                    .header(USER_AGENT, self.hub._user_agent.clone());
51197
51198                if let Some(token) = token.as_ref() {
51199                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
51200                }
51201
51202                let request = req_builder
51203                    .header(CONTENT_TYPE, json_mime_type.to_string())
51204                    .header(CONTENT_LENGTH, request_size as u64)
51205                    .body(common::to_body(
51206                        request_value_reader.get_ref().clone().into(),
51207                    ));
51208
51209                client.request(request.unwrap()).await
51210            };
51211
51212            match req_result {
51213                Err(err) => {
51214                    if let common::Retry::After(d) = dlg.http_error(&err) {
51215                        sleep(d).await;
51216                        continue;
51217                    }
51218                    dlg.finished(false);
51219                    return Err(common::Error::HttpError(err));
51220                }
51221                Ok(res) => {
51222                    let (mut parts, body) = res.into_parts();
51223                    let mut body = common::Body::new(body);
51224                    if !parts.status.is_success() {
51225                        let bytes = common::to_bytes(body).await.unwrap_or_default();
51226                        let error = serde_json::from_str(&common::to_string(&bytes));
51227                        let response = common::to_response(parts, bytes.into());
51228
51229                        if let common::Retry::After(d) =
51230                            dlg.http_failure(&response, error.as_ref().ok())
51231                        {
51232                            sleep(d).await;
51233                            continue;
51234                        }
51235
51236                        dlg.finished(false);
51237
51238                        return Err(match error {
51239                            Ok(value) => common::Error::BadRequest(value),
51240                            _ => common::Error::Failure(response),
51241                        });
51242                    }
51243                    let response = {
51244                        let bytes = common::to_bytes(body).await.unwrap_or_default();
51245                        let encoded = common::to_string(&bytes);
51246                        match serde_json::from_str(&encoded) {
51247                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
51248                            Err(error) => {
51249                                dlg.response_json_decode_error(&encoded, &error);
51250                                return Err(common::Error::JsonDecodeError(
51251                                    encoded.to_string(),
51252                                    error,
51253                                ));
51254                            }
51255                        }
51256                    };
51257
51258                    dlg.finished(true);
51259                    return Ok(response);
51260                }
51261            }
51262        }
51263    }
51264
51265    ///
51266    /// Sets the *request* property to the given value.
51267    ///
51268    /// Even though the property as already been set when instantiating this call,
51269    /// we provide this method for API completeness.
51270    pub fn request(
51271        mut self,
51272        new_value: FloodlightActivityGroup,
51273    ) -> FloodlightActivityGroupUpdateCall<'a, C> {
51274        self._request = new_value;
51275        self
51276    }
51277    /// User profile ID associated with this request.
51278    ///
51279    /// Sets the *profile id* path property to the given value.
51280    ///
51281    /// Even though the property as already been set when instantiating this call,
51282    /// we provide this method for API completeness.
51283    pub fn profile_id(mut self, new_value: i64) -> FloodlightActivityGroupUpdateCall<'a, C> {
51284        self._profile_id = new_value;
51285        self
51286    }
51287    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
51288    /// while executing the actual API request.
51289    ///
51290    /// ````text
51291    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
51292    /// ````
51293    ///
51294    /// Sets the *delegate* property to the given value.
51295    pub fn delegate(
51296        mut self,
51297        new_value: &'a mut dyn common::Delegate,
51298    ) -> FloodlightActivityGroupUpdateCall<'a, C> {
51299        self._delegate = Some(new_value);
51300        self
51301    }
51302
51303    /// Set any additional parameter of the query string used in the request.
51304    /// It should be used to set parameters which are not yet available through their own
51305    /// setters.
51306    ///
51307    /// Please note that this method must not be used to set any of the known parameters
51308    /// which have their own setter method. If done anyway, the request will fail.
51309    ///
51310    /// # Additional Parameters
51311    ///
51312    /// * *$.xgafv* (query-string) - V1 error format.
51313    /// * *access_token* (query-string) - OAuth access token.
51314    /// * *alt* (query-string) - Data format for response.
51315    /// * *callback* (query-string) - JSONP
51316    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
51317    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
51318    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
51319    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
51320    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
51321    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
51322    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
51323    pub fn param<T>(mut self, name: T, value: T) -> FloodlightActivityGroupUpdateCall<'a, C>
51324    where
51325        T: AsRef<str>,
51326    {
51327        self._additional_params
51328            .insert(name.as_ref().to_string(), value.as_ref().to_string());
51329        self
51330    }
51331
51332    /// Identifies the authorization scope for the method you are building.
51333    ///
51334    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
51335    /// [`Scope::Dfatrafficking`].
51336    ///
51337    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
51338    /// tokens for more than one scope.
51339    ///
51340    /// Usually there is more than one suitable scope to authorize an operation, some of which may
51341    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
51342    /// sufficient, a read-write scope will do as well.
51343    pub fn add_scope<St>(mut self, scope: St) -> FloodlightActivityGroupUpdateCall<'a, C>
51344    where
51345        St: AsRef<str>,
51346    {
51347        self._scopes.insert(String::from(scope.as_ref()));
51348        self
51349    }
51350    /// Identifies the authorization scope(s) for the method you are building.
51351    ///
51352    /// See [`Self::add_scope()`] for details.
51353    pub fn add_scopes<I, St>(mut self, scopes: I) -> FloodlightActivityGroupUpdateCall<'a, C>
51354    where
51355        I: IntoIterator<Item = St>,
51356        St: AsRef<str>,
51357    {
51358        self._scopes
51359            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
51360        self
51361    }
51362
51363    /// Removes all scopes, and no default scope will be used either.
51364    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
51365    /// for details).
51366    pub fn clear_scopes(mut self) -> FloodlightActivityGroupUpdateCall<'a, C> {
51367        self._scopes.clear();
51368        self
51369    }
51370}
51371
51372/// Gets one floodlight configuration by ID.
51373///
51374/// A builder for the *get* method supported by a *floodlightConfiguration* resource.
51375/// It is not used directly, but through a [`FloodlightConfigurationMethods`] instance.
51376///
51377/// # Example
51378///
51379/// Instantiate a resource method builder
51380///
51381/// ```test_harness,no_run
51382/// # extern crate hyper;
51383/// # extern crate hyper_rustls;
51384/// # extern crate google_dfareporting3d3 as dfareporting3d3;
51385/// # async fn dox() {
51386/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
51387///
51388/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
51389/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
51390/// #     secret,
51391/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
51392/// # ).build().await.unwrap();
51393///
51394/// # let client = hyper_util::client::legacy::Client::builder(
51395/// #     hyper_util::rt::TokioExecutor::new()
51396/// # )
51397/// # .build(
51398/// #     hyper_rustls::HttpsConnectorBuilder::new()
51399/// #         .with_native_roots()
51400/// #         .unwrap()
51401/// #         .https_or_http()
51402/// #         .enable_http1()
51403/// #         .build()
51404/// # );
51405/// # let mut hub = Dfareporting::new(client, auth);
51406/// // You can configure optional parameters by calling the respective setters at will, and
51407/// // execute the final call using `doit()`.
51408/// // Values shown here are possibly random and not representative !
51409/// let result = hub.floodlight_configurations().get(-73, -37)
51410///              .doit().await;
51411/// # }
51412/// ```
51413pub struct FloodlightConfigurationGetCall<'a, C>
51414where
51415    C: 'a,
51416{
51417    hub: &'a Dfareporting<C>,
51418    _profile_id: i64,
51419    _id: i64,
51420    _delegate: Option<&'a mut dyn common::Delegate>,
51421    _additional_params: HashMap<String, String>,
51422    _scopes: BTreeSet<String>,
51423}
51424
51425impl<'a, C> common::CallBuilder for FloodlightConfigurationGetCall<'a, C> {}
51426
51427impl<'a, C> FloodlightConfigurationGetCall<'a, C>
51428where
51429    C: common::Connector,
51430{
51431    /// Perform the operation you have build so far.
51432    pub async fn doit(mut self) -> common::Result<(common::Response, FloodlightConfiguration)> {
51433        use std::borrow::Cow;
51434        use std::io::{Read, Seek};
51435
51436        use common::{url::Params, ToParts};
51437        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
51438
51439        let mut dd = common::DefaultDelegate;
51440        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
51441        dlg.begin(common::MethodInfo {
51442            id: "dfareporting.floodlightConfigurations.get",
51443            http_method: hyper::Method::GET,
51444        });
51445
51446        for &field in ["alt", "profileId", "id"].iter() {
51447            if self._additional_params.contains_key(field) {
51448                dlg.finished(false);
51449                return Err(common::Error::FieldClash(field));
51450            }
51451        }
51452
51453        let mut params = Params::with_capacity(4 + self._additional_params.len());
51454        params.push("profileId", self._profile_id.to_string());
51455        params.push("id", self._id.to_string());
51456
51457        params.extend(self._additional_params.iter());
51458
51459        params.push("alt", "json");
51460        let mut url =
51461            self.hub._base_url.clone() + "userprofiles/{profileId}/floodlightConfigurations/{id}";
51462        if self._scopes.is_empty() {
51463            self._scopes
51464                .insert(Scope::Dfatrafficking.as_ref().to_string());
51465        }
51466
51467        #[allow(clippy::single_element_loop)]
51468        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
51469            url = params.uri_replacement(url, param_name, find_this, false);
51470        }
51471        {
51472            let to_remove = ["id", "profileId"];
51473            params.remove_params(&to_remove);
51474        }
51475
51476        let url = params.parse_with_url(&url);
51477
51478        loop {
51479            let token = match self
51480                .hub
51481                .auth
51482                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
51483                .await
51484            {
51485                Ok(token) => token,
51486                Err(e) => match dlg.token(e) {
51487                    Ok(token) => token,
51488                    Err(e) => {
51489                        dlg.finished(false);
51490                        return Err(common::Error::MissingToken(e));
51491                    }
51492                },
51493            };
51494            let mut req_result = {
51495                let client = &self.hub.client;
51496                dlg.pre_request();
51497                let mut req_builder = hyper::Request::builder()
51498                    .method(hyper::Method::GET)
51499                    .uri(url.as_str())
51500                    .header(USER_AGENT, self.hub._user_agent.clone());
51501
51502                if let Some(token) = token.as_ref() {
51503                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
51504                }
51505
51506                let request = req_builder
51507                    .header(CONTENT_LENGTH, 0_u64)
51508                    .body(common::to_body::<String>(None));
51509
51510                client.request(request.unwrap()).await
51511            };
51512
51513            match req_result {
51514                Err(err) => {
51515                    if let common::Retry::After(d) = dlg.http_error(&err) {
51516                        sleep(d).await;
51517                        continue;
51518                    }
51519                    dlg.finished(false);
51520                    return Err(common::Error::HttpError(err));
51521                }
51522                Ok(res) => {
51523                    let (mut parts, body) = res.into_parts();
51524                    let mut body = common::Body::new(body);
51525                    if !parts.status.is_success() {
51526                        let bytes = common::to_bytes(body).await.unwrap_or_default();
51527                        let error = serde_json::from_str(&common::to_string(&bytes));
51528                        let response = common::to_response(parts, bytes.into());
51529
51530                        if let common::Retry::After(d) =
51531                            dlg.http_failure(&response, error.as_ref().ok())
51532                        {
51533                            sleep(d).await;
51534                            continue;
51535                        }
51536
51537                        dlg.finished(false);
51538
51539                        return Err(match error {
51540                            Ok(value) => common::Error::BadRequest(value),
51541                            _ => common::Error::Failure(response),
51542                        });
51543                    }
51544                    let response = {
51545                        let bytes = common::to_bytes(body).await.unwrap_or_default();
51546                        let encoded = common::to_string(&bytes);
51547                        match serde_json::from_str(&encoded) {
51548                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
51549                            Err(error) => {
51550                                dlg.response_json_decode_error(&encoded, &error);
51551                                return Err(common::Error::JsonDecodeError(
51552                                    encoded.to_string(),
51553                                    error,
51554                                ));
51555                            }
51556                        }
51557                    };
51558
51559                    dlg.finished(true);
51560                    return Ok(response);
51561                }
51562            }
51563        }
51564    }
51565
51566    /// User profile ID associated with this request.
51567    ///
51568    /// Sets the *profile id* path property to the given value.
51569    ///
51570    /// Even though the property as already been set when instantiating this call,
51571    /// we provide this method for API completeness.
51572    pub fn profile_id(mut self, new_value: i64) -> FloodlightConfigurationGetCall<'a, C> {
51573        self._profile_id = new_value;
51574        self
51575    }
51576    /// Floodlight configuration ID.
51577    ///
51578    /// Sets the *id* path property to the given value.
51579    ///
51580    /// Even though the property as already been set when instantiating this call,
51581    /// we provide this method for API completeness.
51582    pub fn id(mut self, new_value: i64) -> FloodlightConfigurationGetCall<'a, C> {
51583        self._id = new_value;
51584        self
51585    }
51586    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
51587    /// while executing the actual API request.
51588    ///
51589    /// ````text
51590    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
51591    /// ````
51592    ///
51593    /// Sets the *delegate* property to the given value.
51594    pub fn delegate(
51595        mut self,
51596        new_value: &'a mut dyn common::Delegate,
51597    ) -> FloodlightConfigurationGetCall<'a, C> {
51598        self._delegate = Some(new_value);
51599        self
51600    }
51601
51602    /// Set any additional parameter of the query string used in the request.
51603    /// It should be used to set parameters which are not yet available through their own
51604    /// setters.
51605    ///
51606    /// Please note that this method must not be used to set any of the known parameters
51607    /// which have their own setter method. If done anyway, the request will fail.
51608    ///
51609    /// # Additional Parameters
51610    ///
51611    /// * *$.xgafv* (query-string) - V1 error format.
51612    /// * *access_token* (query-string) - OAuth access token.
51613    /// * *alt* (query-string) - Data format for response.
51614    /// * *callback* (query-string) - JSONP
51615    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
51616    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
51617    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
51618    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
51619    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
51620    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
51621    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
51622    pub fn param<T>(mut self, name: T, value: T) -> FloodlightConfigurationGetCall<'a, C>
51623    where
51624        T: AsRef<str>,
51625    {
51626        self._additional_params
51627            .insert(name.as_ref().to_string(), value.as_ref().to_string());
51628        self
51629    }
51630
51631    /// Identifies the authorization scope for the method you are building.
51632    ///
51633    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
51634    /// [`Scope::Dfatrafficking`].
51635    ///
51636    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
51637    /// tokens for more than one scope.
51638    ///
51639    /// Usually there is more than one suitable scope to authorize an operation, some of which may
51640    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
51641    /// sufficient, a read-write scope will do as well.
51642    pub fn add_scope<St>(mut self, scope: St) -> FloodlightConfigurationGetCall<'a, C>
51643    where
51644        St: AsRef<str>,
51645    {
51646        self._scopes.insert(String::from(scope.as_ref()));
51647        self
51648    }
51649    /// Identifies the authorization scope(s) for the method you are building.
51650    ///
51651    /// See [`Self::add_scope()`] for details.
51652    pub fn add_scopes<I, St>(mut self, scopes: I) -> FloodlightConfigurationGetCall<'a, C>
51653    where
51654        I: IntoIterator<Item = St>,
51655        St: AsRef<str>,
51656    {
51657        self._scopes
51658            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
51659        self
51660    }
51661
51662    /// Removes all scopes, and no default scope will be used either.
51663    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
51664    /// for details).
51665    pub fn clear_scopes(mut self) -> FloodlightConfigurationGetCall<'a, C> {
51666        self._scopes.clear();
51667        self
51668    }
51669}
51670
51671/// Retrieves a list of floodlight configurations, possibly filtered.
51672///
51673/// A builder for the *list* method supported by a *floodlightConfiguration* resource.
51674/// It is not used directly, but through a [`FloodlightConfigurationMethods`] instance.
51675///
51676/// # Example
51677///
51678/// Instantiate a resource method builder
51679///
51680/// ```test_harness,no_run
51681/// # extern crate hyper;
51682/// # extern crate hyper_rustls;
51683/// # extern crate google_dfareporting3d3 as dfareporting3d3;
51684/// # async fn dox() {
51685/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
51686///
51687/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
51688/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
51689/// #     secret,
51690/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
51691/// # ).build().await.unwrap();
51692///
51693/// # let client = hyper_util::client::legacy::Client::builder(
51694/// #     hyper_util::rt::TokioExecutor::new()
51695/// # )
51696/// # .build(
51697/// #     hyper_rustls::HttpsConnectorBuilder::new()
51698/// #         .with_native_roots()
51699/// #         .unwrap()
51700/// #         .https_or_http()
51701/// #         .enable_http1()
51702/// #         .build()
51703/// # );
51704/// # let mut hub = Dfareporting::new(client, auth);
51705/// // You can configure optional parameters by calling the respective setters at will, and
51706/// // execute the final call using `doit()`.
51707/// // Values shown here are possibly random and not representative !
51708/// let result = hub.floodlight_configurations().list(-78)
51709///              .add_ids(-46)
51710///              .doit().await;
51711/// # }
51712/// ```
51713pub struct FloodlightConfigurationListCall<'a, C>
51714where
51715    C: 'a,
51716{
51717    hub: &'a Dfareporting<C>,
51718    _profile_id: i64,
51719    _ids: Vec<i64>,
51720    _delegate: Option<&'a mut dyn common::Delegate>,
51721    _additional_params: HashMap<String, String>,
51722    _scopes: BTreeSet<String>,
51723}
51724
51725impl<'a, C> common::CallBuilder for FloodlightConfigurationListCall<'a, C> {}
51726
51727impl<'a, C> FloodlightConfigurationListCall<'a, C>
51728where
51729    C: common::Connector,
51730{
51731    /// Perform the operation you have build so far.
51732    pub async fn doit(
51733        mut self,
51734    ) -> common::Result<(common::Response, FloodlightConfigurationsListResponse)> {
51735        use std::borrow::Cow;
51736        use std::io::{Read, Seek};
51737
51738        use common::{url::Params, ToParts};
51739        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
51740
51741        let mut dd = common::DefaultDelegate;
51742        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
51743        dlg.begin(common::MethodInfo {
51744            id: "dfareporting.floodlightConfigurations.list",
51745            http_method: hyper::Method::GET,
51746        });
51747
51748        for &field in ["alt", "profileId", "ids"].iter() {
51749            if self._additional_params.contains_key(field) {
51750                dlg.finished(false);
51751                return Err(common::Error::FieldClash(field));
51752            }
51753        }
51754
51755        let mut params = Params::with_capacity(4 + self._additional_params.len());
51756        params.push("profileId", self._profile_id.to_string());
51757        if !self._ids.is_empty() {
51758            for f in self._ids.iter() {
51759                params.push("ids", f.to_string());
51760            }
51761        }
51762
51763        params.extend(self._additional_params.iter());
51764
51765        params.push("alt", "json");
51766        let mut url =
51767            self.hub._base_url.clone() + "userprofiles/{profileId}/floodlightConfigurations";
51768        if self._scopes.is_empty() {
51769            self._scopes
51770                .insert(Scope::Dfatrafficking.as_ref().to_string());
51771        }
51772
51773        #[allow(clippy::single_element_loop)]
51774        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
51775            url = params.uri_replacement(url, param_name, find_this, false);
51776        }
51777        {
51778            let to_remove = ["profileId"];
51779            params.remove_params(&to_remove);
51780        }
51781
51782        let url = params.parse_with_url(&url);
51783
51784        loop {
51785            let token = match self
51786                .hub
51787                .auth
51788                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
51789                .await
51790            {
51791                Ok(token) => token,
51792                Err(e) => match dlg.token(e) {
51793                    Ok(token) => token,
51794                    Err(e) => {
51795                        dlg.finished(false);
51796                        return Err(common::Error::MissingToken(e));
51797                    }
51798                },
51799            };
51800            let mut req_result = {
51801                let client = &self.hub.client;
51802                dlg.pre_request();
51803                let mut req_builder = hyper::Request::builder()
51804                    .method(hyper::Method::GET)
51805                    .uri(url.as_str())
51806                    .header(USER_AGENT, self.hub._user_agent.clone());
51807
51808                if let Some(token) = token.as_ref() {
51809                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
51810                }
51811
51812                let request = req_builder
51813                    .header(CONTENT_LENGTH, 0_u64)
51814                    .body(common::to_body::<String>(None));
51815
51816                client.request(request.unwrap()).await
51817            };
51818
51819            match req_result {
51820                Err(err) => {
51821                    if let common::Retry::After(d) = dlg.http_error(&err) {
51822                        sleep(d).await;
51823                        continue;
51824                    }
51825                    dlg.finished(false);
51826                    return Err(common::Error::HttpError(err));
51827                }
51828                Ok(res) => {
51829                    let (mut parts, body) = res.into_parts();
51830                    let mut body = common::Body::new(body);
51831                    if !parts.status.is_success() {
51832                        let bytes = common::to_bytes(body).await.unwrap_or_default();
51833                        let error = serde_json::from_str(&common::to_string(&bytes));
51834                        let response = common::to_response(parts, bytes.into());
51835
51836                        if let common::Retry::After(d) =
51837                            dlg.http_failure(&response, error.as_ref().ok())
51838                        {
51839                            sleep(d).await;
51840                            continue;
51841                        }
51842
51843                        dlg.finished(false);
51844
51845                        return Err(match error {
51846                            Ok(value) => common::Error::BadRequest(value),
51847                            _ => common::Error::Failure(response),
51848                        });
51849                    }
51850                    let response = {
51851                        let bytes = common::to_bytes(body).await.unwrap_or_default();
51852                        let encoded = common::to_string(&bytes);
51853                        match serde_json::from_str(&encoded) {
51854                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
51855                            Err(error) => {
51856                                dlg.response_json_decode_error(&encoded, &error);
51857                                return Err(common::Error::JsonDecodeError(
51858                                    encoded.to_string(),
51859                                    error,
51860                                ));
51861                            }
51862                        }
51863                    };
51864
51865                    dlg.finished(true);
51866                    return Ok(response);
51867                }
51868            }
51869        }
51870    }
51871
51872    /// User profile ID associated with this request.
51873    ///
51874    /// Sets the *profile id* path property to the given value.
51875    ///
51876    /// Even though the property as already been set when instantiating this call,
51877    /// we provide this method for API completeness.
51878    pub fn profile_id(mut self, new_value: i64) -> FloodlightConfigurationListCall<'a, C> {
51879        self._profile_id = new_value;
51880        self
51881    }
51882    /// Set of IDs of floodlight configurations to retrieve. Required field; otherwise an empty list will be returned.
51883    ///
51884    /// Append the given value to the *ids* query property.
51885    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
51886    pub fn add_ids(mut self, new_value: i64) -> FloodlightConfigurationListCall<'a, C> {
51887        self._ids.push(new_value);
51888        self
51889    }
51890    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
51891    /// while executing the actual API request.
51892    ///
51893    /// ````text
51894    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
51895    /// ````
51896    ///
51897    /// Sets the *delegate* property to the given value.
51898    pub fn delegate(
51899        mut self,
51900        new_value: &'a mut dyn common::Delegate,
51901    ) -> FloodlightConfigurationListCall<'a, C> {
51902        self._delegate = Some(new_value);
51903        self
51904    }
51905
51906    /// Set any additional parameter of the query string used in the request.
51907    /// It should be used to set parameters which are not yet available through their own
51908    /// setters.
51909    ///
51910    /// Please note that this method must not be used to set any of the known parameters
51911    /// which have their own setter method. If done anyway, the request will fail.
51912    ///
51913    /// # Additional Parameters
51914    ///
51915    /// * *$.xgafv* (query-string) - V1 error format.
51916    /// * *access_token* (query-string) - OAuth access token.
51917    /// * *alt* (query-string) - Data format for response.
51918    /// * *callback* (query-string) - JSONP
51919    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
51920    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
51921    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
51922    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
51923    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
51924    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
51925    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
51926    pub fn param<T>(mut self, name: T, value: T) -> FloodlightConfigurationListCall<'a, C>
51927    where
51928        T: AsRef<str>,
51929    {
51930        self._additional_params
51931            .insert(name.as_ref().to_string(), value.as_ref().to_string());
51932        self
51933    }
51934
51935    /// Identifies the authorization scope for the method you are building.
51936    ///
51937    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
51938    /// [`Scope::Dfatrafficking`].
51939    ///
51940    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
51941    /// tokens for more than one scope.
51942    ///
51943    /// Usually there is more than one suitable scope to authorize an operation, some of which may
51944    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
51945    /// sufficient, a read-write scope will do as well.
51946    pub fn add_scope<St>(mut self, scope: St) -> FloodlightConfigurationListCall<'a, C>
51947    where
51948        St: AsRef<str>,
51949    {
51950        self._scopes.insert(String::from(scope.as_ref()));
51951        self
51952    }
51953    /// Identifies the authorization scope(s) for the method you are building.
51954    ///
51955    /// See [`Self::add_scope()`] for details.
51956    pub fn add_scopes<I, St>(mut self, scopes: I) -> FloodlightConfigurationListCall<'a, C>
51957    where
51958        I: IntoIterator<Item = St>,
51959        St: AsRef<str>,
51960    {
51961        self._scopes
51962            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
51963        self
51964    }
51965
51966    /// Removes all scopes, and no default scope will be used either.
51967    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
51968    /// for details).
51969    pub fn clear_scopes(mut self) -> FloodlightConfigurationListCall<'a, C> {
51970        self._scopes.clear();
51971        self
51972    }
51973}
51974
51975/// Updates an existing floodlight configuration. This method supports patch semantics.
51976///
51977/// A builder for the *patch* method supported by a *floodlightConfiguration* resource.
51978/// It is not used directly, but through a [`FloodlightConfigurationMethods`] instance.
51979///
51980/// # Example
51981///
51982/// Instantiate a resource method builder
51983///
51984/// ```test_harness,no_run
51985/// # extern crate hyper;
51986/// # extern crate hyper_rustls;
51987/// # extern crate google_dfareporting3d3 as dfareporting3d3;
51988/// use dfareporting3d3::api::FloodlightConfiguration;
51989/// # async fn dox() {
51990/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
51991///
51992/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
51993/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
51994/// #     secret,
51995/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
51996/// # ).build().await.unwrap();
51997///
51998/// # let client = hyper_util::client::legacy::Client::builder(
51999/// #     hyper_util::rt::TokioExecutor::new()
52000/// # )
52001/// # .build(
52002/// #     hyper_rustls::HttpsConnectorBuilder::new()
52003/// #         .with_native_roots()
52004/// #         .unwrap()
52005/// #         .https_or_http()
52006/// #         .enable_http1()
52007/// #         .build()
52008/// # );
52009/// # let mut hub = Dfareporting::new(client, auth);
52010/// // As the method needs a request, you would usually fill it with the desired information
52011/// // into the respective structure. Some of the parts shown here might not be applicable !
52012/// // Values shown here are possibly random and not representative !
52013/// let mut req = FloodlightConfiguration::default();
52014///
52015/// // You can configure optional parameters by calling the respective setters at will, and
52016/// // execute the final call using `doit()`.
52017/// // Values shown here are possibly random and not representative !
52018/// let result = hub.floodlight_configurations().patch(req, -99, -47)
52019///              .doit().await;
52020/// # }
52021/// ```
52022pub struct FloodlightConfigurationPatchCall<'a, C>
52023where
52024    C: 'a,
52025{
52026    hub: &'a Dfareporting<C>,
52027    _request: FloodlightConfiguration,
52028    _profile_id: i64,
52029    _id: i64,
52030    _delegate: Option<&'a mut dyn common::Delegate>,
52031    _additional_params: HashMap<String, String>,
52032    _scopes: BTreeSet<String>,
52033}
52034
52035impl<'a, C> common::CallBuilder for FloodlightConfigurationPatchCall<'a, C> {}
52036
52037impl<'a, C> FloodlightConfigurationPatchCall<'a, C>
52038where
52039    C: common::Connector,
52040{
52041    /// Perform the operation you have build so far.
52042    pub async fn doit(mut self) -> common::Result<(common::Response, FloodlightConfiguration)> {
52043        use std::borrow::Cow;
52044        use std::io::{Read, Seek};
52045
52046        use common::{url::Params, ToParts};
52047        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
52048
52049        let mut dd = common::DefaultDelegate;
52050        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
52051        dlg.begin(common::MethodInfo {
52052            id: "dfareporting.floodlightConfigurations.patch",
52053            http_method: hyper::Method::PATCH,
52054        });
52055
52056        for &field in ["alt", "profileId", "id"].iter() {
52057            if self._additional_params.contains_key(field) {
52058                dlg.finished(false);
52059                return Err(common::Error::FieldClash(field));
52060            }
52061        }
52062
52063        let mut params = Params::with_capacity(5 + self._additional_params.len());
52064        params.push("profileId", self._profile_id.to_string());
52065        params.push("id", self._id.to_string());
52066
52067        params.extend(self._additional_params.iter());
52068
52069        params.push("alt", "json");
52070        let mut url =
52071            self.hub._base_url.clone() + "userprofiles/{profileId}/floodlightConfigurations";
52072        if self._scopes.is_empty() {
52073            self._scopes
52074                .insert(Scope::Dfatrafficking.as_ref().to_string());
52075        }
52076
52077        #[allow(clippy::single_element_loop)]
52078        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
52079            url = params.uri_replacement(url, param_name, find_this, false);
52080        }
52081        {
52082            let to_remove = ["profileId"];
52083            params.remove_params(&to_remove);
52084        }
52085
52086        let url = params.parse_with_url(&url);
52087
52088        let mut json_mime_type = mime::APPLICATION_JSON;
52089        let mut request_value_reader = {
52090            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
52091            common::remove_json_null_values(&mut value);
52092            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
52093            serde_json::to_writer(&mut dst, &value).unwrap();
52094            dst
52095        };
52096        let request_size = request_value_reader
52097            .seek(std::io::SeekFrom::End(0))
52098            .unwrap();
52099        request_value_reader
52100            .seek(std::io::SeekFrom::Start(0))
52101            .unwrap();
52102
52103        loop {
52104            let token = match self
52105                .hub
52106                .auth
52107                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
52108                .await
52109            {
52110                Ok(token) => token,
52111                Err(e) => match dlg.token(e) {
52112                    Ok(token) => token,
52113                    Err(e) => {
52114                        dlg.finished(false);
52115                        return Err(common::Error::MissingToken(e));
52116                    }
52117                },
52118            };
52119            request_value_reader
52120                .seek(std::io::SeekFrom::Start(0))
52121                .unwrap();
52122            let mut req_result = {
52123                let client = &self.hub.client;
52124                dlg.pre_request();
52125                let mut req_builder = hyper::Request::builder()
52126                    .method(hyper::Method::PATCH)
52127                    .uri(url.as_str())
52128                    .header(USER_AGENT, self.hub._user_agent.clone());
52129
52130                if let Some(token) = token.as_ref() {
52131                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
52132                }
52133
52134                let request = req_builder
52135                    .header(CONTENT_TYPE, json_mime_type.to_string())
52136                    .header(CONTENT_LENGTH, request_size as u64)
52137                    .body(common::to_body(
52138                        request_value_reader.get_ref().clone().into(),
52139                    ));
52140
52141                client.request(request.unwrap()).await
52142            };
52143
52144            match req_result {
52145                Err(err) => {
52146                    if let common::Retry::After(d) = dlg.http_error(&err) {
52147                        sleep(d).await;
52148                        continue;
52149                    }
52150                    dlg.finished(false);
52151                    return Err(common::Error::HttpError(err));
52152                }
52153                Ok(res) => {
52154                    let (mut parts, body) = res.into_parts();
52155                    let mut body = common::Body::new(body);
52156                    if !parts.status.is_success() {
52157                        let bytes = common::to_bytes(body).await.unwrap_or_default();
52158                        let error = serde_json::from_str(&common::to_string(&bytes));
52159                        let response = common::to_response(parts, bytes.into());
52160
52161                        if let common::Retry::After(d) =
52162                            dlg.http_failure(&response, error.as_ref().ok())
52163                        {
52164                            sleep(d).await;
52165                            continue;
52166                        }
52167
52168                        dlg.finished(false);
52169
52170                        return Err(match error {
52171                            Ok(value) => common::Error::BadRequest(value),
52172                            _ => common::Error::Failure(response),
52173                        });
52174                    }
52175                    let response = {
52176                        let bytes = common::to_bytes(body).await.unwrap_or_default();
52177                        let encoded = common::to_string(&bytes);
52178                        match serde_json::from_str(&encoded) {
52179                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
52180                            Err(error) => {
52181                                dlg.response_json_decode_error(&encoded, &error);
52182                                return Err(common::Error::JsonDecodeError(
52183                                    encoded.to_string(),
52184                                    error,
52185                                ));
52186                            }
52187                        }
52188                    };
52189
52190                    dlg.finished(true);
52191                    return Ok(response);
52192                }
52193            }
52194        }
52195    }
52196
52197    ///
52198    /// Sets the *request* property to the given value.
52199    ///
52200    /// Even though the property as already been set when instantiating this call,
52201    /// we provide this method for API completeness.
52202    pub fn request(
52203        mut self,
52204        new_value: FloodlightConfiguration,
52205    ) -> FloodlightConfigurationPatchCall<'a, C> {
52206        self._request = new_value;
52207        self
52208    }
52209    /// User profile ID associated with this request.
52210    ///
52211    /// Sets the *profile id* path property to the given value.
52212    ///
52213    /// Even though the property as already been set when instantiating this call,
52214    /// we provide this method for API completeness.
52215    pub fn profile_id(mut self, new_value: i64) -> FloodlightConfigurationPatchCall<'a, C> {
52216        self._profile_id = new_value;
52217        self
52218    }
52219    /// FloodlightConfiguration ID.
52220    ///
52221    /// Sets the *id* query property to the given value.
52222    ///
52223    /// Even though the property as already been set when instantiating this call,
52224    /// we provide this method for API completeness.
52225    pub fn id(mut self, new_value: i64) -> FloodlightConfigurationPatchCall<'a, C> {
52226        self._id = new_value;
52227        self
52228    }
52229    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
52230    /// while executing the actual API request.
52231    ///
52232    /// ````text
52233    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
52234    /// ````
52235    ///
52236    /// Sets the *delegate* property to the given value.
52237    pub fn delegate(
52238        mut self,
52239        new_value: &'a mut dyn common::Delegate,
52240    ) -> FloodlightConfigurationPatchCall<'a, C> {
52241        self._delegate = Some(new_value);
52242        self
52243    }
52244
52245    /// Set any additional parameter of the query string used in the request.
52246    /// It should be used to set parameters which are not yet available through their own
52247    /// setters.
52248    ///
52249    /// Please note that this method must not be used to set any of the known parameters
52250    /// which have their own setter method. If done anyway, the request will fail.
52251    ///
52252    /// # Additional Parameters
52253    ///
52254    /// * *$.xgafv* (query-string) - V1 error format.
52255    /// * *access_token* (query-string) - OAuth access token.
52256    /// * *alt* (query-string) - Data format for response.
52257    /// * *callback* (query-string) - JSONP
52258    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
52259    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
52260    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
52261    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
52262    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
52263    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
52264    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
52265    pub fn param<T>(mut self, name: T, value: T) -> FloodlightConfigurationPatchCall<'a, C>
52266    where
52267        T: AsRef<str>,
52268    {
52269        self._additional_params
52270            .insert(name.as_ref().to_string(), value.as_ref().to_string());
52271        self
52272    }
52273
52274    /// Identifies the authorization scope for the method you are building.
52275    ///
52276    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
52277    /// [`Scope::Dfatrafficking`].
52278    ///
52279    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
52280    /// tokens for more than one scope.
52281    ///
52282    /// Usually there is more than one suitable scope to authorize an operation, some of which may
52283    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
52284    /// sufficient, a read-write scope will do as well.
52285    pub fn add_scope<St>(mut self, scope: St) -> FloodlightConfigurationPatchCall<'a, C>
52286    where
52287        St: AsRef<str>,
52288    {
52289        self._scopes.insert(String::from(scope.as_ref()));
52290        self
52291    }
52292    /// Identifies the authorization scope(s) for the method you are building.
52293    ///
52294    /// See [`Self::add_scope()`] for details.
52295    pub fn add_scopes<I, St>(mut self, scopes: I) -> FloodlightConfigurationPatchCall<'a, C>
52296    where
52297        I: IntoIterator<Item = St>,
52298        St: AsRef<str>,
52299    {
52300        self._scopes
52301            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
52302        self
52303    }
52304
52305    /// Removes all scopes, and no default scope will be used either.
52306    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
52307    /// for details).
52308    pub fn clear_scopes(mut self) -> FloodlightConfigurationPatchCall<'a, C> {
52309        self._scopes.clear();
52310        self
52311    }
52312}
52313
52314/// Updates an existing floodlight configuration.
52315///
52316/// A builder for the *update* method supported by a *floodlightConfiguration* resource.
52317/// It is not used directly, but through a [`FloodlightConfigurationMethods`] instance.
52318///
52319/// # Example
52320///
52321/// Instantiate a resource method builder
52322///
52323/// ```test_harness,no_run
52324/// # extern crate hyper;
52325/// # extern crate hyper_rustls;
52326/// # extern crate google_dfareporting3d3 as dfareporting3d3;
52327/// use dfareporting3d3::api::FloodlightConfiguration;
52328/// # async fn dox() {
52329/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
52330///
52331/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
52332/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
52333/// #     secret,
52334/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
52335/// # ).build().await.unwrap();
52336///
52337/// # let client = hyper_util::client::legacy::Client::builder(
52338/// #     hyper_util::rt::TokioExecutor::new()
52339/// # )
52340/// # .build(
52341/// #     hyper_rustls::HttpsConnectorBuilder::new()
52342/// #         .with_native_roots()
52343/// #         .unwrap()
52344/// #         .https_or_http()
52345/// #         .enable_http1()
52346/// #         .build()
52347/// # );
52348/// # let mut hub = Dfareporting::new(client, auth);
52349/// // As the method needs a request, you would usually fill it with the desired information
52350/// // into the respective structure. Some of the parts shown here might not be applicable !
52351/// // Values shown here are possibly random and not representative !
52352/// let mut req = FloodlightConfiguration::default();
52353///
52354/// // You can configure optional parameters by calling the respective setters at will, and
52355/// // execute the final call using `doit()`.
52356/// // Values shown here are possibly random and not representative !
52357/// let result = hub.floodlight_configurations().update(req, -35)
52358///              .doit().await;
52359/// # }
52360/// ```
52361pub struct FloodlightConfigurationUpdateCall<'a, C>
52362where
52363    C: 'a,
52364{
52365    hub: &'a Dfareporting<C>,
52366    _request: FloodlightConfiguration,
52367    _profile_id: i64,
52368    _delegate: Option<&'a mut dyn common::Delegate>,
52369    _additional_params: HashMap<String, String>,
52370    _scopes: BTreeSet<String>,
52371}
52372
52373impl<'a, C> common::CallBuilder for FloodlightConfigurationUpdateCall<'a, C> {}
52374
52375impl<'a, C> FloodlightConfigurationUpdateCall<'a, C>
52376where
52377    C: common::Connector,
52378{
52379    /// Perform the operation you have build so far.
52380    pub async fn doit(mut self) -> common::Result<(common::Response, FloodlightConfiguration)> {
52381        use std::borrow::Cow;
52382        use std::io::{Read, Seek};
52383
52384        use common::{url::Params, ToParts};
52385        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
52386
52387        let mut dd = common::DefaultDelegate;
52388        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
52389        dlg.begin(common::MethodInfo {
52390            id: "dfareporting.floodlightConfigurations.update",
52391            http_method: hyper::Method::PUT,
52392        });
52393
52394        for &field in ["alt", "profileId"].iter() {
52395            if self._additional_params.contains_key(field) {
52396                dlg.finished(false);
52397                return Err(common::Error::FieldClash(field));
52398            }
52399        }
52400
52401        let mut params = Params::with_capacity(4 + self._additional_params.len());
52402        params.push("profileId", self._profile_id.to_string());
52403
52404        params.extend(self._additional_params.iter());
52405
52406        params.push("alt", "json");
52407        let mut url =
52408            self.hub._base_url.clone() + "userprofiles/{profileId}/floodlightConfigurations";
52409        if self._scopes.is_empty() {
52410            self._scopes
52411                .insert(Scope::Dfatrafficking.as_ref().to_string());
52412        }
52413
52414        #[allow(clippy::single_element_loop)]
52415        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
52416            url = params.uri_replacement(url, param_name, find_this, false);
52417        }
52418        {
52419            let to_remove = ["profileId"];
52420            params.remove_params(&to_remove);
52421        }
52422
52423        let url = params.parse_with_url(&url);
52424
52425        let mut json_mime_type = mime::APPLICATION_JSON;
52426        let mut request_value_reader = {
52427            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
52428            common::remove_json_null_values(&mut value);
52429            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
52430            serde_json::to_writer(&mut dst, &value).unwrap();
52431            dst
52432        };
52433        let request_size = request_value_reader
52434            .seek(std::io::SeekFrom::End(0))
52435            .unwrap();
52436        request_value_reader
52437            .seek(std::io::SeekFrom::Start(0))
52438            .unwrap();
52439
52440        loop {
52441            let token = match self
52442                .hub
52443                .auth
52444                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
52445                .await
52446            {
52447                Ok(token) => token,
52448                Err(e) => match dlg.token(e) {
52449                    Ok(token) => token,
52450                    Err(e) => {
52451                        dlg.finished(false);
52452                        return Err(common::Error::MissingToken(e));
52453                    }
52454                },
52455            };
52456            request_value_reader
52457                .seek(std::io::SeekFrom::Start(0))
52458                .unwrap();
52459            let mut req_result = {
52460                let client = &self.hub.client;
52461                dlg.pre_request();
52462                let mut req_builder = hyper::Request::builder()
52463                    .method(hyper::Method::PUT)
52464                    .uri(url.as_str())
52465                    .header(USER_AGENT, self.hub._user_agent.clone());
52466
52467                if let Some(token) = token.as_ref() {
52468                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
52469                }
52470
52471                let request = req_builder
52472                    .header(CONTENT_TYPE, json_mime_type.to_string())
52473                    .header(CONTENT_LENGTH, request_size as u64)
52474                    .body(common::to_body(
52475                        request_value_reader.get_ref().clone().into(),
52476                    ));
52477
52478                client.request(request.unwrap()).await
52479            };
52480
52481            match req_result {
52482                Err(err) => {
52483                    if let common::Retry::After(d) = dlg.http_error(&err) {
52484                        sleep(d).await;
52485                        continue;
52486                    }
52487                    dlg.finished(false);
52488                    return Err(common::Error::HttpError(err));
52489                }
52490                Ok(res) => {
52491                    let (mut parts, body) = res.into_parts();
52492                    let mut body = common::Body::new(body);
52493                    if !parts.status.is_success() {
52494                        let bytes = common::to_bytes(body).await.unwrap_or_default();
52495                        let error = serde_json::from_str(&common::to_string(&bytes));
52496                        let response = common::to_response(parts, bytes.into());
52497
52498                        if let common::Retry::After(d) =
52499                            dlg.http_failure(&response, error.as_ref().ok())
52500                        {
52501                            sleep(d).await;
52502                            continue;
52503                        }
52504
52505                        dlg.finished(false);
52506
52507                        return Err(match error {
52508                            Ok(value) => common::Error::BadRequest(value),
52509                            _ => common::Error::Failure(response),
52510                        });
52511                    }
52512                    let response = {
52513                        let bytes = common::to_bytes(body).await.unwrap_or_default();
52514                        let encoded = common::to_string(&bytes);
52515                        match serde_json::from_str(&encoded) {
52516                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
52517                            Err(error) => {
52518                                dlg.response_json_decode_error(&encoded, &error);
52519                                return Err(common::Error::JsonDecodeError(
52520                                    encoded.to_string(),
52521                                    error,
52522                                ));
52523                            }
52524                        }
52525                    };
52526
52527                    dlg.finished(true);
52528                    return Ok(response);
52529                }
52530            }
52531        }
52532    }
52533
52534    ///
52535    /// Sets the *request* property to the given value.
52536    ///
52537    /// Even though the property as already been set when instantiating this call,
52538    /// we provide this method for API completeness.
52539    pub fn request(
52540        mut self,
52541        new_value: FloodlightConfiguration,
52542    ) -> FloodlightConfigurationUpdateCall<'a, C> {
52543        self._request = new_value;
52544        self
52545    }
52546    /// User profile ID associated with this request.
52547    ///
52548    /// Sets the *profile id* path property to the given value.
52549    ///
52550    /// Even though the property as already been set when instantiating this call,
52551    /// we provide this method for API completeness.
52552    pub fn profile_id(mut self, new_value: i64) -> FloodlightConfigurationUpdateCall<'a, C> {
52553        self._profile_id = new_value;
52554        self
52555    }
52556    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
52557    /// while executing the actual API request.
52558    ///
52559    /// ````text
52560    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
52561    /// ````
52562    ///
52563    /// Sets the *delegate* property to the given value.
52564    pub fn delegate(
52565        mut self,
52566        new_value: &'a mut dyn common::Delegate,
52567    ) -> FloodlightConfigurationUpdateCall<'a, C> {
52568        self._delegate = Some(new_value);
52569        self
52570    }
52571
52572    /// Set any additional parameter of the query string used in the request.
52573    /// It should be used to set parameters which are not yet available through their own
52574    /// setters.
52575    ///
52576    /// Please note that this method must not be used to set any of the known parameters
52577    /// which have their own setter method. If done anyway, the request will fail.
52578    ///
52579    /// # Additional Parameters
52580    ///
52581    /// * *$.xgafv* (query-string) - V1 error format.
52582    /// * *access_token* (query-string) - OAuth access token.
52583    /// * *alt* (query-string) - Data format for response.
52584    /// * *callback* (query-string) - JSONP
52585    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
52586    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
52587    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
52588    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
52589    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
52590    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
52591    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
52592    pub fn param<T>(mut self, name: T, value: T) -> FloodlightConfigurationUpdateCall<'a, C>
52593    where
52594        T: AsRef<str>,
52595    {
52596        self._additional_params
52597            .insert(name.as_ref().to_string(), value.as_ref().to_string());
52598        self
52599    }
52600
52601    /// Identifies the authorization scope for the method you are building.
52602    ///
52603    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
52604    /// [`Scope::Dfatrafficking`].
52605    ///
52606    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
52607    /// tokens for more than one scope.
52608    ///
52609    /// Usually there is more than one suitable scope to authorize an operation, some of which may
52610    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
52611    /// sufficient, a read-write scope will do as well.
52612    pub fn add_scope<St>(mut self, scope: St) -> FloodlightConfigurationUpdateCall<'a, C>
52613    where
52614        St: AsRef<str>,
52615    {
52616        self._scopes.insert(String::from(scope.as_ref()));
52617        self
52618    }
52619    /// Identifies the authorization scope(s) for the method you are building.
52620    ///
52621    /// See [`Self::add_scope()`] for details.
52622    pub fn add_scopes<I, St>(mut self, scopes: I) -> FloodlightConfigurationUpdateCall<'a, C>
52623    where
52624        I: IntoIterator<Item = St>,
52625        St: AsRef<str>,
52626    {
52627        self._scopes
52628            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
52629        self
52630    }
52631
52632    /// Removes all scopes, and no default scope will be used either.
52633    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
52634    /// for details).
52635    pub fn clear_scopes(mut self) -> FloodlightConfigurationUpdateCall<'a, C> {
52636        self._scopes.clear();
52637        self
52638    }
52639}
52640
52641/// Gets one inventory item by ID.
52642///
52643/// A builder for the *get* method supported by a *inventoryItem* resource.
52644/// It is not used directly, but through a [`InventoryItemMethods`] instance.
52645///
52646/// # Example
52647///
52648/// Instantiate a resource method builder
52649///
52650/// ```test_harness,no_run
52651/// # extern crate hyper;
52652/// # extern crate hyper_rustls;
52653/// # extern crate google_dfareporting3d3 as dfareporting3d3;
52654/// # async fn dox() {
52655/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
52656///
52657/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
52658/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
52659/// #     secret,
52660/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
52661/// # ).build().await.unwrap();
52662///
52663/// # let client = hyper_util::client::legacy::Client::builder(
52664/// #     hyper_util::rt::TokioExecutor::new()
52665/// # )
52666/// # .build(
52667/// #     hyper_rustls::HttpsConnectorBuilder::new()
52668/// #         .with_native_roots()
52669/// #         .unwrap()
52670/// #         .https_or_http()
52671/// #         .enable_http1()
52672/// #         .build()
52673/// # );
52674/// # let mut hub = Dfareporting::new(client, auth);
52675/// // You can configure optional parameters by calling the respective setters at will, and
52676/// // execute the final call using `doit()`.
52677/// // Values shown here are possibly random and not representative !
52678/// let result = hub.inventory_items().get(-32, -5, -62)
52679///              .doit().await;
52680/// # }
52681/// ```
52682pub struct InventoryItemGetCall<'a, C>
52683where
52684    C: 'a,
52685{
52686    hub: &'a Dfareporting<C>,
52687    _profile_id: i64,
52688    _project_id: i64,
52689    _id: i64,
52690    _delegate: Option<&'a mut dyn common::Delegate>,
52691    _additional_params: HashMap<String, String>,
52692    _scopes: BTreeSet<String>,
52693}
52694
52695impl<'a, C> common::CallBuilder for InventoryItemGetCall<'a, C> {}
52696
52697impl<'a, C> InventoryItemGetCall<'a, C>
52698where
52699    C: common::Connector,
52700{
52701    /// Perform the operation you have build so far.
52702    pub async fn doit(mut self) -> common::Result<(common::Response, InventoryItem)> {
52703        use std::borrow::Cow;
52704        use std::io::{Read, Seek};
52705
52706        use common::{url::Params, ToParts};
52707        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
52708
52709        let mut dd = common::DefaultDelegate;
52710        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
52711        dlg.begin(common::MethodInfo {
52712            id: "dfareporting.inventoryItems.get",
52713            http_method: hyper::Method::GET,
52714        });
52715
52716        for &field in ["alt", "profileId", "projectId", "id"].iter() {
52717            if self._additional_params.contains_key(field) {
52718                dlg.finished(false);
52719                return Err(common::Error::FieldClash(field));
52720            }
52721        }
52722
52723        let mut params = Params::with_capacity(5 + self._additional_params.len());
52724        params.push("profileId", self._profile_id.to_string());
52725        params.push("projectId", self._project_id.to_string());
52726        params.push("id", self._id.to_string());
52727
52728        params.extend(self._additional_params.iter());
52729
52730        params.push("alt", "json");
52731        let mut url = self.hub._base_url.clone()
52732            + "userprofiles/{profileId}/projects/{projectId}/inventoryItems/{id}";
52733        if self._scopes.is_empty() {
52734            self._scopes
52735                .insert(Scope::Dfatrafficking.as_ref().to_string());
52736        }
52737
52738        #[allow(clippy::single_element_loop)]
52739        for &(find_this, param_name) in [
52740            ("{profileId}", "profileId"),
52741            ("{projectId}", "projectId"),
52742            ("{id}", "id"),
52743        ]
52744        .iter()
52745        {
52746            url = params.uri_replacement(url, param_name, find_this, false);
52747        }
52748        {
52749            let to_remove = ["id", "projectId", "profileId"];
52750            params.remove_params(&to_remove);
52751        }
52752
52753        let url = params.parse_with_url(&url);
52754
52755        loop {
52756            let token = match self
52757                .hub
52758                .auth
52759                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
52760                .await
52761            {
52762                Ok(token) => token,
52763                Err(e) => match dlg.token(e) {
52764                    Ok(token) => token,
52765                    Err(e) => {
52766                        dlg.finished(false);
52767                        return Err(common::Error::MissingToken(e));
52768                    }
52769                },
52770            };
52771            let mut req_result = {
52772                let client = &self.hub.client;
52773                dlg.pre_request();
52774                let mut req_builder = hyper::Request::builder()
52775                    .method(hyper::Method::GET)
52776                    .uri(url.as_str())
52777                    .header(USER_AGENT, self.hub._user_agent.clone());
52778
52779                if let Some(token) = token.as_ref() {
52780                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
52781                }
52782
52783                let request = req_builder
52784                    .header(CONTENT_LENGTH, 0_u64)
52785                    .body(common::to_body::<String>(None));
52786
52787                client.request(request.unwrap()).await
52788            };
52789
52790            match req_result {
52791                Err(err) => {
52792                    if let common::Retry::After(d) = dlg.http_error(&err) {
52793                        sleep(d).await;
52794                        continue;
52795                    }
52796                    dlg.finished(false);
52797                    return Err(common::Error::HttpError(err));
52798                }
52799                Ok(res) => {
52800                    let (mut parts, body) = res.into_parts();
52801                    let mut body = common::Body::new(body);
52802                    if !parts.status.is_success() {
52803                        let bytes = common::to_bytes(body).await.unwrap_or_default();
52804                        let error = serde_json::from_str(&common::to_string(&bytes));
52805                        let response = common::to_response(parts, bytes.into());
52806
52807                        if let common::Retry::After(d) =
52808                            dlg.http_failure(&response, error.as_ref().ok())
52809                        {
52810                            sleep(d).await;
52811                            continue;
52812                        }
52813
52814                        dlg.finished(false);
52815
52816                        return Err(match error {
52817                            Ok(value) => common::Error::BadRequest(value),
52818                            _ => common::Error::Failure(response),
52819                        });
52820                    }
52821                    let response = {
52822                        let bytes = common::to_bytes(body).await.unwrap_or_default();
52823                        let encoded = common::to_string(&bytes);
52824                        match serde_json::from_str(&encoded) {
52825                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
52826                            Err(error) => {
52827                                dlg.response_json_decode_error(&encoded, &error);
52828                                return Err(common::Error::JsonDecodeError(
52829                                    encoded.to_string(),
52830                                    error,
52831                                ));
52832                            }
52833                        }
52834                    };
52835
52836                    dlg.finished(true);
52837                    return Ok(response);
52838                }
52839            }
52840        }
52841    }
52842
52843    /// User profile ID associated with this request.
52844    ///
52845    /// Sets the *profile id* path property to the given value.
52846    ///
52847    /// Even though the property as already been set when instantiating this call,
52848    /// we provide this method for API completeness.
52849    pub fn profile_id(mut self, new_value: i64) -> InventoryItemGetCall<'a, C> {
52850        self._profile_id = new_value;
52851        self
52852    }
52853    /// Project ID for order documents.
52854    ///
52855    /// Sets the *project id* path property to the given value.
52856    ///
52857    /// Even though the property as already been set when instantiating this call,
52858    /// we provide this method for API completeness.
52859    pub fn project_id(mut self, new_value: i64) -> InventoryItemGetCall<'a, C> {
52860        self._project_id = new_value;
52861        self
52862    }
52863    /// Inventory item ID.
52864    ///
52865    /// Sets the *id* path property to the given value.
52866    ///
52867    /// Even though the property as already been set when instantiating this call,
52868    /// we provide this method for API completeness.
52869    pub fn id(mut self, new_value: i64) -> InventoryItemGetCall<'a, C> {
52870        self._id = new_value;
52871        self
52872    }
52873    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
52874    /// while executing the actual API request.
52875    ///
52876    /// ````text
52877    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
52878    /// ````
52879    ///
52880    /// Sets the *delegate* property to the given value.
52881    pub fn delegate(
52882        mut self,
52883        new_value: &'a mut dyn common::Delegate,
52884    ) -> InventoryItemGetCall<'a, C> {
52885        self._delegate = Some(new_value);
52886        self
52887    }
52888
52889    /// Set any additional parameter of the query string used in the request.
52890    /// It should be used to set parameters which are not yet available through their own
52891    /// setters.
52892    ///
52893    /// Please note that this method must not be used to set any of the known parameters
52894    /// which have their own setter method. If done anyway, the request will fail.
52895    ///
52896    /// # Additional Parameters
52897    ///
52898    /// * *$.xgafv* (query-string) - V1 error format.
52899    /// * *access_token* (query-string) - OAuth access token.
52900    /// * *alt* (query-string) - Data format for response.
52901    /// * *callback* (query-string) - JSONP
52902    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
52903    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
52904    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
52905    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
52906    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
52907    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
52908    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
52909    pub fn param<T>(mut self, name: T, value: T) -> InventoryItemGetCall<'a, C>
52910    where
52911        T: AsRef<str>,
52912    {
52913        self._additional_params
52914            .insert(name.as_ref().to_string(), value.as_ref().to_string());
52915        self
52916    }
52917
52918    /// Identifies the authorization scope for the method you are building.
52919    ///
52920    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
52921    /// [`Scope::Dfatrafficking`].
52922    ///
52923    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
52924    /// tokens for more than one scope.
52925    ///
52926    /// Usually there is more than one suitable scope to authorize an operation, some of which may
52927    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
52928    /// sufficient, a read-write scope will do as well.
52929    pub fn add_scope<St>(mut self, scope: St) -> InventoryItemGetCall<'a, C>
52930    where
52931        St: AsRef<str>,
52932    {
52933        self._scopes.insert(String::from(scope.as_ref()));
52934        self
52935    }
52936    /// Identifies the authorization scope(s) for the method you are building.
52937    ///
52938    /// See [`Self::add_scope()`] for details.
52939    pub fn add_scopes<I, St>(mut self, scopes: I) -> InventoryItemGetCall<'a, C>
52940    where
52941        I: IntoIterator<Item = St>,
52942        St: AsRef<str>,
52943    {
52944        self._scopes
52945            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
52946        self
52947    }
52948
52949    /// Removes all scopes, and no default scope will be used either.
52950    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
52951    /// for details).
52952    pub fn clear_scopes(mut self) -> InventoryItemGetCall<'a, C> {
52953        self._scopes.clear();
52954        self
52955    }
52956}
52957
52958/// Retrieves a list of inventory items, possibly filtered. This method supports paging.
52959///
52960/// A builder for the *list* method supported by a *inventoryItem* resource.
52961/// It is not used directly, but through a [`InventoryItemMethods`] instance.
52962///
52963/// # Example
52964///
52965/// Instantiate a resource method builder
52966///
52967/// ```test_harness,no_run
52968/// # extern crate hyper;
52969/// # extern crate hyper_rustls;
52970/// # extern crate google_dfareporting3d3 as dfareporting3d3;
52971/// # async fn dox() {
52972/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
52973///
52974/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
52975/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
52976/// #     secret,
52977/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
52978/// # ).build().await.unwrap();
52979///
52980/// # let client = hyper_util::client::legacy::Client::builder(
52981/// #     hyper_util::rt::TokioExecutor::new()
52982/// # )
52983/// # .build(
52984/// #     hyper_rustls::HttpsConnectorBuilder::new()
52985/// #         .with_native_roots()
52986/// #         .unwrap()
52987/// #         .https_or_http()
52988/// #         .enable_http1()
52989/// #         .build()
52990/// # );
52991/// # let mut hub = Dfareporting::new(client, auth);
52992/// // You can configure optional parameters by calling the respective setters at will, and
52993/// // execute the final call using `doit()`.
52994/// // Values shown here are possibly random and not representative !
52995/// let result = hub.inventory_items().list(-88, -10)
52996///              .type_("duo")
52997///              .sort_order("sea")
52998///              .sort_field("Stet")
52999///              .add_site_id(-95)
53000///              .page_token("no")
53001///              .add_order_id(-39)
53002///              .max_results(-55)
53003///              .in_plan(true)
53004///              .add_ids(-98)
53005///              .doit().await;
53006/// # }
53007/// ```
53008pub struct InventoryItemListCall<'a, C>
53009where
53010    C: 'a,
53011{
53012    hub: &'a Dfareporting<C>,
53013    _profile_id: i64,
53014    _project_id: i64,
53015    _type_: Option<String>,
53016    _sort_order: Option<String>,
53017    _sort_field: Option<String>,
53018    _site_id: Vec<i64>,
53019    _page_token: Option<String>,
53020    _order_id: Vec<i64>,
53021    _max_results: Option<i32>,
53022    _in_plan: Option<bool>,
53023    _ids: Vec<i64>,
53024    _delegate: Option<&'a mut dyn common::Delegate>,
53025    _additional_params: HashMap<String, String>,
53026    _scopes: BTreeSet<String>,
53027}
53028
53029impl<'a, C> common::CallBuilder for InventoryItemListCall<'a, C> {}
53030
53031impl<'a, C> InventoryItemListCall<'a, C>
53032where
53033    C: common::Connector,
53034{
53035    /// Perform the operation you have build so far.
53036    pub async fn doit(mut self) -> common::Result<(common::Response, InventoryItemsListResponse)> {
53037        use std::borrow::Cow;
53038        use std::io::{Read, Seek};
53039
53040        use common::{url::Params, ToParts};
53041        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
53042
53043        let mut dd = common::DefaultDelegate;
53044        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
53045        dlg.begin(common::MethodInfo {
53046            id: "dfareporting.inventoryItems.list",
53047            http_method: hyper::Method::GET,
53048        });
53049
53050        for &field in [
53051            "alt",
53052            "profileId",
53053            "projectId",
53054            "type",
53055            "sortOrder",
53056            "sortField",
53057            "siteId",
53058            "pageToken",
53059            "orderId",
53060            "maxResults",
53061            "inPlan",
53062            "ids",
53063        ]
53064        .iter()
53065        {
53066            if self._additional_params.contains_key(field) {
53067                dlg.finished(false);
53068                return Err(common::Error::FieldClash(field));
53069            }
53070        }
53071
53072        let mut params = Params::with_capacity(13 + self._additional_params.len());
53073        params.push("profileId", self._profile_id.to_string());
53074        params.push("projectId", self._project_id.to_string());
53075        if let Some(value) = self._type_.as_ref() {
53076            params.push("type", value);
53077        }
53078        if let Some(value) = self._sort_order.as_ref() {
53079            params.push("sortOrder", value);
53080        }
53081        if let Some(value) = self._sort_field.as_ref() {
53082            params.push("sortField", value);
53083        }
53084        if !self._site_id.is_empty() {
53085            for f in self._site_id.iter() {
53086                params.push("siteId", f.to_string());
53087            }
53088        }
53089        if let Some(value) = self._page_token.as_ref() {
53090            params.push("pageToken", value);
53091        }
53092        if !self._order_id.is_empty() {
53093            for f in self._order_id.iter() {
53094                params.push("orderId", f.to_string());
53095            }
53096        }
53097        if let Some(value) = self._max_results.as_ref() {
53098            params.push("maxResults", value.to_string());
53099        }
53100        if let Some(value) = self._in_plan.as_ref() {
53101            params.push("inPlan", value.to_string());
53102        }
53103        if !self._ids.is_empty() {
53104            for f in self._ids.iter() {
53105                params.push("ids", f.to_string());
53106            }
53107        }
53108
53109        params.extend(self._additional_params.iter());
53110
53111        params.push("alt", "json");
53112        let mut url = self.hub._base_url.clone()
53113            + "userprofiles/{profileId}/projects/{projectId}/inventoryItems";
53114        if self._scopes.is_empty() {
53115            self._scopes
53116                .insert(Scope::Dfatrafficking.as_ref().to_string());
53117        }
53118
53119        #[allow(clippy::single_element_loop)]
53120        for &(find_this, param_name) in
53121            [("{profileId}", "profileId"), ("{projectId}", "projectId")].iter()
53122        {
53123            url = params.uri_replacement(url, param_name, find_this, false);
53124        }
53125        {
53126            let to_remove = ["projectId", "profileId"];
53127            params.remove_params(&to_remove);
53128        }
53129
53130        let url = params.parse_with_url(&url);
53131
53132        loop {
53133            let token = match self
53134                .hub
53135                .auth
53136                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
53137                .await
53138            {
53139                Ok(token) => token,
53140                Err(e) => match dlg.token(e) {
53141                    Ok(token) => token,
53142                    Err(e) => {
53143                        dlg.finished(false);
53144                        return Err(common::Error::MissingToken(e));
53145                    }
53146                },
53147            };
53148            let mut req_result = {
53149                let client = &self.hub.client;
53150                dlg.pre_request();
53151                let mut req_builder = hyper::Request::builder()
53152                    .method(hyper::Method::GET)
53153                    .uri(url.as_str())
53154                    .header(USER_AGENT, self.hub._user_agent.clone());
53155
53156                if let Some(token) = token.as_ref() {
53157                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
53158                }
53159
53160                let request = req_builder
53161                    .header(CONTENT_LENGTH, 0_u64)
53162                    .body(common::to_body::<String>(None));
53163
53164                client.request(request.unwrap()).await
53165            };
53166
53167            match req_result {
53168                Err(err) => {
53169                    if let common::Retry::After(d) = dlg.http_error(&err) {
53170                        sleep(d).await;
53171                        continue;
53172                    }
53173                    dlg.finished(false);
53174                    return Err(common::Error::HttpError(err));
53175                }
53176                Ok(res) => {
53177                    let (mut parts, body) = res.into_parts();
53178                    let mut body = common::Body::new(body);
53179                    if !parts.status.is_success() {
53180                        let bytes = common::to_bytes(body).await.unwrap_or_default();
53181                        let error = serde_json::from_str(&common::to_string(&bytes));
53182                        let response = common::to_response(parts, bytes.into());
53183
53184                        if let common::Retry::After(d) =
53185                            dlg.http_failure(&response, error.as_ref().ok())
53186                        {
53187                            sleep(d).await;
53188                            continue;
53189                        }
53190
53191                        dlg.finished(false);
53192
53193                        return Err(match error {
53194                            Ok(value) => common::Error::BadRequest(value),
53195                            _ => common::Error::Failure(response),
53196                        });
53197                    }
53198                    let response = {
53199                        let bytes = common::to_bytes(body).await.unwrap_or_default();
53200                        let encoded = common::to_string(&bytes);
53201                        match serde_json::from_str(&encoded) {
53202                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
53203                            Err(error) => {
53204                                dlg.response_json_decode_error(&encoded, &error);
53205                                return Err(common::Error::JsonDecodeError(
53206                                    encoded.to_string(),
53207                                    error,
53208                                ));
53209                            }
53210                        }
53211                    };
53212
53213                    dlg.finished(true);
53214                    return Ok(response);
53215                }
53216            }
53217        }
53218    }
53219
53220    /// User profile ID associated with this request.
53221    ///
53222    /// Sets the *profile id* path property to the given value.
53223    ///
53224    /// Even though the property as already been set when instantiating this call,
53225    /// we provide this method for API completeness.
53226    pub fn profile_id(mut self, new_value: i64) -> InventoryItemListCall<'a, C> {
53227        self._profile_id = new_value;
53228        self
53229    }
53230    /// Project ID for order documents.
53231    ///
53232    /// Sets the *project id* path property to the given value.
53233    ///
53234    /// Even though the property as already been set when instantiating this call,
53235    /// we provide this method for API completeness.
53236    pub fn project_id(mut self, new_value: i64) -> InventoryItemListCall<'a, C> {
53237        self._project_id = new_value;
53238        self
53239    }
53240    /// Select only inventory items with this type.
53241    ///
53242    /// Sets the *type* query property to the given value.
53243    pub fn type_(mut self, new_value: &str) -> InventoryItemListCall<'a, C> {
53244        self._type_ = Some(new_value.to_string());
53245        self
53246    }
53247    /// Order of sorted results.
53248    ///
53249    /// Sets the *sort order* query property to the given value.
53250    pub fn sort_order(mut self, new_value: &str) -> InventoryItemListCall<'a, C> {
53251        self._sort_order = Some(new_value.to_string());
53252        self
53253    }
53254    /// Field by which to sort the list.
53255    ///
53256    /// Sets the *sort field* query property to the given value.
53257    pub fn sort_field(mut self, new_value: &str) -> InventoryItemListCall<'a, C> {
53258        self._sort_field = Some(new_value.to_string());
53259        self
53260    }
53261    /// Select only inventory items that are associated with these sites.
53262    ///
53263    /// Append the given value to the *site id* query property.
53264    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
53265    pub fn add_site_id(mut self, new_value: i64) -> InventoryItemListCall<'a, C> {
53266        self._site_id.push(new_value);
53267        self
53268    }
53269    /// Value of the nextPageToken from the previous result page.
53270    ///
53271    /// Sets the *page token* query property to the given value.
53272    pub fn page_token(mut self, new_value: &str) -> InventoryItemListCall<'a, C> {
53273        self._page_token = Some(new_value.to_string());
53274        self
53275    }
53276    /// Select only inventory items that belong to specified orders.
53277    ///
53278    /// Append the given value to the *order id* query property.
53279    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
53280    pub fn add_order_id(mut self, new_value: i64) -> InventoryItemListCall<'a, C> {
53281        self._order_id.push(new_value);
53282        self
53283    }
53284    /// Maximum number of results to return.
53285    ///
53286    /// Sets the *max results* query property to the given value.
53287    pub fn max_results(mut self, new_value: i32) -> InventoryItemListCall<'a, C> {
53288        self._max_results = Some(new_value);
53289        self
53290    }
53291    /// Select only inventory items that are in plan.
53292    ///
53293    /// Sets the *in plan* query property to the given value.
53294    pub fn in_plan(mut self, new_value: bool) -> InventoryItemListCall<'a, C> {
53295        self._in_plan = Some(new_value);
53296        self
53297    }
53298    /// Select only inventory items with these IDs.
53299    ///
53300    /// Append the given value to the *ids* query property.
53301    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
53302    pub fn add_ids(mut self, new_value: i64) -> InventoryItemListCall<'a, C> {
53303        self._ids.push(new_value);
53304        self
53305    }
53306    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
53307    /// while executing the actual API request.
53308    ///
53309    /// ````text
53310    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
53311    /// ````
53312    ///
53313    /// Sets the *delegate* property to the given value.
53314    pub fn delegate(
53315        mut self,
53316        new_value: &'a mut dyn common::Delegate,
53317    ) -> InventoryItemListCall<'a, C> {
53318        self._delegate = Some(new_value);
53319        self
53320    }
53321
53322    /// Set any additional parameter of the query string used in the request.
53323    /// It should be used to set parameters which are not yet available through their own
53324    /// setters.
53325    ///
53326    /// Please note that this method must not be used to set any of the known parameters
53327    /// which have their own setter method. If done anyway, the request will fail.
53328    ///
53329    /// # Additional Parameters
53330    ///
53331    /// * *$.xgafv* (query-string) - V1 error format.
53332    /// * *access_token* (query-string) - OAuth access token.
53333    /// * *alt* (query-string) - Data format for response.
53334    /// * *callback* (query-string) - JSONP
53335    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
53336    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
53337    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
53338    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
53339    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
53340    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
53341    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
53342    pub fn param<T>(mut self, name: T, value: T) -> InventoryItemListCall<'a, C>
53343    where
53344        T: AsRef<str>,
53345    {
53346        self._additional_params
53347            .insert(name.as_ref().to_string(), value.as_ref().to_string());
53348        self
53349    }
53350
53351    /// Identifies the authorization scope for the method you are building.
53352    ///
53353    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
53354    /// [`Scope::Dfatrafficking`].
53355    ///
53356    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
53357    /// tokens for more than one scope.
53358    ///
53359    /// Usually there is more than one suitable scope to authorize an operation, some of which may
53360    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
53361    /// sufficient, a read-write scope will do as well.
53362    pub fn add_scope<St>(mut self, scope: St) -> InventoryItemListCall<'a, C>
53363    where
53364        St: AsRef<str>,
53365    {
53366        self._scopes.insert(String::from(scope.as_ref()));
53367        self
53368    }
53369    /// Identifies the authorization scope(s) for the method you are building.
53370    ///
53371    /// See [`Self::add_scope()`] for details.
53372    pub fn add_scopes<I, St>(mut self, scopes: I) -> InventoryItemListCall<'a, C>
53373    where
53374        I: IntoIterator<Item = St>,
53375        St: AsRef<str>,
53376    {
53377        self._scopes
53378            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
53379        self
53380    }
53381
53382    /// Removes all scopes, and no default scope will be used either.
53383    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
53384    /// for details).
53385    pub fn clear_scopes(mut self) -> InventoryItemListCall<'a, C> {
53386        self._scopes.clear();
53387        self
53388    }
53389}
53390
53391/// Retrieves a list of languages.
53392///
53393/// A builder for the *list* method supported by a *language* resource.
53394/// It is not used directly, but through a [`LanguageMethods`] instance.
53395///
53396/// # Example
53397///
53398/// Instantiate a resource method builder
53399///
53400/// ```test_harness,no_run
53401/// # extern crate hyper;
53402/// # extern crate hyper_rustls;
53403/// # extern crate google_dfareporting3d3 as dfareporting3d3;
53404/// # async fn dox() {
53405/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
53406///
53407/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
53408/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
53409/// #     secret,
53410/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
53411/// # ).build().await.unwrap();
53412///
53413/// # let client = hyper_util::client::legacy::Client::builder(
53414/// #     hyper_util::rt::TokioExecutor::new()
53415/// # )
53416/// # .build(
53417/// #     hyper_rustls::HttpsConnectorBuilder::new()
53418/// #         .with_native_roots()
53419/// #         .unwrap()
53420/// #         .https_or_http()
53421/// #         .enable_http1()
53422/// #         .build()
53423/// # );
53424/// # let mut hub = Dfareporting::new(client, auth);
53425/// // You can configure optional parameters by calling the respective setters at will, and
53426/// // execute the final call using `doit()`.
53427/// // Values shown here are possibly random and not representative !
53428/// let result = hub.languages().list(-2)
53429///              .doit().await;
53430/// # }
53431/// ```
53432pub struct LanguageListCall<'a, C>
53433where
53434    C: 'a,
53435{
53436    hub: &'a Dfareporting<C>,
53437    _profile_id: i64,
53438    _delegate: Option<&'a mut dyn common::Delegate>,
53439    _additional_params: HashMap<String, String>,
53440    _scopes: BTreeSet<String>,
53441}
53442
53443impl<'a, C> common::CallBuilder for LanguageListCall<'a, C> {}
53444
53445impl<'a, C> LanguageListCall<'a, C>
53446where
53447    C: common::Connector,
53448{
53449    /// Perform the operation you have build so far.
53450    pub async fn doit(mut self) -> common::Result<(common::Response, LanguagesListResponse)> {
53451        use std::borrow::Cow;
53452        use std::io::{Read, Seek};
53453
53454        use common::{url::Params, ToParts};
53455        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
53456
53457        let mut dd = common::DefaultDelegate;
53458        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
53459        dlg.begin(common::MethodInfo {
53460            id: "dfareporting.languages.list",
53461            http_method: hyper::Method::GET,
53462        });
53463
53464        for &field in ["alt", "profileId"].iter() {
53465            if self._additional_params.contains_key(field) {
53466                dlg.finished(false);
53467                return Err(common::Error::FieldClash(field));
53468            }
53469        }
53470
53471        let mut params = Params::with_capacity(3 + self._additional_params.len());
53472        params.push("profileId", self._profile_id.to_string());
53473
53474        params.extend(self._additional_params.iter());
53475
53476        params.push("alt", "json");
53477        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/languages";
53478        if self._scopes.is_empty() {
53479            self._scopes
53480                .insert(Scope::Dfatrafficking.as_ref().to_string());
53481        }
53482
53483        #[allow(clippy::single_element_loop)]
53484        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
53485            url = params.uri_replacement(url, param_name, find_this, false);
53486        }
53487        {
53488            let to_remove = ["profileId"];
53489            params.remove_params(&to_remove);
53490        }
53491
53492        let url = params.parse_with_url(&url);
53493
53494        loop {
53495            let token = match self
53496                .hub
53497                .auth
53498                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
53499                .await
53500            {
53501                Ok(token) => token,
53502                Err(e) => match dlg.token(e) {
53503                    Ok(token) => token,
53504                    Err(e) => {
53505                        dlg.finished(false);
53506                        return Err(common::Error::MissingToken(e));
53507                    }
53508                },
53509            };
53510            let mut req_result = {
53511                let client = &self.hub.client;
53512                dlg.pre_request();
53513                let mut req_builder = hyper::Request::builder()
53514                    .method(hyper::Method::GET)
53515                    .uri(url.as_str())
53516                    .header(USER_AGENT, self.hub._user_agent.clone());
53517
53518                if let Some(token) = token.as_ref() {
53519                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
53520                }
53521
53522                let request = req_builder
53523                    .header(CONTENT_LENGTH, 0_u64)
53524                    .body(common::to_body::<String>(None));
53525
53526                client.request(request.unwrap()).await
53527            };
53528
53529            match req_result {
53530                Err(err) => {
53531                    if let common::Retry::After(d) = dlg.http_error(&err) {
53532                        sleep(d).await;
53533                        continue;
53534                    }
53535                    dlg.finished(false);
53536                    return Err(common::Error::HttpError(err));
53537                }
53538                Ok(res) => {
53539                    let (mut parts, body) = res.into_parts();
53540                    let mut body = common::Body::new(body);
53541                    if !parts.status.is_success() {
53542                        let bytes = common::to_bytes(body).await.unwrap_or_default();
53543                        let error = serde_json::from_str(&common::to_string(&bytes));
53544                        let response = common::to_response(parts, bytes.into());
53545
53546                        if let common::Retry::After(d) =
53547                            dlg.http_failure(&response, error.as_ref().ok())
53548                        {
53549                            sleep(d).await;
53550                            continue;
53551                        }
53552
53553                        dlg.finished(false);
53554
53555                        return Err(match error {
53556                            Ok(value) => common::Error::BadRequest(value),
53557                            _ => common::Error::Failure(response),
53558                        });
53559                    }
53560                    let response = {
53561                        let bytes = common::to_bytes(body).await.unwrap_or_default();
53562                        let encoded = common::to_string(&bytes);
53563                        match serde_json::from_str(&encoded) {
53564                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
53565                            Err(error) => {
53566                                dlg.response_json_decode_error(&encoded, &error);
53567                                return Err(common::Error::JsonDecodeError(
53568                                    encoded.to_string(),
53569                                    error,
53570                                ));
53571                            }
53572                        }
53573                    };
53574
53575                    dlg.finished(true);
53576                    return Ok(response);
53577                }
53578            }
53579        }
53580    }
53581
53582    /// User profile ID associated with this request.
53583    ///
53584    /// Sets the *profile id* path property to the given value.
53585    ///
53586    /// Even though the property as already been set when instantiating this call,
53587    /// we provide this method for API completeness.
53588    pub fn profile_id(mut self, new_value: i64) -> LanguageListCall<'a, C> {
53589        self._profile_id = new_value;
53590        self
53591    }
53592    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
53593    /// while executing the actual API request.
53594    ///
53595    /// ````text
53596    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
53597    /// ````
53598    ///
53599    /// Sets the *delegate* property to the given value.
53600    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> LanguageListCall<'a, C> {
53601        self._delegate = Some(new_value);
53602        self
53603    }
53604
53605    /// Set any additional parameter of the query string used in the request.
53606    /// It should be used to set parameters which are not yet available through their own
53607    /// setters.
53608    ///
53609    /// Please note that this method must not be used to set any of the known parameters
53610    /// which have their own setter method. If done anyway, the request will fail.
53611    ///
53612    /// # Additional Parameters
53613    ///
53614    /// * *$.xgafv* (query-string) - V1 error format.
53615    /// * *access_token* (query-string) - OAuth access token.
53616    /// * *alt* (query-string) - Data format for response.
53617    /// * *callback* (query-string) - JSONP
53618    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
53619    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
53620    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
53621    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
53622    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
53623    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
53624    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
53625    pub fn param<T>(mut self, name: T, value: T) -> LanguageListCall<'a, C>
53626    where
53627        T: AsRef<str>,
53628    {
53629        self._additional_params
53630            .insert(name.as_ref().to_string(), value.as_ref().to_string());
53631        self
53632    }
53633
53634    /// Identifies the authorization scope for the method you are building.
53635    ///
53636    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
53637    /// [`Scope::Dfatrafficking`].
53638    ///
53639    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
53640    /// tokens for more than one scope.
53641    ///
53642    /// Usually there is more than one suitable scope to authorize an operation, some of which may
53643    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
53644    /// sufficient, a read-write scope will do as well.
53645    pub fn add_scope<St>(mut self, scope: St) -> LanguageListCall<'a, C>
53646    where
53647        St: AsRef<str>,
53648    {
53649        self._scopes.insert(String::from(scope.as_ref()));
53650        self
53651    }
53652    /// Identifies the authorization scope(s) for the method you are building.
53653    ///
53654    /// See [`Self::add_scope()`] for details.
53655    pub fn add_scopes<I, St>(mut self, scopes: I) -> LanguageListCall<'a, C>
53656    where
53657        I: IntoIterator<Item = St>,
53658        St: AsRef<str>,
53659    {
53660        self._scopes
53661            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
53662        self
53663    }
53664
53665    /// Removes all scopes, and no default scope will be used either.
53666    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
53667    /// for details).
53668    pub fn clear_scopes(mut self) -> LanguageListCall<'a, C> {
53669        self._scopes.clear();
53670        self
53671    }
53672}
53673
53674/// Retrieves a list of metros.
53675///
53676/// A builder for the *list* method supported by a *metro* resource.
53677/// It is not used directly, but through a [`MetroMethods`] instance.
53678///
53679/// # Example
53680///
53681/// Instantiate a resource method builder
53682///
53683/// ```test_harness,no_run
53684/// # extern crate hyper;
53685/// # extern crate hyper_rustls;
53686/// # extern crate google_dfareporting3d3 as dfareporting3d3;
53687/// # async fn dox() {
53688/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
53689///
53690/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
53691/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
53692/// #     secret,
53693/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
53694/// # ).build().await.unwrap();
53695///
53696/// # let client = hyper_util::client::legacy::Client::builder(
53697/// #     hyper_util::rt::TokioExecutor::new()
53698/// # )
53699/// # .build(
53700/// #     hyper_rustls::HttpsConnectorBuilder::new()
53701/// #         .with_native_roots()
53702/// #         .unwrap()
53703/// #         .https_or_http()
53704/// #         .enable_http1()
53705/// #         .build()
53706/// # );
53707/// # let mut hub = Dfareporting::new(client, auth);
53708/// // You can configure optional parameters by calling the respective setters at will, and
53709/// // execute the final call using `doit()`.
53710/// // Values shown here are possibly random and not representative !
53711/// let result = hub.metros().list(-55)
53712///              .doit().await;
53713/// # }
53714/// ```
53715pub struct MetroListCall<'a, C>
53716where
53717    C: 'a,
53718{
53719    hub: &'a Dfareporting<C>,
53720    _profile_id: i64,
53721    _delegate: Option<&'a mut dyn common::Delegate>,
53722    _additional_params: HashMap<String, String>,
53723    _scopes: BTreeSet<String>,
53724}
53725
53726impl<'a, C> common::CallBuilder for MetroListCall<'a, C> {}
53727
53728impl<'a, C> MetroListCall<'a, C>
53729where
53730    C: common::Connector,
53731{
53732    /// Perform the operation you have build so far.
53733    pub async fn doit(mut self) -> common::Result<(common::Response, MetrosListResponse)> {
53734        use std::borrow::Cow;
53735        use std::io::{Read, Seek};
53736
53737        use common::{url::Params, ToParts};
53738        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
53739
53740        let mut dd = common::DefaultDelegate;
53741        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
53742        dlg.begin(common::MethodInfo {
53743            id: "dfareporting.metros.list",
53744            http_method: hyper::Method::GET,
53745        });
53746
53747        for &field in ["alt", "profileId"].iter() {
53748            if self._additional_params.contains_key(field) {
53749                dlg.finished(false);
53750                return Err(common::Error::FieldClash(field));
53751            }
53752        }
53753
53754        let mut params = Params::with_capacity(3 + self._additional_params.len());
53755        params.push("profileId", self._profile_id.to_string());
53756
53757        params.extend(self._additional_params.iter());
53758
53759        params.push("alt", "json");
53760        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/metros";
53761        if self._scopes.is_empty() {
53762            self._scopes
53763                .insert(Scope::Dfatrafficking.as_ref().to_string());
53764        }
53765
53766        #[allow(clippy::single_element_loop)]
53767        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
53768            url = params.uri_replacement(url, param_name, find_this, false);
53769        }
53770        {
53771            let to_remove = ["profileId"];
53772            params.remove_params(&to_remove);
53773        }
53774
53775        let url = params.parse_with_url(&url);
53776
53777        loop {
53778            let token = match self
53779                .hub
53780                .auth
53781                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
53782                .await
53783            {
53784                Ok(token) => token,
53785                Err(e) => match dlg.token(e) {
53786                    Ok(token) => token,
53787                    Err(e) => {
53788                        dlg.finished(false);
53789                        return Err(common::Error::MissingToken(e));
53790                    }
53791                },
53792            };
53793            let mut req_result = {
53794                let client = &self.hub.client;
53795                dlg.pre_request();
53796                let mut req_builder = hyper::Request::builder()
53797                    .method(hyper::Method::GET)
53798                    .uri(url.as_str())
53799                    .header(USER_AGENT, self.hub._user_agent.clone());
53800
53801                if let Some(token) = token.as_ref() {
53802                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
53803                }
53804
53805                let request = req_builder
53806                    .header(CONTENT_LENGTH, 0_u64)
53807                    .body(common::to_body::<String>(None));
53808
53809                client.request(request.unwrap()).await
53810            };
53811
53812            match req_result {
53813                Err(err) => {
53814                    if let common::Retry::After(d) = dlg.http_error(&err) {
53815                        sleep(d).await;
53816                        continue;
53817                    }
53818                    dlg.finished(false);
53819                    return Err(common::Error::HttpError(err));
53820                }
53821                Ok(res) => {
53822                    let (mut parts, body) = res.into_parts();
53823                    let mut body = common::Body::new(body);
53824                    if !parts.status.is_success() {
53825                        let bytes = common::to_bytes(body).await.unwrap_or_default();
53826                        let error = serde_json::from_str(&common::to_string(&bytes));
53827                        let response = common::to_response(parts, bytes.into());
53828
53829                        if let common::Retry::After(d) =
53830                            dlg.http_failure(&response, error.as_ref().ok())
53831                        {
53832                            sleep(d).await;
53833                            continue;
53834                        }
53835
53836                        dlg.finished(false);
53837
53838                        return Err(match error {
53839                            Ok(value) => common::Error::BadRequest(value),
53840                            _ => common::Error::Failure(response),
53841                        });
53842                    }
53843                    let response = {
53844                        let bytes = common::to_bytes(body).await.unwrap_or_default();
53845                        let encoded = common::to_string(&bytes);
53846                        match serde_json::from_str(&encoded) {
53847                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
53848                            Err(error) => {
53849                                dlg.response_json_decode_error(&encoded, &error);
53850                                return Err(common::Error::JsonDecodeError(
53851                                    encoded.to_string(),
53852                                    error,
53853                                ));
53854                            }
53855                        }
53856                    };
53857
53858                    dlg.finished(true);
53859                    return Ok(response);
53860                }
53861            }
53862        }
53863    }
53864
53865    /// User profile ID associated with this request.
53866    ///
53867    /// Sets the *profile id* path property to the given value.
53868    ///
53869    /// Even though the property as already been set when instantiating this call,
53870    /// we provide this method for API completeness.
53871    pub fn profile_id(mut self, new_value: i64) -> MetroListCall<'a, C> {
53872        self._profile_id = new_value;
53873        self
53874    }
53875    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
53876    /// while executing the actual API request.
53877    ///
53878    /// ````text
53879    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
53880    /// ````
53881    ///
53882    /// Sets the *delegate* property to the given value.
53883    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> MetroListCall<'a, C> {
53884        self._delegate = Some(new_value);
53885        self
53886    }
53887
53888    /// Set any additional parameter of the query string used in the request.
53889    /// It should be used to set parameters which are not yet available through their own
53890    /// setters.
53891    ///
53892    /// Please note that this method must not be used to set any of the known parameters
53893    /// which have their own setter method. If done anyway, the request will fail.
53894    ///
53895    /// # Additional Parameters
53896    ///
53897    /// * *$.xgafv* (query-string) - V1 error format.
53898    /// * *access_token* (query-string) - OAuth access token.
53899    /// * *alt* (query-string) - Data format for response.
53900    /// * *callback* (query-string) - JSONP
53901    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
53902    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
53903    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
53904    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
53905    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
53906    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
53907    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
53908    pub fn param<T>(mut self, name: T, value: T) -> MetroListCall<'a, C>
53909    where
53910        T: AsRef<str>,
53911    {
53912        self._additional_params
53913            .insert(name.as_ref().to_string(), value.as_ref().to_string());
53914        self
53915    }
53916
53917    /// Identifies the authorization scope for the method you are building.
53918    ///
53919    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
53920    /// [`Scope::Dfatrafficking`].
53921    ///
53922    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
53923    /// tokens for more than one scope.
53924    ///
53925    /// Usually there is more than one suitable scope to authorize an operation, some of which may
53926    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
53927    /// sufficient, a read-write scope will do as well.
53928    pub fn add_scope<St>(mut self, scope: St) -> MetroListCall<'a, C>
53929    where
53930        St: AsRef<str>,
53931    {
53932        self._scopes.insert(String::from(scope.as_ref()));
53933        self
53934    }
53935    /// Identifies the authorization scope(s) for the method you are building.
53936    ///
53937    /// See [`Self::add_scope()`] for details.
53938    pub fn add_scopes<I, St>(mut self, scopes: I) -> MetroListCall<'a, C>
53939    where
53940        I: IntoIterator<Item = St>,
53941        St: AsRef<str>,
53942    {
53943        self._scopes
53944            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
53945        self
53946    }
53947
53948    /// Removes all scopes, and no default scope will be used either.
53949    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
53950    /// for details).
53951    pub fn clear_scopes(mut self) -> MetroListCall<'a, C> {
53952        self._scopes.clear();
53953        self
53954    }
53955}
53956
53957/// Gets one mobile app by ID.
53958///
53959/// A builder for the *get* method supported by a *mobileApp* resource.
53960/// It is not used directly, but through a [`MobileAppMethods`] instance.
53961///
53962/// # Example
53963///
53964/// Instantiate a resource method builder
53965///
53966/// ```test_harness,no_run
53967/// # extern crate hyper;
53968/// # extern crate hyper_rustls;
53969/// # extern crate google_dfareporting3d3 as dfareporting3d3;
53970/// # async fn dox() {
53971/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
53972///
53973/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
53974/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
53975/// #     secret,
53976/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
53977/// # ).build().await.unwrap();
53978///
53979/// # let client = hyper_util::client::legacy::Client::builder(
53980/// #     hyper_util::rt::TokioExecutor::new()
53981/// # )
53982/// # .build(
53983/// #     hyper_rustls::HttpsConnectorBuilder::new()
53984/// #         .with_native_roots()
53985/// #         .unwrap()
53986/// #         .https_or_http()
53987/// #         .enable_http1()
53988/// #         .build()
53989/// # );
53990/// # let mut hub = Dfareporting::new(client, auth);
53991/// // You can configure optional parameters by calling the respective setters at will, and
53992/// // execute the final call using `doit()`.
53993/// // Values shown here are possibly random and not representative !
53994/// let result = hub.mobile_apps().get(-27, "id")
53995///              .doit().await;
53996/// # }
53997/// ```
53998pub struct MobileAppGetCall<'a, C>
53999where
54000    C: 'a,
54001{
54002    hub: &'a Dfareporting<C>,
54003    _profile_id: i64,
54004    _id: String,
54005    _delegate: Option<&'a mut dyn common::Delegate>,
54006    _additional_params: HashMap<String, String>,
54007    _scopes: BTreeSet<String>,
54008}
54009
54010impl<'a, C> common::CallBuilder for MobileAppGetCall<'a, C> {}
54011
54012impl<'a, C> MobileAppGetCall<'a, C>
54013where
54014    C: common::Connector,
54015{
54016    /// Perform the operation you have build so far.
54017    pub async fn doit(mut self) -> common::Result<(common::Response, MobileApp)> {
54018        use std::borrow::Cow;
54019        use std::io::{Read, Seek};
54020
54021        use common::{url::Params, ToParts};
54022        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
54023
54024        let mut dd = common::DefaultDelegate;
54025        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
54026        dlg.begin(common::MethodInfo {
54027            id: "dfareporting.mobileApps.get",
54028            http_method: hyper::Method::GET,
54029        });
54030
54031        for &field in ["alt", "profileId", "id"].iter() {
54032            if self._additional_params.contains_key(field) {
54033                dlg.finished(false);
54034                return Err(common::Error::FieldClash(field));
54035            }
54036        }
54037
54038        let mut params = Params::with_capacity(4 + self._additional_params.len());
54039        params.push("profileId", self._profile_id.to_string());
54040        params.push("id", self._id);
54041
54042        params.extend(self._additional_params.iter());
54043
54044        params.push("alt", "json");
54045        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/mobileApps/{id}";
54046        if self._scopes.is_empty() {
54047            self._scopes
54048                .insert(Scope::Dfatrafficking.as_ref().to_string());
54049        }
54050
54051        #[allow(clippy::single_element_loop)]
54052        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
54053            url = params.uri_replacement(url, param_name, find_this, false);
54054        }
54055        {
54056            let to_remove = ["id", "profileId"];
54057            params.remove_params(&to_remove);
54058        }
54059
54060        let url = params.parse_with_url(&url);
54061
54062        loop {
54063            let token = match self
54064                .hub
54065                .auth
54066                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
54067                .await
54068            {
54069                Ok(token) => token,
54070                Err(e) => match dlg.token(e) {
54071                    Ok(token) => token,
54072                    Err(e) => {
54073                        dlg.finished(false);
54074                        return Err(common::Error::MissingToken(e));
54075                    }
54076                },
54077            };
54078            let mut req_result = {
54079                let client = &self.hub.client;
54080                dlg.pre_request();
54081                let mut req_builder = hyper::Request::builder()
54082                    .method(hyper::Method::GET)
54083                    .uri(url.as_str())
54084                    .header(USER_AGENT, self.hub._user_agent.clone());
54085
54086                if let Some(token) = token.as_ref() {
54087                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
54088                }
54089
54090                let request = req_builder
54091                    .header(CONTENT_LENGTH, 0_u64)
54092                    .body(common::to_body::<String>(None));
54093
54094                client.request(request.unwrap()).await
54095            };
54096
54097            match req_result {
54098                Err(err) => {
54099                    if let common::Retry::After(d) = dlg.http_error(&err) {
54100                        sleep(d).await;
54101                        continue;
54102                    }
54103                    dlg.finished(false);
54104                    return Err(common::Error::HttpError(err));
54105                }
54106                Ok(res) => {
54107                    let (mut parts, body) = res.into_parts();
54108                    let mut body = common::Body::new(body);
54109                    if !parts.status.is_success() {
54110                        let bytes = common::to_bytes(body).await.unwrap_or_default();
54111                        let error = serde_json::from_str(&common::to_string(&bytes));
54112                        let response = common::to_response(parts, bytes.into());
54113
54114                        if let common::Retry::After(d) =
54115                            dlg.http_failure(&response, error.as_ref().ok())
54116                        {
54117                            sleep(d).await;
54118                            continue;
54119                        }
54120
54121                        dlg.finished(false);
54122
54123                        return Err(match error {
54124                            Ok(value) => common::Error::BadRequest(value),
54125                            _ => common::Error::Failure(response),
54126                        });
54127                    }
54128                    let response = {
54129                        let bytes = common::to_bytes(body).await.unwrap_or_default();
54130                        let encoded = common::to_string(&bytes);
54131                        match serde_json::from_str(&encoded) {
54132                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
54133                            Err(error) => {
54134                                dlg.response_json_decode_error(&encoded, &error);
54135                                return Err(common::Error::JsonDecodeError(
54136                                    encoded.to_string(),
54137                                    error,
54138                                ));
54139                            }
54140                        }
54141                    };
54142
54143                    dlg.finished(true);
54144                    return Ok(response);
54145                }
54146            }
54147        }
54148    }
54149
54150    /// User profile ID associated with this request.
54151    ///
54152    /// Sets the *profile id* path property to the given value.
54153    ///
54154    /// Even though the property as already been set when instantiating this call,
54155    /// we provide this method for API completeness.
54156    pub fn profile_id(mut self, new_value: i64) -> MobileAppGetCall<'a, C> {
54157        self._profile_id = new_value;
54158        self
54159    }
54160    /// Mobile app ID.
54161    ///
54162    /// Sets the *id* path property to the given value.
54163    ///
54164    /// Even though the property as already been set when instantiating this call,
54165    /// we provide this method for API completeness.
54166    pub fn id(mut self, new_value: &str) -> MobileAppGetCall<'a, C> {
54167        self._id = new_value.to_string();
54168        self
54169    }
54170    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
54171    /// while executing the actual API request.
54172    ///
54173    /// ````text
54174    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
54175    /// ````
54176    ///
54177    /// Sets the *delegate* property to the given value.
54178    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> MobileAppGetCall<'a, C> {
54179        self._delegate = Some(new_value);
54180        self
54181    }
54182
54183    /// Set any additional parameter of the query string used in the request.
54184    /// It should be used to set parameters which are not yet available through their own
54185    /// setters.
54186    ///
54187    /// Please note that this method must not be used to set any of the known parameters
54188    /// which have their own setter method. If done anyway, the request will fail.
54189    ///
54190    /// # Additional Parameters
54191    ///
54192    /// * *$.xgafv* (query-string) - V1 error format.
54193    /// * *access_token* (query-string) - OAuth access token.
54194    /// * *alt* (query-string) - Data format for response.
54195    /// * *callback* (query-string) - JSONP
54196    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
54197    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
54198    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
54199    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
54200    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
54201    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
54202    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
54203    pub fn param<T>(mut self, name: T, value: T) -> MobileAppGetCall<'a, C>
54204    where
54205        T: AsRef<str>,
54206    {
54207        self._additional_params
54208            .insert(name.as_ref().to_string(), value.as_ref().to_string());
54209        self
54210    }
54211
54212    /// Identifies the authorization scope for the method you are building.
54213    ///
54214    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
54215    /// [`Scope::Dfatrafficking`].
54216    ///
54217    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
54218    /// tokens for more than one scope.
54219    ///
54220    /// Usually there is more than one suitable scope to authorize an operation, some of which may
54221    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
54222    /// sufficient, a read-write scope will do as well.
54223    pub fn add_scope<St>(mut self, scope: St) -> MobileAppGetCall<'a, C>
54224    where
54225        St: AsRef<str>,
54226    {
54227        self._scopes.insert(String::from(scope.as_ref()));
54228        self
54229    }
54230    /// Identifies the authorization scope(s) for the method you are building.
54231    ///
54232    /// See [`Self::add_scope()`] for details.
54233    pub fn add_scopes<I, St>(mut self, scopes: I) -> MobileAppGetCall<'a, C>
54234    where
54235        I: IntoIterator<Item = St>,
54236        St: AsRef<str>,
54237    {
54238        self._scopes
54239            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
54240        self
54241    }
54242
54243    /// Removes all scopes, and no default scope will be used either.
54244    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
54245    /// for details).
54246    pub fn clear_scopes(mut self) -> MobileAppGetCall<'a, C> {
54247        self._scopes.clear();
54248        self
54249    }
54250}
54251
54252/// Retrieves list of available mobile apps.
54253///
54254/// A builder for the *list* method supported by a *mobileApp* resource.
54255/// It is not used directly, but through a [`MobileAppMethods`] instance.
54256///
54257/// # Example
54258///
54259/// Instantiate a resource method builder
54260///
54261/// ```test_harness,no_run
54262/// # extern crate hyper;
54263/// # extern crate hyper_rustls;
54264/// # extern crate google_dfareporting3d3 as dfareporting3d3;
54265/// # async fn dox() {
54266/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
54267///
54268/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
54269/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
54270/// #     secret,
54271/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
54272/// # ).build().await.unwrap();
54273///
54274/// # let client = hyper_util::client::legacy::Client::builder(
54275/// #     hyper_util::rt::TokioExecutor::new()
54276/// # )
54277/// # .build(
54278/// #     hyper_rustls::HttpsConnectorBuilder::new()
54279/// #         .with_native_roots()
54280/// #         .unwrap()
54281/// #         .https_or_http()
54282/// #         .enable_http1()
54283/// #         .build()
54284/// # );
54285/// # let mut hub = Dfareporting::new(client, auth);
54286/// // You can configure optional parameters by calling the respective setters at will, and
54287/// // execute the final call using `doit()`.
54288/// // Values shown here are possibly random and not representative !
54289/// let result = hub.mobile_apps().list(-59)
54290///              .search_string("gubergren")
54291///              .page_token("et")
54292///              .max_results(-88)
54293///              .add_ids("magna")
54294///              .add_directories("sit")
54295///              .doit().await;
54296/// # }
54297/// ```
54298pub struct MobileAppListCall<'a, C>
54299where
54300    C: 'a,
54301{
54302    hub: &'a Dfareporting<C>,
54303    _profile_id: i64,
54304    _search_string: Option<String>,
54305    _page_token: Option<String>,
54306    _max_results: Option<i32>,
54307    _ids: Vec<String>,
54308    _directories: Vec<String>,
54309    _delegate: Option<&'a mut dyn common::Delegate>,
54310    _additional_params: HashMap<String, String>,
54311    _scopes: BTreeSet<String>,
54312}
54313
54314impl<'a, C> common::CallBuilder for MobileAppListCall<'a, C> {}
54315
54316impl<'a, C> MobileAppListCall<'a, C>
54317where
54318    C: common::Connector,
54319{
54320    /// Perform the operation you have build so far.
54321    pub async fn doit(mut self) -> common::Result<(common::Response, MobileAppsListResponse)> {
54322        use std::borrow::Cow;
54323        use std::io::{Read, Seek};
54324
54325        use common::{url::Params, ToParts};
54326        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
54327
54328        let mut dd = common::DefaultDelegate;
54329        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
54330        dlg.begin(common::MethodInfo {
54331            id: "dfareporting.mobileApps.list",
54332            http_method: hyper::Method::GET,
54333        });
54334
54335        for &field in [
54336            "alt",
54337            "profileId",
54338            "searchString",
54339            "pageToken",
54340            "maxResults",
54341            "ids",
54342            "directories",
54343        ]
54344        .iter()
54345        {
54346            if self._additional_params.contains_key(field) {
54347                dlg.finished(false);
54348                return Err(common::Error::FieldClash(field));
54349            }
54350        }
54351
54352        let mut params = Params::with_capacity(8 + self._additional_params.len());
54353        params.push("profileId", self._profile_id.to_string());
54354        if let Some(value) = self._search_string.as_ref() {
54355            params.push("searchString", value);
54356        }
54357        if let Some(value) = self._page_token.as_ref() {
54358            params.push("pageToken", value);
54359        }
54360        if let Some(value) = self._max_results.as_ref() {
54361            params.push("maxResults", value.to_string());
54362        }
54363        if !self._ids.is_empty() {
54364            for f in self._ids.iter() {
54365                params.push("ids", f);
54366            }
54367        }
54368        if !self._directories.is_empty() {
54369            for f in self._directories.iter() {
54370                params.push("directories", f);
54371            }
54372        }
54373
54374        params.extend(self._additional_params.iter());
54375
54376        params.push("alt", "json");
54377        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/mobileApps";
54378        if self._scopes.is_empty() {
54379            self._scopes
54380                .insert(Scope::Dfatrafficking.as_ref().to_string());
54381        }
54382
54383        #[allow(clippy::single_element_loop)]
54384        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
54385            url = params.uri_replacement(url, param_name, find_this, false);
54386        }
54387        {
54388            let to_remove = ["profileId"];
54389            params.remove_params(&to_remove);
54390        }
54391
54392        let url = params.parse_with_url(&url);
54393
54394        loop {
54395            let token = match self
54396                .hub
54397                .auth
54398                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
54399                .await
54400            {
54401                Ok(token) => token,
54402                Err(e) => match dlg.token(e) {
54403                    Ok(token) => token,
54404                    Err(e) => {
54405                        dlg.finished(false);
54406                        return Err(common::Error::MissingToken(e));
54407                    }
54408                },
54409            };
54410            let mut req_result = {
54411                let client = &self.hub.client;
54412                dlg.pre_request();
54413                let mut req_builder = hyper::Request::builder()
54414                    .method(hyper::Method::GET)
54415                    .uri(url.as_str())
54416                    .header(USER_AGENT, self.hub._user_agent.clone());
54417
54418                if let Some(token) = token.as_ref() {
54419                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
54420                }
54421
54422                let request = req_builder
54423                    .header(CONTENT_LENGTH, 0_u64)
54424                    .body(common::to_body::<String>(None));
54425
54426                client.request(request.unwrap()).await
54427            };
54428
54429            match req_result {
54430                Err(err) => {
54431                    if let common::Retry::After(d) = dlg.http_error(&err) {
54432                        sleep(d).await;
54433                        continue;
54434                    }
54435                    dlg.finished(false);
54436                    return Err(common::Error::HttpError(err));
54437                }
54438                Ok(res) => {
54439                    let (mut parts, body) = res.into_parts();
54440                    let mut body = common::Body::new(body);
54441                    if !parts.status.is_success() {
54442                        let bytes = common::to_bytes(body).await.unwrap_or_default();
54443                        let error = serde_json::from_str(&common::to_string(&bytes));
54444                        let response = common::to_response(parts, bytes.into());
54445
54446                        if let common::Retry::After(d) =
54447                            dlg.http_failure(&response, error.as_ref().ok())
54448                        {
54449                            sleep(d).await;
54450                            continue;
54451                        }
54452
54453                        dlg.finished(false);
54454
54455                        return Err(match error {
54456                            Ok(value) => common::Error::BadRequest(value),
54457                            _ => common::Error::Failure(response),
54458                        });
54459                    }
54460                    let response = {
54461                        let bytes = common::to_bytes(body).await.unwrap_or_default();
54462                        let encoded = common::to_string(&bytes);
54463                        match serde_json::from_str(&encoded) {
54464                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
54465                            Err(error) => {
54466                                dlg.response_json_decode_error(&encoded, &error);
54467                                return Err(common::Error::JsonDecodeError(
54468                                    encoded.to_string(),
54469                                    error,
54470                                ));
54471                            }
54472                        }
54473                    };
54474
54475                    dlg.finished(true);
54476                    return Ok(response);
54477                }
54478            }
54479        }
54480    }
54481
54482    /// User profile ID associated with this request.
54483    ///
54484    /// Sets the *profile id* path property to the given value.
54485    ///
54486    /// Even though the property as already been set when instantiating this call,
54487    /// we provide this method for API completeness.
54488    pub fn profile_id(mut self, new_value: i64) -> MobileAppListCall<'a, C> {
54489        self._profile_id = new_value;
54490        self
54491    }
54492    /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "app*2015" will return objects with names like "app Jan 2018", "app Jan 2018", or simply "app 2018". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "app" will match objects with name "my app", "app 2018", or simply "app".
54493    ///
54494    /// Sets the *search string* query property to the given value.
54495    pub fn search_string(mut self, new_value: &str) -> MobileAppListCall<'a, C> {
54496        self._search_string = Some(new_value.to_string());
54497        self
54498    }
54499    /// Value of the nextPageToken from the previous result page.
54500    ///
54501    /// Sets the *page token* query property to the given value.
54502    pub fn page_token(mut self, new_value: &str) -> MobileAppListCall<'a, C> {
54503        self._page_token = Some(new_value.to_string());
54504        self
54505    }
54506    /// Maximum number of results to return.
54507    ///
54508    /// Sets the *max results* query property to the given value.
54509    pub fn max_results(mut self, new_value: i32) -> MobileAppListCall<'a, C> {
54510        self._max_results = Some(new_value);
54511        self
54512    }
54513    /// Select only apps with these IDs.
54514    ///
54515    /// Append the given value to the *ids* query property.
54516    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
54517    pub fn add_ids(mut self, new_value: &str) -> MobileAppListCall<'a, C> {
54518        self._ids.push(new_value.to_string());
54519        self
54520    }
54521    /// Select only apps from these directories.
54522    ///
54523    /// Append the given value to the *directories* query property.
54524    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
54525    pub fn add_directories(mut self, new_value: &str) -> MobileAppListCall<'a, C> {
54526        self._directories.push(new_value.to_string());
54527        self
54528    }
54529    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
54530    /// while executing the actual API request.
54531    ///
54532    /// ````text
54533    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
54534    /// ````
54535    ///
54536    /// Sets the *delegate* property to the given value.
54537    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> MobileAppListCall<'a, C> {
54538        self._delegate = Some(new_value);
54539        self
54540    }
54541
54542    /// Set any additional parameter of the query string used in the request.
54543    /// It should be used to set parameters which are not yet available through their own
54544    /// setters.
54545    ///
54546    /// Please note that this method must not be used to set any of the known parameters
54547    /// which have their own setter method. If done anyway, the request will fail.
54548    ///
54549    /// # Additional Parameters
54550    ///
54551    /// * *$.xgafv* (query-string) - V1 error format.
54552    /// * *access_token* (query-string) - OAuth access token.
54553    /// * *alt* (query-string) - Data format for response.
54554    /// * *callback* (query-string) - JSONP
54555    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
54556    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
54557    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
54558    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
54559    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
54560    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
54561    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
54562    pub fn param<T>(mut self, name: T, value: T) -> MobileAppListCall<'a, C>
54563    where
54564        T: AsRef<str>,
54565    {
54566        self._additional_params
54567            .insert(name.as_ref().to_string(), value.as_ref().to_string());
54568        self
54569    }
54570
54571    /// Identifies the authorization scope for the method you are building.
54572    ///
54573    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
54574    /// [`Scope::Dfatrafficking`].
54575    ///
54576    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
54577    /// tokens for more than one scope.
54578    ///
54579    /// Usually there is more than one suitable scope to authorize an operation, some of which may
54580    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
54581    /// sufficient, a read-write scope will do as well.
54582    pub fn add_scope<St>(mut self, scope: St) -> MobileAppListCall<'a, C>
54583    where
54584        St: AsRef<str>,
54585    {
54586        self._scopes.insert(String::from(scope.as_ref()));
54587        self
54588    }
54589    /// Identifies the authorization scope(s) for the method you are building.
54590    ///
54591    /// See [`Self::add_scope()`] for details.
54592    pub fn add_scopes<I, St>(mut self, scopes: I) -> MobileAppListCall<'a, C>
54593    where
54594        I: IntoIterator<Item = St>,
54595        St: AsRef<str>,
54596    {
54597        self._scopes
54598            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
54599        self
54600    }
54601
54602    /// Removes all scopes, and no default scope will be used either.
54603    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
54604    /// for details).
54605    pub fn clear_scopes(mut self) -> MobileAppListCall<'a, C> {
54606        self._scopes.clear();
54607        self
54608    }
54609}
54610
54611/// Gets one mobile carrier by ID.
54612///
54613/// A builder for the *get* method supported by a *mobileCarrier* resource.
54614/// It is not used directly, but through a [`MobileCarrierMethods`] instance.
54615///
54616/// # Example
54617///
54618/// Instantiate a resource method builder
54619///
54620/// ```test_harness,no_run
54621/// # extern crate hyper;
54622/// # extern crate hyper_rustls;
54623/// # extern crate google_dfareporting3d3 as dfareporting3d3;
54624/// # async fn dox() {
54625/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
54626///
54627/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
54628/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
54629/// #     secret,
54630/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
54631/// # ).build().await.unwrap();
54632///
54633/// # let client = hyper_util::client::legacy::Client::builder(
54634/// #     hyper_util::rt::TokioExecutor::new()
54635/// # )
54636/// # .build(
54637/// #     hyper_rustls::HttpsConnectorBuilder::new()
54638/// #         .with_native_roots()
54639/// #         .unwrap()
54640/// #         .https_or_http()
54641/// #         .enable_http1()
54642/// #         .build()
54643/// # );
54644/// # let mut hub = Dfareporting::new(client, auth);
54645/// // You can configure optional parameters by calling the respective setters at will, and
54646/// // execute the final call using `doit()`.
54647/// // Values shown here are possibly random and not representative !
54648/// let result = hub.mobile_carriers().get(-12, -94)
54649///              .doit().await;
54650/// # }
54651/// ```
54652pub struct MobileCarrierGetCall<'a, C>
54653where
54654    C: 'a,
54655{
54656    hub: &'a Dfareporting<C>,
54657    _profile_id: i64,
54658    _id: i64,
54659    _delegate: Option<&'a mut dyn common::Delegate>,
54660    _additional_params: HashMap<String, String>,
54661    _scopes: BTreeSet<String>,
54662}
54663
54664impl<'a, C> common::CallBuilder for MobileCarrierGetCall<'a, C> {}
54665
54666impl<'a, C> MobileCarrierGetCall<'a, C>
54667where
54668    C: common::Connector,
54669{
54670    /// Perform the operation you have build so far.
54671    pub async fn doit(mut self) -> common::Result<(common::Response, MobileCarrier)> {
54672        use std::borrow::Cow;
54673        use std::io::{Read, Seek};
54674
54675        use common::{url::Params, ToParts};
54676        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
54677
54678        let mut dd = common::DefaultDelegate;
54679        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
54680        dlg.begin(common::MethodInfo {
54681            id: "dfareporting.mobileCarriers.get",
54682            http_method: hyper::Method::GET,
54683        });
54684
54685        for &field in ["alt", "profileId", "id"].iter() {
54686            if self._additional_params.contains_key(field) {
54687                dlg.finished(false);
54688                return Err(common::Error::FieldClash(field));
54689            }
54690        }
54691
54692        let mut params = Params::with_capacity(4 + self._additional_params.len());
54693        params.push("profileId", self._profile_id.to_string());
54694        params.push("id", self._id.to_string());
54695
54696        params.extend(self._additional_params.iter());
54697
54698        params.push("alt", "json");
54699        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/mobileCarriers/{id}";
54700        if self._scopes.is_empty() {
54701            self._scopes
54702                .insert(Scope::Dfatrafficking.as_ref().to_string());
54703        }
54704
54705        #[allow(clippy::single_element_loop)]
54706        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
54707            url = params.uri_replacement(url, param_name, find_this, false);
54708        }
54709        {
54710            let to_remove = ["id", "profileId"];
54711            params.remove_params(&to_remove);
54712        }
54713
54714        let url = params.parse_with_url(&url);
54715
54716        loop {
54717            let token = match self
54718                .hub
54719                .auth
54720                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
54721                .await
54722            {
54723                Ok(token) => token,
54724                Err(e) => match dlg.token(e) {
54725                    Ok(token) => token,
54726                    Err(e) => {
54727                        dlg.finished(false);
54728                        return Err(common::Error::MissingToken(e));
54729                    }
54730                },
54731            };
54732            let mut req_result = {
54733                let client = &self.hub.client;
54734                dlg.pre_request();
54735                let mut req_builder = hyper::Request::builder()
54736                    .method(hyper::Method::GET)
54737                    .uri(url.as_str())
54738                    .header(USER_AGENT, self.hub._user_agent.clone());
54739
54740                if let Some(token) = token.as_ref() {
54741                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
54742                }
54743
54744                let request = req_builder
54745                    .header(CONTENT_LENGTH, 0_u64)
54746                    .body(common::to_body::<String>(None));
54747
54748                client.request(request.unwrap()).await
54749            };
54750
54751            match req_result {
54752                Err(err) => {
54753                    if let common::Retry::After(d) = dlg.http_error(&err) {
54754                        sleep(d).await;
54755                        continue;
54756                    }
54757                    dlg.finished(false);
54758                    return Err(common::Error::HttpError(err));
54759                }
54760                Ok(res) => {
54761                    let (mut parts, body) = res.into_parts();
54762                    let mut body = common::Body::new(body);
54763                    if !parts.status.is_success() {
54764                        let bytes = common::to_bytes(body).await.unwrap_or_default();
54765                        let error = serde_json::from_str(&common::to_string(&bytes));
54766                        let response = common::to_response(parts, bytes.into());
54767
54768                        if let common::Retry::After(d) =
54769                            dlg.http_failure(&response, error.as_ref().ok())
54770                        {
54771                            sleep(d).await;
54772                            continue;
54773                        }
54774
54775                        dlg.finished(false);
54776
54777                        return Err(match error {
54778                            Ok(value) => common::Error::BadRequest(value),
54779                            _ => common::Error::Failure(response),
54780                        });
54781                    }
54782                    let response = {
54783                        let bytes = common::to_bytes(body).await.unwrap_or_default();
54784                        let encoded = common::to_string(&bytes);
54785                        match serde_json::from_str(&encoded) {
54786                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
54787                            Err(error) => {
54788                                dlg.response_json_decode_error(&encoded, &error);
54789                                return Err(common::Error::JsonDecodeError(
54790                                    encoded.to_string(),
54791                                    error,
54792                                ));
54793                            }
54794                        }
54795                    };
54796
54797                    dlg.finished(true);
54798                    return Ok(response);
54799                }
54800            }
54801        }
54802    }
54803
54804    /// User profile ID associated with this request.
54805    ///
54806    /// Sets the *profile id* path property to the given value.
54807    ///
54808    /// Even though the property as already been set when instantiating this call,
54809    /// we provide this method for API completeness.
54810    pub fn profile_id(mut self, new_value: i64) -> MobileCarrierGetCall<'a, C> {
54811        self._profile_id = new_value;
54812        self
54813    }
54814    /// Mobile carrier ID.
54815    ///
54816    /// Sets the *id* path property to the given value.
54817    ///
54818    /// Even though the property as already been set when instantiating this call,
54819    /// we provide this method for API completeness.
54820    pub fn id(mut self, new_value: i64) -> MobileCarrierGetCall<'a, C> {
54821        self._id = new_value;
54822        self
54823    }
54824    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
54825    /// while executing the actual API request.
54826    ///
54827    /// ````text
54828    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
54829    /// ````
54830    ///
54831    /// Sets the *delegate* property to the given value.
54832    pub fn delegate(
54833        mut self,
54834        new_value: &'a mut dyn common::Delegate,
54835    ) -> MobileCarrierGetCall<'a, C> {
54836        self._delegate = Some(new_value);
54837        self
54838    }
54839
54840    /// Set any additional parameter of the query string used in the request.
54841    /// It should be used to set parameters which are not yet available through their own
54842    /// setters.
54843    ///
54844    /// Please note that this method must not be used to set any of the known parameters
54845    /// which have their own setter method. If done anyway, the request will fail.
54846    ///
54847    /// # Additional Parameters
54848    ///
54849    /// * *$.xgafv* (query-string) - V1 error format.
54850    /// * *access_token* (query-string) - OAuth access token.
54851    /// * *alt* (query-string) - Data format for response.
54852    /// * *callback* (query-string) - JSONP
54853    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
54854    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
54855    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
54856    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
54857    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
54858    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
54859    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
54860    pub fn param<T>(mut self, name: T, value: T) -> MobileCarrierGetCall<'a, C>
54861    where
54862        T: AsRef<str>,
54863    {
54864        self._additional_params
54865            .insert(name.as_ref().to_string(), value.as_ref().to_string());
54866        self
54867    }
54868
54869    /// Identifies the authorization scope for the method you are building.
54870    ///
54871    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
54872    /// [`Scope::Dfatrafficking`].
54873    ///
54874    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
54875    /// tokens for more than one scope.
54876    ///
54877    /// Usually there is more than one suitable scope to authorize an operation, some of which may
54878    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
54879    /// sufficient, a read-write scope will do as well.
54880    pub fn add_scope<St>(mut self, scope: St) -> MobileCarrierGetCall<'a, C>
54881    where
54882        St: AsRef<str>,
54883    {
54884        self._scopes.insert(String::from(scope.as_ref()));
54885        self
54886    }
54887    /// Identifies the authorization scope(s) for the method you are building.
54888    ///
54889    /// See [`Self::add_scope()`] for details.
54890    pub fn add_scopes<I, St>(mut self, scopes: I) -> MobileCarrierGetCall<'a, C>
54891    where
54892        I: IntoIterator<Item = St>,
54893        St: AsRef<str>,
54894    {
54895        self._scopes
54896            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
54897        self
54898    }
54899
54900    /// Removes all scopes, and no default scope will be used either.
54901    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
54902    /// for details).
54903    pub fn clear_scopes(mut self) -> MobileCarrierGetCall<'a, C> {
54904        self._scopes.clear();
54905        self
54906    }
54907}
54908
54909/// Retrieves a list of mobile carriers.
54910///
54911/// A builder for the *list* method supported by a *mobileCarrier* resource.
54912/// It is not used directly, but through a [`MobileCarrierMethods`] instance.
54913///
54914/// # Example
54915///
54916/// Instantiate a resource method builder
54917///
54918/// ```test_harness,no_run
54919/// # extern crate hyper;
54920/// # extern crate hyper_rustls;
54921/// # extern crate google_dfareporting3d3 as dfareporting3d3;
54922/// # async fn dox() {
54923/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
54924///
54925/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
54926/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
54927/// #     secret,
54928/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
54929/// # ).build().await.unwrap();
54930///
54931/// # let client = hyper_util::client::legacy::Client::builder(
54932/// #     hyper_util::rt::TokioExecutor::new()
54933/// # )
54934/// # .build(
54935/// #     hyper_rustls::HttpsConnectorBuilder::new()
54936/// #         .with_native_roots()
54937/// #         .unwrap()
54938/// #         .https_or_http()
54939/// #         .enable_http1()
54940/// #         .build()
54941/// # );
54942/// # let mut hub = Dfareporting::new(client, auth);
54943/// // You can configure optional parameters by calling the respective setters at will, and
54944/// // execute the final call using `doit()`.
54945/// // Values shown here are possibly random and not representative !
54946/// let result = hub.mobile_carriers().list(-50)
54947///              .doit().await;
54948/// # }
54949/// ```
54950pub struct MobileCarrierListCall<'a, C>
54951where
54952    C: 'a,
54953{
54954    hub: &'a Dfareporting<C>,
54955    _profile_id: i64,
54956    _delegate: Option<&'a mut dyn common::Delegate>,
54957    _additional_params: HashMap<String, String>,
54958    _scopes: BTreeSet<String>,
54959}
54960
54961impl<'a, C> common::CallBuilder for MobileCarrierListCall<'a, C> {}
54962
54963impl<'a, C> MobileCarrierListCall<'a, C>
54964where
54965    C: common::Connector,
54966{
54967    /// Perform the operation you have build so far.
54968    pub async fn doit(mut self) -> common::Result<(common::Response, MobileCarriersListResponse)> {
54969        use std::borrow::Cow;
54970        use std::io::{Read, Seek};
54971
54972        use common::{url::Params, ToParts};
54973        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
54974
54975        let mut dd = common::DefaultDelegate;
54976        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
54977        dlg.begin(common::MethodInfo {
54978            id: "dfareporting.mobileCarriers.list",
54979            http_method: hyper::Method::GET,
54980        });
54981
54982        for &field in ["alt", "profileId"].iter() {
54983            if self._additional_params.contains_key(field) {
54984                dlg.finished(false);
54985                return Err(common::Error::FieldClash(field));
54986            }
54987        }
54988
54989        let mut params = Params::with_capacity(3 + self._additional_params.len());
54990        params.push("profileId", self._profile_id.to_string());
54991
54992        params.extend(self._additional_params.iter());
54993
54994        params.push("alt", "json");
54995        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/mobileCarriers";
54996        if self._scopes.is_empty() {
54997            self._scopes
54998                .insert(Scope::Dfatrafficking.as_ref().to_string());
54999        }
55000
55001        #[allow(clippy::single_element_loop)]
55002        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
55003            url = params.uri_replacement(url, param_name, find_this, false);
55004        }
55005        {
55006            let to_remove = ["profileId"];
55007            params.remove_params(&to_remove);
55008        }
55009
55010        let url = params.parse_with_url(&url);
55011
55012        loop {
55013            let token = match self
55014                .hub
55015                .auth
55016                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
55017                .await
55018            {
55019                Ok(token) => token,
55020                Err(e) => match dlg.token(e) {
55021                    Ok(token) => token,
55022                    Err(e) => {
55023                        dlg.finished(false);
55024                        return Err(common::Error::MissingToken(e));
55025                    }
55026                },
55027            };
55028            let mut req_result = {
55029                let client = &self.hub.client;
55030                dlg.pre_request();
55031                let mut req_builder = hyper::Request::builder()
55032                    .method(hyper::Method::GET)
55033                    .uri(url.as_str())
55034                    .header(USER_AGENT, self.hub._user_agent.clone());
55035
55036                if let Some(token) = token.as_ref() {
55037                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
55038                }
55039
55040                let request = req_builder
55041                    .header(CONTENT_LENGTH, 0_u64)
55042                    .body(common::to_body::<String>(None));
55043
55044                client.request(request.unwrap()).await
55045            };
55046
55047            match req_result {
55048                Err(err) => {
55049                    if let common::Retry::After(d) = dlg.http_error(&err) {
55050                        sleep(d).await;
55051                        continue;
55052                    }
55053                    dlg.finished(false);
55054                    return Err(common::Error::HttpError(err));
55055                }
55056                Ok(res) => {
55057                    let (mut parts, body) = res.into_parts();
55058                    let mut body = common::Body::new(body);
55059                    if !parts.status.is_success() {
55060                        let bytes = common::to_bytes(body).await.unwrap_or_default();
55061                        let error = serde_json::from_str(&common::to_string(&bytes));
55062                        let response = common::to_response(parts, bytes.into());
55063
55064                        if let common::Retry::After(d) =
55065                            dlg.http_failure(&response, error.as_ref().ok())
55066                        {
55067                            sleep(d).await;
55068                            continue;
55069                        }
55070
55071                        dlg.finished(false);
55072
55073                        return Err(match error {
55074                            Ok(value) => common::Error::BadRequest(value),
55075                            _ => common::Error::Failure(response),
55076                        });
55077                    }
55078                    let response = {
55079                        let bytes = common::to_bytes(body).await.unwrap_or_default();
55080                        let encoded = common::to_string(&bytes);
55081                        match serde_json::from_str(&encoded) {
55082                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
55083                            Err(error) => {
55084                                dlg.response_json_decode_error(&encoded, &error);
55085                                return Err(common::Error::JsonDecodeError(
55086                                    encoded.to_string(),
55087                                    error,
55088                                ));
55089                            }
55090                        }
55091                    };
55092
55093                    dlg.finished(true);
55094                    return Ok(response);
55095                }
55096            }
55097        }
55098    }
55099
55100    /// User profile ID associated with this request.
55101    ///
55102    /// Sets the *profile id* path property to the given value.
55103    ///
55104    /// Even though the property as already been set when instantiating this call,
55105    /// we provide this method for API completeness.
55106    pub fn profile_id(mut self, new_value: i64) -> MobileCarrierListCall<'a, C> {
55107        self._profile_id = new_value;
55108        self
55109    }
55110    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
55111    /// while executing the actual API request.
55112    ///
55113    /// ````text
55114    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
55115    /// ````
55116    ///
55117    /// Sets the *delegate* property to the given value.
55118    pub fn delegate(
55119        mut self,
55120        new_value: &'a mut dyn common::Delegate,
55121    ) -> MobileCarrierListCall<'a, C> {
55122        self._delegate = Some(new_value);
55123        self
55124    }
55125
55126    /// Set any additional parameter of the query string used in the request.
55127    /// It should be used to set parameters which are not yet available through their own
55128    /// setters.
55129    ///
55130    /// Please note that this method must not be used to set any of the known parameters
55131    /// which have their own setter method. If done anyway, the request will fail.
55132    ///
55133    /// # Additional Parameters
55134    ///
55135    /// * *$.xgafv* (query-string) - V1 error format.
55136    /// * *access_token* (query-string) - OAuth access token.
55137    /// * *alt* (query-string) - Data format for response.
55138    /// * *callback* (query-string) - JSONP
55139    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
55140    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
55141    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
55142    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
55143    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
55144    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
55145    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
55146    pub fn param<T>(mut self, name: T, value: T) -> MobileCarrierListCall<'a, C>
55147    where
55148        T: AsRef<str>,
55149    {
55150        self._additional_params
55151            .insert(name.as_ref().to_string(), value.as_ref().to_string());
55152        self
55153    }
55154
55155    /// Identifies the authorization scope for the method you are building.
55156    ///
55157    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
55158    /// [`Scope::Dfatrafficking`].
55159    ///
55160    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
55161    /// tokens for more than one scope.
55162    ///
55163    /// Usually there is more than one suitable scope to authorize an operation, some of which may
55164    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
55165    /// sufficient, a read-write scope will do as well.
55166    pub fn add_scope<St>(mut self, scope: St) -> MobileCarrierListCall<'a, C>
55167    where
55168        St: AsRef<str>,
55169    {
55170        self._scopes.insert(String::from(scope.as_ref()));
55171        self
55172    }
55173    /// Identifies the authorization scope(s) for the method you are building.
55174    ///
55175    /// See [`Self::add_scope()`] for details.
55176    pub fn add_scopes<I, St>(mut self, scopes: I) -> MobileCarrierListCall<'a, C>
55177    where
55178        I: IntoIterator<Item = St>,
55179        St: AsRef<str>,
55180    {
55181        self._scopes
55182            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
55183        self
55184    }
55185
55186    /// Removes all scopes, and no default scope will be used either.
55187    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
55188    /// for details).
55189    pub fn clear_scopes(mut self) -> MobileCarrierListCall<'a, C> {
55190        self._scopes.clear();
55191        self
55192    }
55193}
55194
55195/// Gets one operating system version by ID.
55196///
55197/// A builder for the *get* method supported by a *operatingSystemVersion* resource.
55198/// It is not used directly, but through a [`OperatingSystemVersionMethods`] instance.
55199///
55200/// # Example
55201///
55202/// Instantiate a resource method builder
55203///
55204/// ```test_harness,no_run
55205/// # extern crate hyper;
55206/// # extern crate hyper_rustls;
55207/// # extern crate google_dfareporting3d3 as dfareporting3d3;
55208/// # async fn dox() {
55209/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
55210///
55211/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
55212/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
55213/// #     secret,
55214/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
55215/// # ).build().await.unwrap();
55216///
55217/// # let client = hyper_util::client::legacy::Client::builder(
55218/// #     hyper_util::rt::TokioExecutor::new()
55219/// # )
55220/// # .build(
55221/// #     hyper_rustls::HttpsConnectorBuilder::new()
55222/// #         .with_native_roots()
55223/// #         .unwrap()
55224/// #         .https_or_http()
55225/// #         .enable_http1()
55226/// #         .build()
55227/// # );
55228/// # let mut hub = Dfareporting::new(client, auth);
55229/// // You can configure optional parameters by calling the respective setters at will, and
55230/// // execute the final call using `doit()`.
55231/// // Values shown here are possibly random and not representative !
55232/// let result = hub.operating_system_versions().get(-13, -34)
55233///              .doit().await;
55234/// # }
55235/// ```
55236pub struct OperatingSystemVersionGetCall<'a, C>
55237where
55238    C: 'a,
55239{
55240    hub: &'a Dfareporting<C>,
55241    _profile_id: i64,
55242    _id: i64,
55243    _delegate: Option<&'a mut dyn common::Delegate>,
55244    _additional_params: HashMap<String, String>,
55245    _scopes: BTreeSet<String>,
55246}
55247
55248impl<'a, C> common::CallBuilder for OperatingSystemVersionGetCall<'a, C> {}
55249
55250impl<'a, C> OperatingSystemVersionGetCall<'a, C>
55251where
55252    C: common::Connector,
55253{
55254    /// Perform the operation you have build so far.
55255    pub async fn doit(mut self) -> common::Result<(common::Response, OperatingSystemVersion)> {
55256        use std::borrow::Cow;
55257        use std::io::{Read, Seek};
55258
55259        use common::{url::Params, ToParts};
55260        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
55261
55262        let mut dd = common::DefaultDelegate;
55263        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
55264        dlg.begin(common::MethodInfo {
55265            id: "dfareporting.operatingSystemVersions.get",
55266            http_method: hyper::Method::GET,
55267        });
55268
55269        for &field in ["alt", "profileId", "id"].iter() {
55270            if self._additional_params.contains_key(field) {
55271                dlg.finished(false);
55272                return Err(common::Error::FieldClash(field));
55273            }
55274        }
55275
55276        let mut params = Params::with_capacity(4 + self._additional_params.len());
55277        params.push("profileId", self._profile_id.to_string());
55278        params.push("id", self._id.to_string());
55279
55280        params.extend(self._additional_params.iter());
55281
55282        params.push("alt", "json");
55283        let mut url =
55284            self.hub._base_url.clone() + "userprofiles/{profileId}/operatingSystemVersions/{id}";
55285        if self._scopes.is_empty() {
55286            self._scopes
55287                .insert(Scope::Dfatrafficking.as_ref().to_string());
55288        }
55289
55290        #[allow(clippy::single_element_loop)]
55291        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
55292            url = params.uri_replacement(url, param_name, find_this, false);
55293        }
55294        {
55295            let to_remove = ["id", "profileId"];
55296            params.remove_params(&to_remove);
55297        }
55298
55299        let url = params.parse_with_url(&url);
55300
55301        loop {
55302            let token = match self
55303                .hub
55304                .auth
55305                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
55306                .await
55307            {
55308                Ok(token) => token,
55309                Err(e) => match dlg.token(e) {
55310                    Ok(token) => token,
55311                    Err(e) => {
55312                        dlg.finished(false);
55313                        return Err(common::Error::MissingToken(e));
55314                    }
55315                },
55316            };
55317            let mut req_result = {
55318                let client = &self.hub.client;
55319                dlg.pre_request();
55320                let mut req_builder = hyper::Request::builder()
55321                    .method(hyper::Method::GET)
55322                    .uri(url.as_str())
55323                    .header(USER_AGENT, self.hub._user_agent.clone());
55324
55325                if let Some(token) = token.as_ref() {
55326                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
55327                }
55328
55329                let request = req_builder
55330                    .header(CONTENT_LENGTH, 0_u64)
55331                    .body(common::to_body::<String>(None));
55332
55333                client.request(request.unwrap()).await
55334            };
55335
55336            match req_result {
55337                Err(err) => {
55338                    if let common::Retry::After(d) = dlg.http_error(&err) {
55339                        sleep(d).await;
55340                        continue;
55341                    }
55342                    dlg.finished(false);
55343                    return Err(common::Error::HttpError(err));
55344                }
55345                Ok(res) => {
55346                    let (mut parts, body) = res.into_parts();
55347                    let mut body = common::Body::new(body);
55348                    if !parts.status.is_success() {
55349                        let bytes = common::to_bytes(body).await.unwrap_or_default();
55350                        let error = serde_json::from_str(&common::to_string(&bytes));
55351                        let response = common::to_response(parts, bytes.into());
55352
55353                        if let common::Retry::After(d) =
55354                            dlg.http_failure(&response, error.as_ref().ok())
55355                        {
55356                            sleep(d).await;
55357                            continue;
55358                        }
55359
55360                        dlg.finished(false);
55361
55362                        return Err(match error {
55363                            Ok(value) => common::Error::BadRequest(value),
55364                            _ => common::Error::Failure(response),
55365                        });
55366                    }
55367                    let response = {
55368                        let bytes = common::to_bytes(body).await.unwrap_or_default();
55369                        let encoded = common::to_string(&bytes);
55370                        match serde_json::from_str(&encoded) {
55371                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
55372                            Err(error) => {
55373                                dlg.response_json_decode_error(&encoded, &error);
55374                                return Err(common::Error::JsonDecodeError(
55375                                    encoded.to_string(),
55376                                    error,
55377                                ));
55378                            }
55379                        }
55380                    };
55381
55382                    dlg.finished(true);
55383                    return Ok(response);
55384                }
55385            }
55386        }
55387    }
55388
55389    /// User profile ID associated with this request.
55390    ///
55391    /// Sets the *profile id* path property to the given value.
55392    ///
55393    /// Even though the property as already been set when instantiating this call,
55394    /// we provide this method for API completeness.
55395    pub fn profile_id(mut self, new_value: i64) -> OperatingSystemVersionGetCall<'a, C> {
55396        self._profile_id = new_value;
55397        self
55398    }
55399    /// Operating system version ID.
55400    ///
55401    /// Sets the *id* path property to the given value.
55402    ///
55403    /// Even though the property as already been set when instantiating this call,
55404    /// we provide this method for API completeness.
55405    pub fn id(mut self, new_value: i64) -> OperatingSystemVersionGetCall<'a, C> {
55406        self._id = new_value;
55407        self
55408    }
55409    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
55410    /// while executing the actual API request.
55411    ///
55412    /// ````text
55413    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
55414    /// ````
55415    ///
55416    /// Sets the *delegate* property to the given value.
55417    pub fn delegate(
55418        mut self,
55419        new_value: &'a mut dyn common::Delegate,
55420    ) -> OperatingSystemVersionGetCall<'a, C> {
55421        self._delegate = Some(new_value);
55422        self
55423    }
55424
55425    /// Set any additional parameter of the query string used in the request.
55426    /// It should be used to set parameters which are not yet available through their own
55427    /// setters.
55428    ///
55429    /// Please note that this method must not be used to set any of the known parameters
55430    /// which have their own setter method. If done anyway, the request will fail.
55431    ///
55432    /// # Additional Parameters
55433    ///
55434    /// * *$.xgafv* (query-string) - V1 error format.
55435    /// * *access_token* (query-string) - OAuth access token.
55436    /// * *alt* (query-string) - Data format for response.
55437    /// * *callback* (query-string) - JSONP
55438    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
55439    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
55440    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
55441    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
55442    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
55443    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
55444    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
55445    pub fn param<T>(mut self, name: T, value: T) -> OperatingSystemVersionGetCall<'a, C>
55446    where
55447        T: AsRef<str>,
55448    {
55449        self._additional_params
55450            .insert(name.as_ref().to_string(), value.as_ref().to_string());
55451        self
55452    }
55453
55454    /// Identifies the authorization scope for the method you are building.
55455    ///
55456    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
55457    /// [`Scope::Dfatrafficking`].
55458    ///
55459    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
55460    /// tokens for more than one scope.
55461    ///
55462    /// Usually there is more than one suitable scope to authorize an operation, some of which may
55463    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
55464    /// sufficient, a read-write scope will do as well.
55465    pub fn add_scope<St>(mut self, scope: St) -> OperatingSystemVersionGetCall<'a, C>
55466    where
55467        St: AsRef<str>,
55468    {
55469        self._scopes.insert(String::from(scope.as_ref()));
55470        self
55471    }
55472    /// Identifies the authorization scope(s) for the method you are building.
55473    ///
55474    /// See [`Self::add_scope()`] for details.
55475    pub fn add_scopes<I, St>(mut self, scopes: I) -> OperatingSystemVersionGetCall<'a, C>
55476    where
55477        I: IntoIterator<Item = St>,
55478        St: AsRef<str>,
55479    {
55480        self._scopes
55481            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
55482        self
55483    }
55484
55485    /// Removes all scopes, and no default scope will be used either.
55486    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
55487    /// for details).
55488    pub fn clear_scopes(mut self) -> OperatingSystemVersionGetCall<'a, C> {
55489        self._scopes.clear();
55490        self
55491    }
55492}
55493
55494/// Retrieves a list of operating system versions.
55495///
55496/// A builder for the *list* method supported by a *operatingSystemVersion* resource.
55497/// It is not used directly, but through a [`OperatingSystemVersionMethods`] instance.
55498///
55499/// # Example
55500///
55501/// Instantiate a resource method builder
55502///
55503/// ```test_harness,no_run
55504/// # extern crate hyper;
55505/// # extern crate hyper_rustls;
55506/// # extern crate google_dfareporting3d3 as dfareporting3d3;
55507/// # async fn dox() {
55508/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
55509///
55510/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
55511/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
55512/// #     secret,
55513/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
55514/// # ).build().await.unwrap();
55515///
55516/// # let client = hyper_util::client::legacy::Client::builder(
55517/// #     hyper_util::rt::TokioExecutor::new()
55518/// # )
55519/// # .build(
55520/// #     hyper_rustls::HttpsConnectorBuilder::new()
55521/// #         .with_native_roots()
55522/// #         .unwrap()
55523/// #         .https_or_http()
55524/// #         .enable_http1()
55525/// #         .build()
55526/// # );
55527/// # let mut hub = Dfareporting::new(client, auth);
55528/// // You can configure optional parameters by calling the respective setters at will, and
55529/// // execute the final call using `doit()`.
55530/// // Values shown here are possibly random and not representative !
55531/// let result = hub.operating_system_versions().list(-51)
55532///              .doit().await;
55533/// # }
55534/// ```
55535pub struct OperatingSystemVersionListCall<'a, C>
55536where
55537    C: 'a,
55538{
55539    hub: &'a Dfareporting<C>,
55540    _profile_id: i64,
55541    _delegate: Option<&'a mut dyn common::Delegate>,
55542    _additional_params: HashMap<String, String>,
55543    _scopes: BTreeSet<String>,
55544}
55545
55546impl<'a, C> common::CallBuilder for OperatingSystemVersionListCall<'a, C> {}
55547
55548impl<'a, C> OperatingSystemVersionListCall<'a, C>
55549where
55550    C: common::Connector,
55551{
55552    /// Perform the operation you have build so far.
55553    pub async fn doit(
55554        mut self,
55555    ) -> common::Result<(common::Response, OperatingSystemVersionsListResponse)> {
55556        use std::borrow::Cow;
55557        use std::io::{Read, Seek};
55558
55559        use common::{url::Params, ToParts};
55560        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
55561
55562        let mut dd = common::DefaultDelegate;
55563        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
55564        dlg.begin(common::MethodInfo {
55565            id: "dfareporting.operatingSystemVersions.list",
55566            http_method: hyper::Method::GET,
55567        });
55568
55569        for &field in ["alt", "profileId"].iter() {
55570            if self._additional_params.contains_key(field) {
55571                dlg.finished(false);
55572                return Err(common::Error::FieldClash(field));
55573            }
55574        }
55575
55576        let mut params = Params::with_capacity(3 + self._additional_params.len());
55577        params.push("profileId", self._profile_id.to_string());
55578
55579        params.extend(self._additional_params.iter());
55580
55581        params.push("alt", "json");
55582        let mut url =
55583            self.hub._base_url.clone() + "userprofiles/{profileId}/operatingSystemVersions";
55584        if self._scopes.is_empty() {
55585            self._scopes
55586                .insert(Scope::Dfatrafficking.as_ref().to_string());
55587        }
55588
55589        #[allow(clippy::single_element_loop)]
55590        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
55591            url = params.uri_replacement(url, param_name, find_this, false);
55592        }
55593        {
55594            let to_remove = ["profileId"];
55595            params.remove_params(&to_remove);
55596        }
55597
55598        let url = params.parse_with_url(&url);
55599
55600        loop {
55601            let token = match self
55602                .hub
55603                .auth
55604                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
55605                .await
55606            {
55607                Ok(token) => token,
55608                Err(e) => match dlg.token(e) {
55609                    Ok(token) => token,
55610                    Err(e) => {
55611                        dlg.finished(false);
55612                        return Err(common::Error::MissingToken(e));
55613                    }
55614                },
55615            };
55616            let mut req_result = {
55617                let client = &self.hub.client;
55618                dlg.pre_request();
55619                let mut req_builder = hyper::Request::builder()
55620                    .method(hyper::Method::GET)
55621                    .uri(url.as_str())
55622                    .header(USER_AGENT, self.hub._user_agent.clone());
55623
55624                if let Some(token) = token.as_ref() {
55625                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
55626                }
55627
55628                let request = req_builder
55629                    .header(CONTENT_LENGTH, 0_u64)
55630                    .body(common::to_body::<String>(None));
55631
55632                client.request(request.unwrap()).await
55633            };
55634
55635            match req_result {
55636                Err(err) => {
55637                    if let common::Retry::After(d) = dlg.http_error(&err) {
55638                        sleep(d).await;
55639                        continue;
55640                    }
55641                    dlg.finished(false);
55642                    return Err(common::Error::HttpError(err));
55643                }
55644                Ok(res) => {
55645                    let (mut parts, body) = res.into_parts();
55646                    let mut body = common::Body::new(body);
55647                    if !parts.status.is_success() {
55648                        let bytes = common::to_bytes(body).await.unwrap_or_default();
55649                        let error = serde_json::from_str(&common::to_string(&bytes));
55650                        let response = common::to_response(parts, bytes.into());
55651
55652                        if let common::Retry::After(d) =
55653                            dlg.http_failure(&response, error.as_ref().ok())
55654                        {
55655                            sleep(d).await;
55656                            continue;
55657                        }
55658
55659                        dlg.finished(false);
55660
55661                        return Err(match error {
55662                            Ok(value) => common::Error::BadRequest(value),
55663                            _ => common::Error::Failure(response),
55664                        });
55665                    }
55666                    let response = {
55667                        let bytes = common::to_bytes(body).await.unwrap_or_default();
55668                        let encoded = common::to_string(&bytes);
55669                        match serde_json::from_str(&encoded) {
55670                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
55671                            Err(error) => {
55672                                dlg.response_json_decode_error(&encoded, &error);
55673                                return Err(common::Error::JsonDecodeError(
55674                                    encoded.to_string(),
55675                                    error,
55676                                ));
55677                            }
55678                        }
55679                    };
55680
55681                    dlg.finished(true);
55682                    return Ok(response);
55683                }
55684            }
55685        }
55686    }
55687
55688    /// User profile ID associated with this request.
55689    ///
55690    /// Sets the *profile id* path property to the given value.
55691    ///
55692    /// Even though the property as already been set when instantiating this call,
55693    /// we provide this method for API completeness.
55694    pub fn profile_id(mut self, new_value: i64) -> OperatingSystemVersionListCall<'a, C> {
55695        self._profile_id = new_value;
55696        self
55697    }
55698    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
55699    /// while executing the actual API request.
55700    ///
55701    /// ````text
55702    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
55703    /// ````
55704    ///
55705    /// Sets the *delegate* property to the given value.
55706    pub fn delegate(
55707        mut self,
55708        new_value: &'a mut dyn common::Delegate,
55709    ) -> OperatingSystemVersionListCall<'a, C> {
55710        self._delegate = Some(new_value);
55711        self
55712    }
55713
55714    /// Set any additional parameter of the query string used in the request.
55715    /// It should be used to set parameters which are not yet available through their own
55716    /// setters.
55717    ///
55718    /// Please note that this method must not be used to set any of the known parameters
55719    /// which have their own setter method. If done anyway, the request will fail.
55720    ///
55721    /// # Additional Parameters
55722    ///
55723    /// * *$.xgafv* (query-string) - V1 error format.
55724    /// * *access_token* (query-string) - OAuth access token.
55725    /// * *alt* (query-string) - Data format for response.
55726    /// * *callback* (query-string) - JSONP
55727    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
55728    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
55729    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
55730    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
55731    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
55732    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
55733    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
55734    pub fn param<T>(mut self, name: T, value: T) -> OperatingSystemVersionListCall<'a, C>
55735    where
55736        T: AsRef<str>,
55737    {
55738        self._additional_params
55739            .insert(name.as_ref().to_string(), value.as_ref().to_string());
55740        self
55741    }
55742
55743    /// Identifies the authorization scope for the method you are building.
55744    ///
55745    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
55746    /// [`Scope::Dfatrafficking`].
55747    ///
55748    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
55749    /// tokens for more than one scope.
55750    ///
55751    /// Usually there is more than one suitable scope to authorize an operation, some of which may
55752    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
55753    /// sufficient, a read-write scope will do as well.
55754    pub fn add_scope<St>(mut self, scope: St) -> OperatingSystemVersionListCall<'a, C>
55755    where
55756        St: AsRef<str>,
55757    {
55758        self._scopes.insert(String::from(scope.as_ref()));
55759        self
55760    }
55761    /// Identifies the authorization scope(s) for the method you are building.
55762    ///
55763    /// See [`Self::add_scope()`] for details.
55764    pub fn add_scopes<I, St>(mut self, scopes: I) -> OperatingSystemVersionListCall<'a, C>
55765    where
55766        I: IntoIterator<Item = St>,
55767        St: AsRef<str>,
55768    {
55769        self._scopes
55770            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
55771        self
55772    }
55773
55774    /// Removes all scopes, and no default scope will be used either.
55775    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
55776    /// for details).
55777    pub fn clear_scopes(mut self) -> OperatingSystemVersionListCall<'a, C> {
55778        self._scopes.clear();
55779        self
55780    }
55781}
55782
55783/// Gets one operating system by DART ID.
55784///
55785/// A builder for the *get* method supported by a *operatingSystem* resource.
55786/// It is not used directly, but through a [`OperatingSystemMethods`] instance.
55787///
55788/// # Example
55789///
55790/// Instantiate a resource method builder
55791///
55792/// ```test_harness,no_run
55793/// # extern crate hyper;
55794/// # extern crate hyper_rustls;
55795/// # extern crate google_dfareporting3d3 as dfareporting3d3;
55796/// # async fn dox() {
55797/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
55798///
55799/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
55800/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
55801/// #     secret,
55802/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
55803/// # ).build().await.unwrap();
55804///
55805/// # let client = hyper_util::client::legacy::Client::builder(
55806/// #     hyper_util::rt::TokioExecutor::new()
55807/// # )
55808/// # .build(
55809/// #     hyper_rustls::HttpsConnectorBuilder::new()
55810/// #         .with_native_roots()
55811/// #         .unwrap()
55812/// #         .https_or_http()
55813/// #         .enable_http1()
55814/// #         .build()
55815/// # );
55816/// # let mut hub = Dfareporting::new(client, auth);
55817/// // You can configure optional parameters by calling the respective setters at will, and
55818/// // execute the final call using `doit()`.
55819/// // Values shown here are possibly random and not representative !
55820/// let result = hub.operating_systems().get(-97, -50)
55821///              .doit().await;
55822/// # }
55823/// ```
55824pub struct OperatingSystemGetCall<'a, C>
55825where
55826    C: 'a,
55827{
55828    hub: &'a Dfareporting<C>,
55829    _profile_id: i64,
55830    _dart_id: i64,
55831    _delegate: Option<&'a mut dyn common::Delegate>,
55832    _additional_params: HashMap<String, String>,
55833    _scopes: BTreeSet<String>,
55834}
55835
55836impl<'a, C> common::CallBuilder for OperatingSystemGetCall<'a, C> {}
55837
55838impl<'a, C> OperatingSystemGetCall<'a, C>
55839where
55840    C: common::Connector,
55841{
55842    /// Perform the operation you have build so far.
55843    pub async fn doit(mut self) -> common::Result<(common::Response, OperatingSystem)> {
55844        use std::borrow::Cow;
55845        use std::io::{Read, Seek};
55846
55847        use common::{url::Params, ToParts};
55848        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
55849
55850        let mut dd = common::DefaultDelegate;
55851        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
55852        dlg.begin(common::MethodInfo {
55853            id: "dfareporting.operatingSystems.get",
55854            http_method: hyper::Method::GET,
55855        });
55856
55857        for &field in ["alt", "profileId", "dartId"].iter() {
55858            if self._additional_params.contains_key(field) {
55859                dlg.finished(false);
55860                return Err(common::Error::FieldClash(field));
55861            }
55862        }
55863
55864        let mut params = Params::with_capacity(4 + self._additional_params.len());
55865        params.push("profileId", self._profile_id.to_string());
55866        params.push("dartId", self._dart_id.to_string());
55867
55868        params.extend(self._additional_params.iter());
55869
55870        params.push("alt", "json");
55871        let mut url =
55872            self.hub._base_url.clone() + "userprofiles/{profileId}/operatingSystems/{dartId}";
55873        if self._scopes.is_empty() {
55874            self._scopes
55875                .insert(Scope::Dfatrafficking.as_ref().to_string());
55876        }
55877
55878        #[allow(clippy::single_element_loop)]
55879        for &(find_this, param_name) in
55880            [("{profileId}", "profileId"), ("{dartId}", "dartId")].iter()
55881        {
55882            url = params.uri_replacement(url, param_name, find_this, false);
55883        }
55884        {
55885            let to_remove = ["dartId", "profileId"];
55886            params.remove_params(&to_remove);
55887        }
55888
55889        let url = params.parse_with_url(&url);
55890
55891        loop {
55892            let token = match self
55893                .hub
55894                .auth
55895                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
55896                .await
55897            {
55898                Ok(token) => token,
55899                Err(e) => match dlg.token(e) {
55900                    Ok(token) => token,
55901                    Err(e) => {
55902                        dlg.finished(false);
55903                        return Err(common::Error::MissingToken(e));
55904                    }
55905                },
55906            };
55907            let mut req_result = {
55908                let client = &self.hub.client;
55909                dlg.pre_request();
55910                let mut req_builder = hyper::Request::builder()
55911                    .method(hyper::Method::GET)
55912                    .uri(url.as_str())
55913                    .header(USER_AGENT, self.hub._user_agent.clone());
55914
55915                if let Some(token) = token.as_ref() {
55916                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
55917                }
55918
55919                let request = req_builder
55920                    .header(CONTENT_LENGTH, 0_u64)
55921                    .body(common::to_body::<String>(None));
55922
55923                client.request(request.unwrap()).await
55924            };
55925
55926            match req_result {
55927                Err(err) => {
55928                    if let common::Retry::After(d) = dlg.http_error(&err) {
55929                        sleep(d).await;
55930                        continue;
55931                    }
55932                    dlg.finished(false);
55933                    return Err(common::Error::HttpError(err));
55934                }
55935                Ok(res) => {
55936                    let (mut parts, body) = res.into_parts();
55937                    let mut body = common::Body::new(body);
55938                    if !parts.status.is_success() {
55939                        let bytes = common::to_bytes(body).await.unwrap_or_default();
55940                        let error = serde_json::from_str(&common::to_string(&bytes));
55941                        let response = common::to_response(parts, bytes.into());
55942
55943                        if let common::Retry::After(d) =
55944                            dlg.http_failure(&response, error.as_ref().ok())
55945                        {
55946                            sleep(d).await;
55947                            continue;
55948                        }
55949
55950                        dlg.finished(false);
55951
55952                        return Err(match error {
55953                            Ok(value) => common::Error::BadRequest(value),
55954                            _ => common::Error::Failure(response),
55955                        });
55956                    }
55957                    let response = {
55958                        let bytes = common::to_bytes(body).await.unwrap_or_default();
55959                        let encoded = common::to_string(&bytes);
55960                        match serde_json::from_str(&encoded) {
55961                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
55962                            Err(error) => {
55963                                dlg.response_json_decode_error(&encoded, &error);
55964                                return Err(common::Error::JsonDecodeError(
55965                                    encoded.to_string(),
55966                                    error,
55967                                ));
55968                            }
55969                        }
55970                    };
55971
55972                    dlg.finished(true);
55973                    return Ok(response);
55974                }
55975            }
55976        }
55977    }
55978
55979    /// User profile ID associated with this request.
55980    ///
55981    /// Sets the *profile id* path property to the given value.
55982    ///
55983    /// Even though the property as already been set when instantiating this call,
55984    /// we provide this method for API completeness.
55985    pub fn profile_id(mut self, new_value: i64) -> OperatingSystemGetCall<'a, C> {
55986        self._profile_id = new_value;
55987        self
55988    }
55989    /// Operating system DART ID.
55990    ///
55991    /// Sets the *dart id* path property to the given value.
55992    ///
55993    /// Even though the property as already been set when instantiating this call,
55994    /// we provide this method for API completeness.
55995    pub fn dart_id(mut self, new_value: i64) -> OperatingSystemGetCall<'a, C> {
55996        self._dart_id = new_value;
55997        self
55998    }
55999    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
56000    /// while executing the actual API request.
56001    ///
56002    /// ````text
56003    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
56004    /// ````
56005    ///
56006    /// Sets the *delegate* property to the given value.
56007    pub fn delegate(
56008        mut self,
56009        new_value: &'a mut dyn common::Delegate,
56010    ) -> OperatingSystemGetCall<'a, C> {
56011        self._delegate = Some(new_value);
56012        self
56013    }
56014
56015    /// Set any additional parameter of the query string used in the request.
56016    /// It should be used to set parameters which are not yet available through their own
56017    /// setters.
56018    ///
56019    /// Please note that this method must not be used to set any of the known parameters
56020    /// which have their own setter method. If done anyway, the request will fail.
56021    ///
56022    /// # Additional Parameters
56023    ///
56024    /// * *$.xgafv* (query-string) - V1 error format.
56025    /// * *access_token* (query-string) - OAuth access token.
56026    /// * *alt* (query-string) - Data format for response.
56027    /// * *callback* (query-string) - JSONP
56028    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
56029    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
56030    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
56031    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
56032    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
56033    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
56034    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
56035    pub fn param<T>(mut self, name: T, value: T) -> OperatingSystemGetCall<'a, C>
56036    where
56037        T: AsRef<str>,
56038    {
56039        self._additional_params
56040            .insert(name.as_ref().to_string(), value.as_ref().to_string());
56041        self
56042    }
56043
56044    /// Identifies the authorization scope for the method you are building.
56045    ///
56046    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
56047    /// [`Scope::Dfatrafficking`].
56048    ///
56049    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
56050    /// tokens for more than one scope.
56051    ///
56052    /// Usually there is more than one suitable scope to authorize an operation, some of which may
56053    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
56054    /// sufficient, a read-write scope will do as well.
56055    pub fn add_scope<St>(mut self, scope: St) -> OperatingSystemGetCall<'a, C>
56056    where
56057        St: AsRef<str>,
56058    {
56059        self._scopes.insert(String::from(scope.as_ref()));
56060        self
56061    }
56062    /// Identifies the authorization scope(s) for the method you are building.
56063    ///
56064    /// See [`Self::add_scope()`] for details.
56065    pub fn add_scopes<I, St>(mut self, scopes: I) -> OperatingSystemGetCall<'a, C>
56066    where
56067        I: IntoIterator<Item = St>,
56068        St: AsRef<str>,
56069    {
56070        self._scopes
56071            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
56072        self
56073    }
56074
56075    /// Removes all scopes, and no default scope will be used either.
56076    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
56077    /// for details).
56078    pub fn clear_scopes(mut self) -> OperatingSystemGetCall<'a, C> {
56079        self._scopes.clear();
56080        self
56081    }
56082}
56083
56084/// Retrieves a list of operating systems.
56085///
56086/// A builder for the *list* method supported by a *operatingSystem* resource.
56087/// It is not used directly, but through a [`OperatingSystemMethods`] instance.
56088///
56089/// # Example
56090///
56091/// Instantiate a resource method builder
56092///
56093/// ```test_harness,no_run
56094/// # extern crate hyper;
56095/// # extern crate hyper_rustls;
56096/// # extern crate google_dfareporting3d3 as dfareporting3d3;
56097/// # async fn dox() {
56098/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
56099///
56100/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
56101/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
56102/// #     secret,
56103/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
56104/// # ).build().await.unwrap();
56105///
56106/// # let client = hyper_util::client::legacy::Client::builder(
56107/// #     hyper_util::rt::TokioExecutor::new()
56108/// # )
56109/// # .build(
56110/// #     hyper_rustls::HttpsConnectorBuilder::new()
56111/// #         .with_native_roots()
56112/// #         .unwrap()
56113/// #         .https_or_http()
56114/// #         .enable_http1()
56115/// #         .build()
56116/// # );
56117/// # let mut hub = Dfareporting::new(client, auth);
56118/// // You can configure optional parameters by calling the respective setters at will, and
56119/// // execute the final call using `doit()`.
56120/// // Values shown here are possibly random and not representative !
56121/// let result = hub.operating_systems().list(-101)
56122///              .doit().await;
56123/// # }
56124/// ```
56125pub struct OperatingSystemListCall<'a, C>
56126where
56127    C: 'a,
56128{
56129    hub: &'a Dfareporting<C>,
56130    _profile_id: i64,
56131    _delegate: Option<&'a mut dyn common::Delegate>,
56132    _additional_params: HashMap<String, String>,
56133    _scopes: BTreeSet<String>,
56134}
56135
56136impl<'a, C> common::CallBuilder for OperatingSystemListCall<'a, C> {}
56137
56138impl<'a, C> OperatingSystemListCall<'a, C>
56139where
56140    C: common::Connector,
56141{
56142    /// Perform the operation you have build so far.
56143    pub async fn doit(
56144        mut self,
56145    ) -> common::Result<(common::Response, OperatingSystemsListResponse)> {
56146        use std::borrow::Cow;
56147        use std::io::{Read, Seek};
56148
56149        use common::{url::Params, ToParts};
56150        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
56151
56152        let mut dd = common::DefaultDelegate;
56153        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
56154        dlg.begin(common::MethodInfo {
56155            id: "dfareporting.operatingSystems.list",
56156            http_method: hyper::Method::GET,
56157        });
56158
56159        for &field in ["alt", "profileId"].iter() {
56160            if self._additional_params.contains_key(field) {
56161                dlg.finished(false);
56162                return Err(common::Error::FieldClash(field));
56163            }
56164        }
56165
56166        let mut params = Params::with_capacity(3 + self._additional_params.len());
56167        params.push("profileId", self._profile_id.to_string());
56168
56169        params.extend(self._additional_params.iter());
56170
56171        params.push("alt", "json");
56172        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/operatingSystems";
56173        if self._scopes.is_empty() {
56174            self._scopes
56175                .insert(Scope::Dfatrafficking.as_ref().to_string());
56176        }
56177
56178        #[allow(clippy::single_element_loop)]
56179        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
56180            url = params.uri_replacement(url, param_name, find_this, false);
56181        }
56182        {
56183            let to_remove = ["profileId"];
56184            params.remove_params(&to_remove);
56185        }
56186
56187        let url = params.parse_with_url(&url);
56188
56189        loop {
56190            let token = match self
56191                .hub
56192                .auth
56193                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
56194                .await
56195            {
56196                Ok(token) => token,
56197                Err(e) => match dlg.token(e) {
56198                    Ok(token) => token,
56199                    Err(e) => {
56200                        dlg.finished(false);
56201                        return Err(common::Error::MissingToken(e));
56202                    }
56203                },
56204            };
56205            let mut req_result = {
56206                let client = &self.hub.client;
56207                dlg.pre_request();
56208                let mut req_builder = hyper::Request::builder()
56209                    .method(hyper::Method::GET)
56210                    .uri(url.as_str())
56211                    .header(USER_AGENT, self.hub._user_agent.clone());
56212
56213                if let Some(token) = token.as_ref() {
56214                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
56215                }
56216
56217                let request = req_builder
56218                    .header(CONTENT_LENGTH, 0_u64)
56219                    .body(common::to_body::<String>(None));
56220
56221                client.request(request.unwrap()).await
56222            };
56223
56224            match req_result {
56225                Err(err) => {
56226                    if let common::Retry::After(d) = dlg.http_error(&err) {
56227                        sleep(d).await;
56228                        continue;
56229                    }
56230                    dlg.finished(false);
56231                    return Err(common::Error::HttpError(err));
56232                }
56233                Ok(res) => {
56234                    let (mut parts, body) = res.into_parts();
56235                    let mut body = common::Body::new(body);
56236                    if !parts.status.is_success() {
56237                        let bytes = common::to_bytes(body).await.unwrap_or_default();
56238                        let error = serde_json::from_str(&common::to_string(&bytes));
56239                        let response = common::to_response(parts, bytes.into());
56240
56241                        if let common::Retry::After(d) =
56242                            dlg.http_failure(&response, error.as_ref().ok())
56243                        {
56244                            sleep(d).await;
56245                            continue;
56246                        }
56247
56248                        dlg.finished(false);
56249
56250                        return Err(match error {
56251                            Ok(value) => common::Error::BadRequest(value),
56252                            _ => common::Error::Failure(response),
56253                        });
56254                    }
56255                    let response = {
56256                        let bytes = common::to_bytes(body).await.unwrap_or_default();
56257                        let encoded = common::to_string(&bytes);
56258                        match serde_json::from_str(&encoded) {
56259                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
56260                            Err(error) => {
56261                                dlg.response_json_decode_error(&encoded, &error);
56262                                return Err(common::Error::JsonDecodeError(
56263                                    encoded.to_string(),
56264                                    error,
56265                                ));
56266                            }
56267                        }
56268                    };
56269
56270                    dlg.finished(true);
56271                    return Ok(response);
56272                }
56273            }
56274        }
56275    }
56276
56277    /// User profile ID associated with this request.
56278    ///
56279    /// Sets the *profile id* path property to the given value.
56280    ///
56281    /// Even though the property as already been set when instantiating this call,
56282    /// we provide this method for API completeness.
56283    pub fn profile_id(mut self, new_value: i64) -> OperatingSystemListCall<'a, C> {
56284        self._profile_id = new_value;
56285        self
56286    }
56287    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
56288    /// while executing the actual API request.
56289    ///
56290    /// ````text
56291    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
56292    /// ````
56293    ///
56294    /// Sets the *delegate* property to the given value.
56295    pub fn delegate(
56296        mut self,
56297        new_value: &'a mut dyn common::Delegate,
56298    ) -> OperatingSystemListCall<'a, C> {
56299        self._delegate = Some(new_value);
56300        self
56301    }
56302
56303    /// Set any additional parameter of the query string used in the request.
56304    /// It should be used to set parameters which are not yet available through their own
56305    /// setters.
56306    ///
56307    /// Please note that this method must not be used to set any of the known parameters
56308    /// which have their own setter method. If done anyway, the request will fail.
56309    ///
56310    /// # Additional Parameters
56311    ///
56312    /// * *$.xgafv* (query-string) - V1 error format.
56313    /// * *access_token* (query-string) - OAuth access token.
56314    /// * *alt* (query-string) - Data format for response.
56315    /// * *callback* (query-string) - JSONP
56316    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
56317    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
56318    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
56319    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
56320    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
56321    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
56322    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
56323    pub fn param<T>(mut self, name: T, value: T) -> OperatingSystemListCall<'a, C>
56324    where
56325        T: AsRef<str>,
56326    {
56327        self._additional_params
56328            .insert(name.as_ref().to_string(), value.as_ref().to_string());
56329        self
56330    }
56331
56332    /// Identifies the authorization scope for the method you are building.
56333    ///
56334    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
56335    /// [`Scope::Dfatrafficking`].
56336    ///
56337    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
56338    /// tokens for more than one scope.
56339    ///
56340    /// Usually there is more than one suitable scope to authorize an operation, some of which may
56341    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
56342    /// sufficient, a read-write scope will do as well.
56343    pub fn add_scope<St>(mut self, scope: St) -> OperatingSystemListCall<'a, C>
56344    where
56345        St: AsRef<str>,
56346    {
56347        self._scopes.insert(String::from(scope.as_ref()));
56348        self
56349    }
56350    /// Identifies the authorization scope(s) for the method you are building.
56351    ///
56352    /// See [`Self::add_scope()`] for details.
56353    pub fn add_scopes<I, St>(mut self, scopes: I) -> OperatingSystemListCall<'a, C>
56354    where
56355        I: IntoIterator<Item = St>,
56356        St: AsRef<str>,
56357    {
56358        self._scopes
56359            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
56360        self
56361    }
56362
56363    /// Removes all scopes, and no default scope will be used either.
56364    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
56365    /// for details).
56366    pub fn clear_scopes(mut self) -> OperatingSystemListCall<'a, C> {
56367        self._scopes.clear();
56368        self
56369    }
56370}
56371
56372/// Gets one order document by ID.
56373///
56374/// A builder for the *get* method supported by a *orderDocument* resource.
56375/// It is not used directly, but through a [`OrderDocumentMethods`] instance.
56376///
56377/// # Example
56378///
56379/// Instantiate a resource method builder
56380///
56381/// ```test_harness,no_run
56382/// # extern crate hyper;
56383/// # extern crate hyper_rustls;
56384/// # extern crate google_dfareporting3d3 as dfareporting3d3;
56385/// # async fn dox() {
56386/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
56387///
56388/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
56389/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
56390/// #     secret,
56391/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
56392/// # ).build().await.unwrap();
56393///
56394/// # let client = hyper_util::client::legacy::Client::builder(
56395/// #     hyper_util::rt::TokioExecutor::new()
56396/// # )
56397/// # .build(
56398/// #     hyper_rustls::HttpsConnectorBuilder::new()
56399/// #         .with_native_roots()
56400/// #         .unwrap()
56401/// #         .https_or_http()
56402/// #         .enable_http1()
56403/// #         .build()
56404/// # );
56405/// # let mut hub = Dfareporting::new(client, auth);
56406/// // You can configure optional parameters by calling the respective setters at will, and
56407/// // execute the final call using `doit()`.
56408/// // Values shown here are possibly random and not representative !
56409/// let result = hub.order_documents().get(-19, -96, -15)
56410///              .doit().await;
56411/// # }
56412/// ```
56413pub struct OrderDocumentGetCall<'a, C>
56414where
56415    C: 'a,
56416{
56417    hub: &'a Dfareporting<C>,
56418    _profile_id: i64,
56419    _project_id: i64,
56420    _id: i64,
56421    _delegate: Option<&'a mut dyn common::Delegate>,
56422    _additional_params: HashMap<String, String>,
56423    _scopes: BTreeSet<String>,
56424}
56425
56426impl<'a, C> common::CallBuilder for OrderDocumentGetCall<'a, C> {}
56427
56428impl<'a, C> OrderDocumentGetCall<'a, C>
56429where
56430    C: common::Connector,
56431{
56432    /// Perform the operation you have build so far.
56433    pub async fn doit(mut self) -> common::Result<(common::Response, OrderDocument)> {
56434        use std::borrow::Cow;
56435        use std::io::{Read, Seek};
56436
56437        use common::{url::Params, ToParts};
56438        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
56439
56440        let mut dd = common::DefaultDelegate;
56441        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
56442        dlg.begin(common::MethodInfo {
56443            id: "dfareporting.orderDocuments.get",
56444            http_method: hyper::Method::GET,
56445        });
56446
56447        for &field in ["alt", "profileId", "projectId", "id"].iter() {
56448            if self._additional_params.contains_key(field) {
56449                dlg.finished(false);
56450                return Err(common::Error::FieldClash(field));
56451            }
56452        }
56453
56454        let mut params = Params::with_capacity(5 + self._additional_params.len());
56455        params.push("profileId", self._profile_id.to_string());
56456        params.push("projectId", self._project_id.to_string());
56457        params.push("id", self._id.to_string());
56458
56459        params.extend(self._additional_params.iter());
56460
56461        params.push("alt", "json");
56462        let mut url = self.hub._base_url.clone()
56463            + "userprofiles/{profileId}/projects/{projectId}/orderDocuments/{id}";
56464        if self._scopes.is_empty() {
56465            self._scopes
56466                .insert(Scope::Dfatrafficking.as_ref().to_string());
56467        }
56468
56469        #[allow(clippy::single_element_loop)]
56470        for &(find_this, param_name) in [
56471            ("{profileId}", "profileId"),
56472            ("{projectId}", "projectId"),
56473            ("{id}", "id"),
56474        ]
56475        .iter()
56476        {
56477            url = params.uri_replacement(url, param_name, find_this, false);
56478        }
56479        {
56480            let to_remove = ["id", "projectId", "profileId"];
56481            params.remove_params(&to_remove);
56482        }
56483
56484        let url = params.parse_with_url(&url);
56485
56486        loop {
56487            let token = match self
56488                .hub
56489                .auth
56490                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
56491                .await
56492            {
56493                Ok(token) => token,
56494                Err(e) => match dlg.token(e) {
56495                    Ok(token) => token,
56496                    Err(e) => {
56497                        dlg.finished(false);
56498                        return Err(common::Error::MissingToken(e));
56499                    }
56500                },
56501            };
56502            let mut req_result = {
56503                let client = &self.hub.client;
56504                dlg.pre_request();
56505                let mut req_builder = hyper::Request::builder()
56506                    .method(hyper::Method::GET)
56507                    .uri(url.as_str())
56508                    .header(USER_AGENT, self.hub._user_agent.clone());
56509
56510                if let Some(token) = token.as_ref() {
56511                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
56512                }
56513
56514                let request = req_builder
56515                    .header(CONTENT_LENGTH, 0_u64)
56516                    .body(common::to_body::<String>(None));
56517
56518                client.request(request.unwrap()).await
56519            };
56520
56521            match req_result {
56522                Err(err) => {
56523                    if let common::Retry::After(d) = dlg.http_error(&err) {
56524                        sleep(d).await;
56525                        continue;
56526                    }
56527                    dlg.finished(false);
56528                    return Err(common::Error::HttpError(err));
56529                }
56530                Ok(res) => {
56531                    let (mut parts, body) = res.into_parts();
56532                    let mut body = common::Body::new(body);
56533                    if !parts.status.is_success() {
56534                        let bytes = common::to_bytes(body).await.unwrap_or_default();
56535                        let error = serde_json::from_str(&common::to_string(&bytes));
56536                        let response = common::to_response(parts, bytes.into());
56537
56538                        if let common::Retry::After(d) =
56539                            dlg.http_failure(&response, error.as_ref().ok())
56540                        {
56541                            sleep(d).await;
56542                            continue;
56543                        }
56544
56545                        dlg.finished(false);
56546
56547                        return Err(match error {
56548                            Ok(value) => common::Error::BadRequest(value),
56549                            _ => common::Error::Failure(response),
56550                        });
56551                    }
56552                    let response = {
56553                        let bytes = common::to_bytes(body).await.unwrap_or_default();
56554                        let encoded = common::to_string(&bytes);
56555                        match serde_json::from_str(&encoded) {
56556                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
56557                            Err(error) => {
56558                                dlg.response_json_decode_error(&encoded, &error);
56559                                return Err(common::Error::JsonDecodeError(
56560                                    encoded.to_string(),
56561                                    error,
56562                                ));
56563                            }
56564                        }
56565                    };
56566
56567                    dlg.finished(true);
56568                    return Ok(response);
56569                }
56570            }
56571        }
56572    }
56573
56574    /// User profile ID associated with this request.
56575    ///
56576    /// Sets the *profile id* path property to the given value.
56577    ///
56578    /// Even though the property as already been set when instantiating this call,
56579    /// we provide this method for API completeness.
56580    pub fn profile_id(mut self, new_value: i64) -> OrderDocumentGetCall<'a, C> {
56581        self._profile_id = new_value;
56582        self
56583    }
56584    /// Project ID for order documents.
56585    ///
56586    /// Sets the *project id* path property to the given value.
56587    ///
56588    /// Even though the property as already been set when instantiating this call,
56589    /// we provide this method for API completeness.
56590    pub fn project_id(mut self, new_value: i64) -> OrderDocumentGetCall<'a, C> {
56591        self._project_id = new_value;
56592        self
56593    }
56594    /// Order document ID.
56595    ///
56596    /// Sets the *id* path property to the given value.
56597    ///
56598    /// Even though the property as already been set when instantiating this call,
56599    /// we provide this method for API completeness.
56600    pub fn id(mut self, new_value: i64) -> OrderDocumentGetCall<'a, C> {
56601        self._id = new_value;
56602        self
56603    }
56604    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
56605    /// while executing the actual API request.
56606    ///
56607    /// ````text
56608    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
56609    /// ````
56610    ///
56611    /// Sets the *delegate* property to the given value.
56612    pub fn delegate(
56613        mut self,
56614        new_value: &'a mut dyn common::Delegate,
56615    ) -> OrderDocumentGetCall<'a, C> {
56616        self._delegate = Some(new_value);
56617        self
56618    }
56619
56620    /// Set any additional parameter of the query string used in the request.
56621    /// It should be used to set parameters which are not yet available through their own
56622    /// setters.
56623    ///
56624    /// Please note that this method must not be used to set any of the known parameters
56625    /// which have their own setter method. If done anyway, the request will fail.
56626    ///
56627    /// # Additional Parameters
56628    ///
56629    /// * *$.xgafv* (query-string) - V1 error format.
56630    /// * *access_token* (query-string) - OAuth access token.
56631    /// * *alt* (query-string) - Data format for response.
56632    /// * *callback* (query-string) - JSONP
56633    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
56634    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
56635    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
56636    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
56637    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
56638    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
56639    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
56640    pub fn param<T>(mut self, name: T, value: T) -> OrderDocumentGetCall<'a, C>
56641    where
56642        T: AsRef<str>,
56643    {
56644        self._additional_params
56645            .insert(name.as_ref().to_string(), value.as_ref().to_string());
56646        self
56647    }
56648
56649    /// Identifies the authorization scope for the method you are building.
56650    ///
56651    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
56652    /// [`Scope::Dfatrafficking`].
56653    ///
56654    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
56655    /// tokens for more than one scope.
56656    ///
56657    /// Usually there is more than one suitable scope to authorize an operation, some of which may
56658    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
56659    /// sufficient, a read-write scope will do as well.
56660    pub fn add_scope<St>(mut self, scope: St) -> OrderDocumentGetCall<'a, C>
56661    where
56662        St: AsRef<str>,
56663    {
56664        self._scopes.insert(String::from(scope.as_ref()));
56665        self
56666    }
56667    /// Identifies the authorization scope(s) for the method you are building.
56668    ///
56669    /// See [`Self::add_scope()`] for details.
56670    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrderDocumentGetCall<'a, C>
56671    where
56672        I: IntoIterator<Item = St>,
56673        St: AsRef<str>,
56674    {
56675        self._scopes
56676            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
56677        self
56678    }
56679
56680    /// Removes all scopes, and no default scope will be used either.
56681    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
56682    /// for details).
56683    pub fn clear_scopes(mut self) -> OrderDocumentGetCall<'a, C> {
56684        self._scopes.clear();
56685        self
56686    }
56687}
56688
56689/// Retrieves a list of order documents, possibly filtered. This method supports paging.
56690///
56691/// A builder for the *list* method supported by a *orderDocument* resource.
56692/// It is not used directly, but through a [`OrderDocumentMethods`] instance.
56693///
56694/// # Example
56695///
56696/// Instantiate a resource method builder
56697///
56698/// ```test_harness,no_run
56699/// # extern crate hyper;
56700/// # extern crate hyper_rustls;
56701/// # extern crate google_dfareporting3d3 as dfareporting3d3;
56702/// # async fn dox() {
56703/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
56704///
56705/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
56706/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
56707/// #     secret,
56708/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
56709/// # ).build().await.unwrap();
56710///
56711/// # let client = hyper_util::client::legacy::Client::builder(
56712/// #     hyper_util::rt::TokioExecutor::new()
56713/// # )
56714/// # .build(
56715/// #     hyper_rustls::HttpsConnectorBuilder::new()
56716/// #         .with_native_roots()
56717/// #         .unwrap()
56718/// #         .https_or_http()
56719/// #         .enable_http1()
56720/// #         .build()
56721/// # );
56722/// # let mut hub = Dfareporting::new(client, auth);
56723/// // You can configure optional parameters by calling the respective setters at will, and
56724/// // execute the final call using `doit()`.
56725/// // Values shown here are possibly random and not representative !
56726/// let result = hub.order_documents().list(-23, -46)
56727///              .sort_order("takimata")
56728///              .sort_field("sed")
56729///              .add_site_id(-91)
56730///              .search_string("sea")
56731///              .page_token("eos")
56732///              .add_order_id(-34)
56733///              .max_results(-23)
56734///              .add_ids(-44)
56735///              .approved(false)
56736///              .doit().await;
56737/// # }
56738/// ```
56739pub struct OrderDocumentListCall<'a, C>
56740where
56741    C: 'a,
56742{
56743    hub: &'a Dfareporting<C>,
56744    _profile_id: i64,
56745    _project_id: i64,
56746    _sort_order: Option<String>,
56747    _sort_field: Option<String>,
56748    _site_id: Vec<i64>,
56749    _search_string: Option<String>,
56750    _page_token: Option<String>,
56751    _order_id: Vec<i64>,
56752    _max_results: Option<i32>,
56753    _ids: Vec<i64>,
56754    _approved: Option<bool>,
56755    _delegate: Option<&'a mut dyn common::Delegate>,
56756    _additional_params: HashMap<String, String>,
56757    _scopes: BTreeSet<String>,
56758}
56759
56760impl<'a, C> common::CallBuilder for OrderDocumentListCall<'a, C> {}
56761
56762impl<'a, C> OrderDocumentListCall<'a, C>
56763where
56764    C: common::Connector,
56765{
56766    /// Perform the operation you have build so far.
56767    pub async fn doit(mut self) -> common::Result<(common::Response, OrderDocumentsListResponse)> {
56768        use std::borrow::Cow;
56769        use std::io::{Read, Seek};
56770
56771        use common::{url::Params, ToParts};
56772        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
56773
56774        let mut dd = common::DefaultDelegate;
56775        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
56776        dlg.begin(common::MethodInfo {
56777            id: "dfareporting.orderDocuments.list",
56778            http_method: hyper::Method::GET,
56779        });
56780
56781        for &field in [
56782            "alt",
56783            "profileId",
56784            "projectId",
56785            "sortOrder",
56786            "sortField",
56787            "siteId",
56788            "searchString",
56789            "pageToken",
56790            "orderId",
56791            "maxResults",
56792            "ids",
56793            "approved",
56794        ]
56795        .iter()
56796        {
56797            if self._additional_params.contains_key(field) {
56798                dlg.finished(false);
56799                return Err(common::Error::FieldClash(field));
56800            }
56801        }
56802
56803        let mut params = Params::with_capacity(13 + self._additional_params.len());
56804        params.push("profileId", self._profile_id.to_string());
56805        params.push("projectId", self._project_id.to_string());
56806        if let Some(value) = self._sort_order.as_ref() {
56807            params.push("sortOrder", value);
56808        }
56809        if let Some(value) = self._sort_field.as_ref() {
56810            params.push("sortField", value);
56811        }
56812        if !self._site_id.is_empty() {
56813            for f in self._site_id.iter() {
56814                params.push("siteId", f.to_string());
56815            }
56816        }
56817        if let Some(value) = self._search_string.as_ref() {
56818            params.push("searchString", value);
56819        }
56820        if let Some(value) = self._page_token.as_ref() {
56821            params.push("pageToken", value);
56822        }
56823        if !self._order_id.is_empty() {
56824            for f in self._order_id.iter() {
56825                params.push("orderId", f.to_string());
56826            }
56827        }
56828        if let Some(value) = self._max_results.as_ref() {
56829            params.push("maxResults", value.to_string());
56830        }
56831        if !self._ids.is_empty() {
56832            for f in self._ids.iter() {
56833                params.push("ids", f.to_string());
56834            }
56835        }
56836        if let Some(value) = self._approved.as_ref() {
56837            params.push("approved", value.to_string());
56838        }
56839
56840        params.extend(self._additional_params.iter());
56841
56842        params.push("alt", "json");
56843        let mut url = self.hub._base_url.clone()
56844            + "userprofiles/{profileId}/projects/{projectId}/orderDocuments";
56845        if self._scopes.is_empty() {
56846            self._scopes
56847                .insert(Scope::Dfatrafficking.as_ref().to_string());
56848        }
56849
56850        #[allow(clippy::single_element_loop)]
56851        for &(find_this, param_name) in
56852            [("{profileId}", "profileId"), ("{projectId}", "projectId")].iter()
56853        {
56854            url = params.uri_replacement(url, param_name, find_this, false);
56855        }
56856        {
56857            let to_remove = ["projectId", "profileId"];
56858            params.remove_params(&to_remove);
56859        }
56860
56861        let url = params.parse_with_url(&url);
56862
56863        loop {
56864            let token = match self
56865                .hub
56866                .auth
56867                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
56868                .await
56869            {
56870                Ok(token) => token,
56871                Err(e) => match dlg.token(e) {
56872                    Ok(token) => token,
56873                    Err(e) => {
56874                        dlg.finished(false);
56875                        return Err(common::Error::MissingToken(e));
56876                    }
56877                },
56878            };
56879            let mut req_result = {
56880                let client = &self.hub.client;
56881                dlg.pre_request();
56882                let mut req_builder = hyper::Request::builder()
56883                    .method(hyper::Method::GET)
56884                    .uri(url.as_str())
56885                    .header(USER_AGENT, self.hub._user_agent.clone());
56886
56887                if let Some(token) = token.as_ref() {
56888                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
56889                }
56890
56891                let request = req_builder
56892                    .header(CONTENT_LENGTH, 0_u64)
56893                    .body(common::to_body::<String>(None));
56894
56895                client.request(request.unwrap()).await
56896            };
56897
56898            match req_result {
56899                Err(err) => {
56900                    if let common::Retry::After(d) = dlg.http_error(&err) {
56901                        sleep(d).await;
56902                        continue;
56903                    }
56904                    dlg.finished(false);
56905                    return Err(common::Error::HttpError(err));
56906                }
56907                Ok(res) => {
56908                    let (mut parts, body) = res.into_parts();
56909                    let mut body = common::Body::new(body);
56910                    if !parts.status.is_success() {
56911                        let bytes = common::to_bytes(body).await.unwrap_or_default();
56912                        let error = serde_json::from_str(&common::to_string(&bytes));
56913                        let response = common::to_response(parts, bytes.into());
56914
56915                        if let common::Retry::After(d) =
56916                            dlg.http_failure(&response, error.as_ref().ok())
56917                        {
56918                            sleep(d).await;
56919                            continue;
56920                        }
56921
56922                        dlg.finished(false);
56923
56924                        return Err(match error {
56925                            Ok(value) => common::Error::BadRequest(value),
56926                            _ => common::Error::Failure(response),
56927                        });
56928                    }
56929                    let response = {
56930                        let bytes = common::to_bytes(body).await.unwrap_or_default();
56931                        let encoded = common::to_string(&bytes);
56932                        match serde_json::from_str(&encoded) {
56933                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
56934                            Err(error) => {
56935                                dlg.response_json_decode_error(&encoded, &error);
56936                                return Err(common::Error::JsonDecodeError(
56937                                    encoded.to_string(),
56938                                    error,
56939                                ));
56940                            }
56941                        }
56942                    };
56943
56944                    dlg.finished(true);
56945                    return Ok(response);
56946                }
56947            }
56948        }
56949    }
56950
56951    /// User profile ID associated with this request.
56952    ///
56953    /// Sets the *profile id* path property to the given value.
56954    ///
56955    /// Even though the property as already been set when instantiating this call,
56956    /// we provide this method for API completeness.
56957    pub fn profile_id(mut self, new_value: i64) -> OrderDocumentListCall<'a, C> {
56958        self._profile_id = new_value;
56959        self
56960    }
56961    /// Project ID for order documents.
56962    ///
56963    /// Sets the *project id* path property to the given value.
56964    ///
56965    /// Even though the property as already been set when instantiating this call,
56966    /// we provide this method for API completeness.
56967    pub fn project_id(mut self, new_value: i64) -> OrderDocumentListCall<'a, C> {
56968        self._project_id = new_value;
56969        self
56970    }
56971    /// Order of sorted results.
56972    ///
56973    /// Sets the *sort order* query property to the given value.
56974    pub fn sort_order(mut self, new_value: &str) -> OrderDocumentListCall<'a, C> {
56975        self._sort_order = Some(new_value.to_string());
56976        self
56977    }
56978    /// Field by which to sort the list.
56979    ///
56980    /// Sets the *sort field* query property to the given value.
56981    pub fn sort_field(mut self, new_value: &str) -> OrderDocumentListCall<'a, C> {
56982        self._sort_field = Some(new_value.to_string());
56983        self
56984    }
56985    /// Select only order documents that are associated with these sites.
56986    ///
56987    /// Append the given value to the *site id* query property.
56988    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
56989    pub fn add_site_id(mut self, new_value: i64) -> OrderDocumentListCall<'a, C> {
56990        self._site_id.push(new_value);
56991        self
56992    }
56993    /// Allows searching for order documents by name or ID. Wildcards (*) are allowed. For example, "orderdocument*2015" will return order documents with names like "orderdocument June 2015", "orderdocument April 2015", or simply "orderdocument 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "orderdocument" will match order documents with name "my orderdocument", "orderdocument 2015", or simply "orderdocument".
56994    ///
56995    /// Sets the *search string* query property to the given value.
56996    pub fn search_string(mut self, new_value: &str) -> OrderDocumentListCall<'a, C> {
56997        self._search_string = Some(new_value.to_string());
56998        self
56999    }
57000    /// Value of the nextPageToken from the previous result page.
57001    ///
57002    /// Sets the *page token* query property to the given value.
57003    pub fn page_token(mut self, new_value: &str) -> OrderDocumentListCall<'a, C> {
57004        self._page_token = Some(new_value.to_string());
57005        self
57006    }
57007    /// Select only order documents for specified orders.
57008    ///
57009    /// Append the given value to the *order id* query property.
57010    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
57011    pub fn add_order_id(mut self, new_value: i64) -> OrderDocumentListCall<'a, C> {
57012        self._order_id.push(new_value);
57013        self
57014    }
57015    /// Maximum number of results to return.
57016    ///
57017    /// Sets the *max results* query property to the given value.
57018    pub fn max_results(mut self, new_value: i32) -> OrderDocumentListCall<'a, C> {
57019        self._max_results = Some(new_value);
57020        self
57021    }
57022    /// Select only order documents with these IDs.
57023    ///
57024    /// Append the given value to the *ids* query property.
57025    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
57026    pub fn add_ids(mut self, new_value: i64) -> OrderDocumentListCall<'a, C> {
57027        self._ids.push(new_value);
57028        self
57029    }
57030    /// Select only order documents that have been approved by at least one user.
57031    ///
57032    /// Sets the *approved* query property to the given value.
57033    pub fn approved(mut self, new_value: bool) -> OrderDocumentListCall<'a, C> {
57034        self._approved = Some(new_value);
57035        self
57036    }
57037    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
57038    /// while executing the actual API request.
57039    ///
57040    /// ````text
57041    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
57042    /// ````
57043    ///
57044    /// Sets the *delegate* property to the given value.
57045    pub fn delegate(
57046        mut self,
57047        new_value: &'a mut dyn common::Delegate,
57048    ) -> OrderDocumentListCall<'a, C> {
57049        self._delegate = Some(new_value);
57050        self
57051    }
57052
57053    /// Set any additional parameter of the query string used in the request.
57054    /// It should be used to set parameters which are not yet available through their own
57055    /// setters.
57056    ///
57057    /// Please note that this method must not be used to set any of the known parameters
57058    /// which have their own setter method. If done anyway, the request will fail.
57059    ///
57060    /// # Additional Parameters
57061    ///
57062    /// * *$.xgafv* (query-string) - V1 error format.
57063    /// * *access_token* (query-string) - OAuth access token.
57064    /// * *alt* (query-string) - Data format for response.
57065    /// * *callback* (query-string) - JSONP
57066    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
57067    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
57068    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
57069    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
57070    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
57071    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
57072    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
57073    pub fn param<T>(mut self, name: T, value: T) -> OrderDocumentListCall<'a, C>
57074    where
57075        T: AsRef<str>,
57076    {
57077        self._additional_params
57078            .insert(name.as_ref().to_string(), value.as_ref().to_string());
57079        self
57080    }
57081
57082    /// Identifies the authorization scope for the method you are building.
57083    ///
57084    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
57085    /// [`Scope::Dfatrafficking`].
57086    ///
57087    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
57088    /// tokens for more than one scope.
57089    ///
57090    /// Usually there is more than one suitable scope to authorize an operation, some of which may
57091    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
57092    /// sufficient, a read-write scope will do as well.
57093    pub fn add_scope<St>(mut self, scope: St) -> OrderDocumentListCall<'a, C>
57094    where
57095        St: AsRef<str>,
57096    {
57097        self._scopes.insert(String::from(scope.as_ref()));
57098        self
57099    }
57100    /// Identifies the authorization scope(s) for the method you are building.
57101    ///
57102    /// See [`Self::add_scope()`] for details.
57103    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrderDocumentListCall<'a, C>
57104    where
57105        I: IntoIterator<Item = St>,
57106        St: AsRef<str>,
57107    {
57108        self._scopes
57109            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
57110        self
57111    }
57112
57113    /// Removes all scopes, and no default scope will be used either.
57114    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
57115    /// for details).
57116    pub fn clear_scopes(mut self) -> OrderDocumentListCall<'a, C> {
57117        self._scopes.clear();
57118        self
57119    }
57120}
57121
57122/// Gets one order by ID.
57123///
57124/// A builder for the *get* method supported by a *order* resource.
57125/// It is not used directly, but through a [`OrderMethods`] instance.
57126///
57127/// # Example
57128///
57129/// Instantiate a resource method builder
57130///
57131/// ```test_harness,no_run
57132/// # extern crate hyper;
57133/// # extern crate hyper_rustls;
57134/// # extern crate google_dfareporting3d3 as dfareporting3d3;
57135/// # async fn dox() {
57136/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
57137///
57138/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
57139/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
57140/// #     secret,
57141/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
57142/// # ).build().await.unwrap();
57143///
57144/// # let client = hyper_util::client::legacy::Client::builder(
57145/// #     hyper_util::rt::TokioExecutor::new()
57146/// # )
57147/// # .build(
57148/// #     hyper_rustls::HttpsConnectorBuilder::new()
57149/// #         .with_native_roots()
57150/// #         .unwrap()
57151/// #         .https_or_http()
57152/// #         .enable_http1()
57153/// #         .build()
57154/// # );
57155/// # let mut hub = Dfareporting::new(client, auth);
57156/// // You can configure optional parameters by calling the respective setters at will, and
57157/// // execute the final call using `doit()`.
57158/// // Values shown here are possibly random and not representative !
57159/// let result = hub.orders().get(-90, -43, -27)
57160///              .doit().await;
57161/// # }
57162/// ```
57163pub struct OrderGetCall<'a, C>
57164where
57165    C: 'a,
57166{
57167    hub: &'a Dfareporting<C>,
57168    _profile_id: i64,
57169    _project_id: i64,
57170    _id: i64,
57171    _delegate: Option<&'a mut dyn common::Delegate>,
57172    _additional_params: HashMap<String, String>,
57173    _scopes: BTreeSet<String>,
57174}
57175
57176impl<'a, C> common::CallBuilder for OrderGetCall<'a, C> {}
57177
57178impl<'a, C> OrderGetCall<'a, C>
57179where
57180    C: common::Connector,
57181{
57182    /// Perform the operation you have build so far.
57183    pub async fn doit(mut self) -> common::Result<(common::Response, Order)> {
57184        use std::borrow::Cow;
57185        use std::io::{Read, Seek};
57186
57187        use common::{url::Params, ToParts};
57188        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
57189
57190        let mut dd = common::DefaultDelegate;
57191        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
57192        dlg.begin(common::MethodInfo {
57193            id: "dfareporting.orders.get",
57194            http_method: hyper::Method::GET,
57195        });
57196
57197        for &field in ["alt", "profileId", "projectId", "id"].iter() {
57198            if self._additional_params.contains_key(field) {
57199                dlg.finished(false);
57200                return Err(common::Error::FieldClash(field));
57201            }
57202        }
57203
57204        let mut params = Params::with_capacity(5 + self._additional_params.len());
57205        params.push("profileId", self._profile_id.to_string());
57206        params.push("projectId", self._project_id.to_string());
57207        params.push("id", self._id.to_string());
57208
57209        params.extend(self._additional_params.iter());
57210
57211        params.push("alt", "json");
57212        let mut url = self.hub._base_url.clone()
57213            + "userprofiles/{profileId}/projects/{projectId}/orders/{id}";
57214        if self._scopes.is_empty() {
57215            self._scopes
57216                .insert(Scope::Dfatrafficking.as_ref().to_string());
57217        }
57218
57219        #[allow(clippy::single_element_loop)]
57220        for &(find_this, param_name) in [
57221            ("{profileId}", "profileId"),
57222            ("{projectId}", "projectId"),
57223            ("{id}", "id"),
57224        ]
57225        .iter()
57226        {
57227            url = params.uri_replacement(url, param_name, find_this, false);
57228        }
57229        {
57230            let to_remove = ["id", "projectId", "profileId"];
57231            params.remove_params(&to_remove);
57232        }
57233
57234        let url = params.parse_with_url(&url);
57235
57236        loop {
57237            let token = match self
57238                .hub
57239                .auth
57240                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
57241                .await
57242            {
57243                Ok(token) => token,
57244                Err(e) => match dlg.token(e) {
57245                    Ok(token) => token,
57246                    Err(e) => {
57247                        dlg.finished(false);
57248                        return Err(common::Error::MissingToken(e));
57249                    }
57250                },
57251            };
57252            let mut req_result = {
57253                let client = &self.hub.client;
57254                dlg.pre_request();
57255                let mut req_builder = hyper::Request::builder()
57256                    .method(hyper::Method::GET)
57257                    .uri(url.as_str())
57258                    .header(USER_AGENT, self.hub._user_agent.clone());
57259
57260                if let Some(token) = token.as_ref() {
57261                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
57262                }
57263
57264                let request = req_builder
57265                    .header(CONTENT_LENGTH, 0_u64)
57266                    .body(common::to_body::<String>(None));
57267
57268                client.request(request.unwrap()).await
57269            };
57270
57271            match req_result {
57272                Err(err) => {
57273                    if let common::Retry::After(d) = dlg.http_error(&err) {
57274                        sleep(d).await;
57275                        continue;
57276                    }
57277                    dlg.finished(false);
57278                    return Err(common::Error::HttpError(err));
57279                }
57280                Ok(res) => {
57281                    let (mut parts, body) = res.into_parts();
57282                    let mut body = common::Body::new(body);
57283                    if !parts.status.is_success() {
57284                        let bytes = common::to_bytes(body).await.unwrap_or_default();
57285                        let error = serde_json::from_str(&common::to_string(&bytes));
57286                        let response = common::to_response(parts, bytes.into());
57287
57288                        if let common::Retry::After(d) =
57289                            dlg.http_failure(&response, error.as_ref().ok())
57290                        {
57291                            sleep(d).await;
57292                            continue;
57293                        }
57294
57295                        dlg.finished(false);
57296
57297                        return Err(match error {
57298                            Ok(value) => common::Error::BadRequest(value),
57299                            _ => common::Error::Failure(response),
57300                        });
57301                    }
57302                    let response = {
57303                        let bytes = common::to_bytes(body).await.unwrap_or_default();
57304                        let encoded = common::to_string(&bytes);
57305                        match serde_json::from_str(&encoded) {
57306                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
57307                            Err(error) => {
57308                                dlg.response_json_decode_error(&encoded, &error);
57309                                return Err(common::Error::JsonDecodeError(
57310                                    encoded.to_string(),
57311                                    error,
57312                                ));
57313                            }
57314                        }
57315                    };
57316
57317                    dlg.finished(true);
57318                    return Ok(response);
57319                }
57320            }
57321        }
57322    }
57323
57324    /// User profile ID associated with this request.
57325    ///
57326    /// Sets the *profile id* path property to the given value.
57327    ///
57328    /// Even though the property as already been set when instantiating this call,
57329    /// we provide this method for API completeness.
57330    pub fn profile_id(mut self, new_value: i64) -> OrderGetCall<'a, C> {
57331        self._profile_id = new_value;
57332        self
57333    }
57334    /// Project ID for orders.
57335    ///
57336    /// Sets the *project id* path property to the given value.
57337    ///
57338    /// Even though the property as already been set when instantiating this call,
57339    /// we provide this method for API completeness.
57340    pub fn project_id(mut self, new_value: i64) -> OrderGetCall<'a, C> {
57341        self._project_id = new_value;
57342        self
57343    }
57344    /// Order ID.
57345    ///
57346    /// Sets the *id* path property to the given value.
57347    ///
57348    /// Even though the property as already been set when instantiating this call,
57349    /// we provide this method for API completeness.
57350    pub fn id(mut self, new_value: i64) -> OrderGetCall<'a, C> {
57351        self._id = new_value;
57352        self
57353    }
57354    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
57355    /// while executing the actual API request.
57356    ///
57357    /// ````text
57358    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
57359    /// ````
57360    ///
57361    /// Sets the *delegate* property to the given value.
57362    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> OrderGetCall<'a, C> {
57363        self._delegate = Some(new_value);
57364        self
57365    }
57366
57367    /// Set any additional parameter of the query string used in the request.
57368    /// It should be used to set parameters which are not yet available through their own
57369    /// setters.
57370    ///
57371    /// Please note that this method must not be used to set any of the known parameters
57372    /// which have their own setter method. If done anyway, the request will fail.
57373    ///
57374    /// # Additional Parameters
57375    ///
57376    /// * *$.xgafv* (query-string) - V1 error format.
57377    /// * *access_token* (query-string) - OAuth access token.
57378    /// * *alt* (query-string) - Data format for response.
57379    /// * *callback* (query-string) - JSONP
57380    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
57381    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
57382    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
57383    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
57384    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
57385    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
57386    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
57387    pub fn param<T>(mut self, name: T, value: T) -> OrderGetCall<'a, C>
57388    where
57389        T: AsRef<str>,
57390    {
57391        self._additional_params
57392            .insert(name.as_ref().to_string(), value.as_ref().to_string());
57393        self
57394    }
57395
57396    /// Identifies the authorization scope for the method you are building.
57397    ///
57398    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
57399    /// [`Scope::Dfatrafficking`].
57400    ///
57401    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
57402    /// tokens for more than one scope.
57403    ///
57404    /// Usually there is more than one suitable scope to authorize an operation, some of which may
57405    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
57406    /// sufficient, a read-write scope will do as well.
57407    pub fn add_scope<St>(mut self, scope: St) -> OrderGetCall<'a, C>
57408    where
57409        St: AsRef<str>,
57410    {
57411        self._scopes.insert(String::from(scope.as_ref()));
57412        self
57413    }
57414    /// Identifies the authorization scope(s) for the method you are building.
57415    ///
57416    /// See [`Self::add_scope()`] for details.
57417    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrderGetCall<'a, C>
57418    where
57419        I: IntoIterator<Item = St>,
57420        St: AsRef<str>,
57421    {
57422        self._scopes
57423            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
57424        self
57425    }
57426
57427    /// Removes all scopes, and no default scope will be used either.
57428    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
57429    /// for details).
57430    pub fn clear_scopes(mut self) -> OrderGetCall<'a, C> {
57431        self._scopes.clear();
57432        self
57433    }
57434}
57435
57436/// Retrieves a list of orders, possibly filtered. This method supports paging.
57437///
57438/// A builder for the *list* method supported by a *order* resource.
57439/// It is not used directly, but through a [`OrderMethods`] instance.
57440///
57441/// # Example
57442///
57443/// Instantiate a resource method builder
57444///
57445/// ```test_harness,no_run
57446/// # extern crate hyper;
57447/// # extern crate hyper_rustls;
57448/// # extern crate google_dfareporting3d3 as dfareporting3d3;
57449/// # async fn dox() {
57450/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
57451///
57452/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
57453/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
57454/// #     secret,
57455/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
57456/// # ).build().await.unwrap();
57457///
57458/// # let client = hyper_util::client::legacy::Client::builder(
57459/// #     hyper_util::rt::TokioExecutor::new()
57460/// # )
57461/// # .build(
57462/// #     hyper_rustls::HttpsConnectorBuilder::new()
57463/// #         .with_native_roots()
57464/// #         .unwrap()
57465/// #         .https_or_http()
57466/// #         .enable_http1()
57467/// #         .build()
57468/// # );
57469/// # let mut hub = Dfareporting::new(client, auth);
57470/// // You can configure optional parameters by calling the respective setters at will, and
57471/// // execute the final call using `doit()`.
57472/// // Values shown here are possibly random and not representative !
57473/// let result = hub.orders().list(-15, -3)
57474///              .sort_order("ipsum")
57475///              .sort_field("Lorem")
57476///              .add_site_id(-54)
57477///              .search_string("amet")
57478///              .page_token("magna")
57479///              .max_results(-83)
57480///              .add_ids(-88)
57481///              .doit().await;
57482/// # }
57483/// ```
57484pub struct OrderListCall<'a, C>
57485where
57486    C: 'a,
57487{
57488    hub: &'a Dfareporting<C>,
57489    _profile_id: i64,
57490    _project_id: i64,
57491    _sort_order: Option<String>,
57492    _sort_field: Option<String>,
57493    _site_id: Vec<i64>,
57494    _search_string: Option<String>,
57495    _page_token: Option<String>,
57496    _max_results: Option<i32>,
57497    _ids: Vec<i64>,
57498    _delegate: Option<&'a mut dyn common::Delegate>,
57499    _additional_params: HashMap<String, String>,
57500    _scopes: BTreeSet<String>,
57501}
57502
57503impl<'a, C> common::CallBuilder for OrderListCall<'a, C> {}
57504
57505impl<'a, C> OrderListCall<'a, C>
57506where
57507    C: common::Connector,
57508{
57509    /// Perform the operation you have build so far.
57510    pub async fn doit(mut self) -> common::Result<(common::Response, OrdersListResponse)> {
57511        use std::borrow::Cow;
57512        use std::io::{Read, Seek};
57513
57514        use common::{url::Params, ToParts};
57515        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
57516
57517        let mut dd = common::DefaultDelegate;
57518        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
57519        dlg.begin(common::MethodInfo {
57520            id: "dfareporting.orders.list",
57521            http_method: hyper::Method::GET,
57522        });
57523
57524        for &field in [
57525            "alt",
57526            "profileId",
57527            "projectId",
57528            "sortOrder",
57529            "sortField",
57530            "siteId",
57531            "searchString",
57532            "pageToken",
57533            "maxResults",
57534            "ids",
57535        ]
57536        .iter()
57537        {
57538            if self._additional_params.contains_key(field) {
57539                dlg.finished(false);
57540                return Err(common::Error::FieldClash(field));
57541            }
57542        }
57543
57544        let mut params = Params::with_capacity(11 + self._additional_params.len());
57545        params.push("profileId", self._profile_id.to_string());
57546        params.push("projectId", self._project_id.to_string());
57547        if let Some(value) = self._sort_order.as_ref() {
57548            params.push("sortOrder", value);
57549        }
57550        if let Some(value) = self._sort_field.as_ref() {
57551            params.push("sortField", value);
57552        }
57553        if !self._site_id.is_empty() {
57554            for f in self._site_id.iter() {
57555                params.push("siteId", f.to_string());
57556            }
57557        }
57558        if let Some(value) = self._search_string.as_ref() {
57559            params.push("searchString", value);
57560        }
57561        if let Some(value) = self._page_token.as_ref() {
57562            params.push("pageToken", value);
57563        }
57564        if let Some(value) = self._max_results.as_ref() {
57565            params.push("maxResults", value.to_string());
57566        }
57567        if !self._ids.is_empty() {
57568            for f in self._ids.iter() {
57569                params.push("ids", f.to_string());
57570            }
57571        }
57572
57573        params.extend(self._additional_params.iter());
57574
57575        params.push("alt", "json");
57576        let mut url =
57577            self.hub._base_url.clone() + "userprofiles/{profileId}/projects/{projectId}/orders";
57578        if self._scopes.is_empty() {
57579            self._scopes
57580                .insert(Scope::Dfatrafficking.as_ref().to_string());
57581        }
57582
57583        #[allow(clippy::single_element_loop)]
57584        for &(find_this, param_name) in
57585            [("{profileId}", "profileId"), ("{projectId}", "projectId")].iter()
57586        {
57587            url = params.uri_replacement(url, param_name, find_this, false);
57588        }
57589        {
57590            let to_remove = ["projectId", "profileId"];
57591            params.remove_params(&to_remove);
57592        }
57593
57594        let url = params.parse_with_url(&url);
57595
57596        loop {
57597            let token = match self
57598                .hub
57599                .auth
57600                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
57601                .await
57602            {
57603                Ok(token) => token,
57604                Err(e) => match dlg.token(e) {
57605                    Ok(token) => token,
57606                    Err(e) => {
57607                        dlg.finished(false);
57608                        return Err(common::Error::MissingToken(e));
57609                    }
57610                },
57611            };
57612            let mut req_result = {
57613                let client = &self.hub.client;
57614                dlg.pre_request();
57615                let mut req_builder = hyper::Request::builder()
57616                    .method(hyper::Method::GET)
57617                    .uri(url.as_str())
57618                    .header(USER_AGENT, self.hub._user_agent.clone());
57619
57620                if let Some(token) = token.as_ref() {
57621                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
57622                }
57623
57624                let request = req_builder
57625                    .header(CONTENT_LENGTH, 0_u64)
57626                    .body(common::to_body::<String>(None));
57627
57628                client.request(request.unwrap()).await
57629            };
57630
57631            match req_result {
57632                Err(err) => {
57633                    if let common::Retry::After(d) = dlg.http_error(&err) {
57634                        sleep(d).await;
57635                        continue;
57636                    }
57637                    dlg.finished(false);
57638                    return Err(common::Error::HttpError(err));
57639                }
57640                Ok(res) => {
57641                    let (mut parts, body) = res.into_parts();
57642                    let mut body = common::Body::new(body);
57643                    if !parts.status.is_success() {
57644                        let bytes = common::to_bytes(body).await.unwrap_or_default();
57645                        let error = serde_json::from_str(&common::to_string(&bytes));
57646                        let response = common::to_response(parts, bytes.into());
57647
57648                        if let common::Retry::After(d) =
57649                            dlg.http_failure(&response, error.as_ref().ok())
57650                        {
57651                            sleep(d).await;
57652                            continue;
57653                        }
57654
57655                        dlg.finished(false);
57656
57657                        return Err(match error {
57658                            Ok(value) => common::Error::BadRequest(value),
57659                            _ => common::Error::Failure(response),
57660                        });
57661                    }
57662                    let response = {
57663                        let bytes = common::to_bytes(body).await.unwrap_or_default();
57664                        let encoded = common::to_string(&bytes);
57665                        match serde_json::from_str(&encoded) {
57666                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
57667                            Err(error) => {
57668                                dlg.response_json_decode_error(&encoded, &error);
57669                                return Err(common::Error::JsonDecodeError(
57670                                    encoded.to_string(),
57671                                    error,
57672                                ));
57673                            }
57674                        }
57675                    };
57676
57677                    dlg.finished(true);
57678                    return Ok(response);
57679                }
57680            }
57681        }
57682    }
57683
57684    /// User profile ID associated with this request.
57685    ///
57686    /// Sets the *profile id* path property to the given value.
57687    ///
57688    /// Even though the property as already been set when instantiating this call,
57689    /// we provide this method for API completeness.
57690    pub fn profile_id(mut self, new_value: i64) -> OrderListCall<'a, C> {
57691        self._profile_id = new_value;
57692        self
57693    }
57694    /// Project ID for orders.
57695    ///
57696    /// Sets the *project id* path property to the given value.
57697    ///
57698    /// Even though the property as already been set when instantiating this call,
57699    /// we provide this method for API completeness.
57700    pub fn project_id(mut self, new_value: i64) -> OrderListCall<'a, C> {
57701        self._project_id = new_value;
57702        self
57703    }
57704    /// Order of sorted results.
57705    ///
57706    /// Sets the *sort order* query property to the given value.
57707    pub fn sort_order(mut self, new_value: &str) -> OrderListCall<'a, C> {
57708        self._sort_order = Some(new_value.to_string());
57709        self
57710    }
57711    /// Field by which to sort the list.
57712    ///
57713    /// Sets the *sort field* query property to the given value.
57714    pub fn sort_field(mut self, new_value: &str) -> OrderListCall<'a, C> {
57715        self._sort_field = Some(new_value.to_string());
57716        self
57717    }
57718    /// Select only orders that are associated with these site IDs.
57719    ///
57720    /// Append the given value to the *site id* query property.
57721    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
57722    pub fn add_site_id(mut self, new_value: i64) -> OrderListCall<'a, C> {
57723        self._site_id.push(new_value);
57724        self
57725    }
57726    /// Allows searching for orders by name or ID. Wildcards (*) are allowed. For example, "order*2015" will return orders with names like "order June 2015", "order April 2015", or simply "order 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "order" will match orders with name "my order", "order 2015", or simply "order".
57727    ///
57728    /// Sets the *search string* query property to the given value.
57729    pub fn search_string(mut self, new_value: &str) -> OrderListCall<'a, C> {
57730        self._search_string = Some(new_value.to_string());
57731        self
57732    }
57733    /// Value of the nextPageToken from the previous result page.
57734    ///
57735    /// Sets the *page token* query property to the given value.
57736    pub fn page_token(mut self, new_value: &str) -> OrderListCall<'a, C> {
57737        self._page_token = Some(new_value.to_string());
57738        self
57739    }
57740    /// Maximum number of results to return.
57741    ///
57742    /// Sets the *max results* query property to the given value.
57743    pub fn max_results(mut self, new_value: i32) -> OrderListCall<'a, C> {
57744        self._max_results = Some(new_value);
57745        self
57746    }
57747    /// Select only orders with these IDs.
57748    ///
57749    /// Append the given value to the *ids* query property.
57750    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
57751    pub fn add_ids(mut self, new_value: i64) -> OrderListCall<'a, C> {
57752        self._ids.push(new_value);
57753        self
57754    }
57755    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
57756    /// while executing the actual API request.
57757    ///
57758    /// ````text
57759    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
57760    /// ````
57761    ///
57762    /// Sets the *delegate* property to the given value.
57763    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> OrderListCall<'a, C> {
57764        self._delegate = Some(new_value);
57765        self
57766    }
57767
57768    /// Set any additional parameter of the query string used in the request.
57769    /// It should be used to set parameters which are not yet available through their own
57770    /// setters.
57771    ///
57772    /// Please note that this method must not be used to set any of the known parameters
57773    /// which have their own setter method. If done anyway, the request will fail.
57774    ///
57775    /// # Additional Parameters
57776    ///
57777    /// * *$.xgafv* (query-string) - V1 error format.
57778    /// * *access_token* (query-string) - OAuth access token.
57779    /// * *alt* (query-string) - Data format for response.
57780    /// * *callback* (query-string) - JSONP
57781    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
57782    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
57783    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
57784    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
57785    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
57786    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
57787    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
57788    pub fn param<T>(mut self, name: T, value: T) -> OrderListCall<'a, C>
57789    where
57790        T: AsRef<str>,
57791    {
57792        self._additional_params
57793            .insert(name.as_ref().to_string(), value.as_ref().to_string());
57794        self
57795    }
57796
57797    /// Identifies the authorization scope for the method you are building.
57798    ///
57799    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
57800    /// [`Scope::Dfatrafficking`].
57801    ///
57802    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
57803    /// tokens for more than one scope.
57804    ///
57805    /// Usually there is more than one suitable scope to authorize an operation, some of which may
57806    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
57807    /// sufficient, a read-write scope will do as well.
57808    pub fn add_scope<St>(mut self, scope: St) -> OrderListCall<'a, C>
57809    where
57810        St: AsRef<str>,
57811    {
57812        self._scopes.insert(String::from(scope.as_ref()));
57813        self
57814    }
57815    /// Identifies the authorization scope(s) for the method you are building.
57816    ///
57817    /// See [`Self::add_scope()`] for details.
57818    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrderListCall<'a, C>
57819    where
57820        I: IntoIterator<Item = St>,
57821        St: AsRef<str>,
57822    {
57823        self._scopes
57824            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
57825        self
57826    }
57827
57828    /// Removes all scopes, and no default scope will be used either.
57829    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
57830    /// for details).
57831    pub fn clear_scopes(mut self) -> OrderListCall<'a, C> {
57832        self._scopes.clear();
57833        self
57834    }
57835}
57836
57837/// Gets one placement group by ID.
57838///
57839/// A builder for the *get* method supported by a *placementGroup* resource.
57840/// It is not used directly, but through a [`PlacementGroupMethods`] instance.
57841///
57842/// # Example
57843///
57844/// Instantiate a resource method builder
57845///
57846/// ```test_harness,no_run
57847/// # extern crate hyper;
57848/// # extern crate hyper_rustls;
57849/// # extern crate google_dfareporting3d3 as dfareporting3d3;
57850/// # async fn dox() {
57851/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
57852///
57853/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
57854/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
57855/// #     secret,
57856/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
57857/// # ).build().await.unwrap();
57858///
57859/// # let client = hyper_util::client::legacy::Client::builder(
57860/// #     hyper_util::rt::TokioExecutor::new()
57861/// # )
57862/// # .build(
57863/// #     hyper_rustls::HttpsConnectorBuilder::new()
57864/// #         .with_native_roots()
57865/// #         .unwrap()
57866/// #         .https_or_http()
57867/// #         .enable_http1()
57868/// #         .build()
57869/// # );
57870/// # let mut hub = Dfareporting::new(client, auth);
57871/// // You can configure optional parameters by calling the respective setters at will, and
57872/// // execute the final call using `doit()`.
57873/// // Values shown here are possibly random and not representative !
57874/// let result = hub.placement_groups().get(-72, -22)
57875///              .doit().await;
57876/// # }
57877/// ```
57878pub struct PlacementGroupGetCall<'a, C>
57879where
57880    C: 'a,
57881{
57882    hub: &'a Dfareporting<C>,
57883    _profile_id: i64,
57884    _id: i64,
57885    _delegate: Option<&'a mut dyn common::Delegate>,
57886    _additional_params: HashMap<String, String>,
57887    _scopes: BTreeSet<String>,
57888}
57889
57890impl<'a, C> common::CallBuilder for PlacementGroupGetCall<'a, C> {}
57891
57892impl<'a, C> PlacementGroupGetCall<'a, C>
57893where
57894    C: common::Connector,
57895{
57896    /// Perform the operation you have build so far.
57897    pub async fn doit(mut self) -> common::Result<(common::Response, PlacementGroup)> {
57898        use std::borrow::Cow;
57899        use std::io::{Read, Seek};
57900
57901        use common::{url::Params, ToParts};
57902        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
57903
57904        let mut dd = common::DefaultDelegate;
57905        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
57906        dlg.begin(common::MethodInfo {
57907            id: "dfareporting.placementGroups.get",
57908            http_method: hyper::Method::GET,
57909        });
57910
57911        for &field in ["alt", "profileId", "id"].iter() {
57912            if self._additional_params.contains_key(field) {
57913                dlg.finished(false);
57914                return Err(common::Error::FieldClash(field));
57915            }
57916        }
57917
57918        let mut params = Params::with_capacity(4 + self._additional_params.len());
57919        params.push("profileId", self._profile_id.to_string());
57920        params.push("id", self._id.to_string());
57921
57922        params.extend(self._additional_params.iter());
57923
57924        params.push("alt", "json");
57925        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/placementGroups/{id}";
57926        if self._scopes.is_empty() {
57927            self._scopes
57928                .insert(Scope::Dfatrafficking.as_ref().to_string());
57929        }
57930
57931        #[allow(clippy::single_element_loop)]
57932        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
57933            url = params.uri_replacement(url, param_name, find_this, false);
57934        }
57935        {
57936            let to_remove = ["id", "profileId"];
57937            params.remove_params(&to_remove);
57938        }
57939
57940        let url = params.parse_with_url(&url);
57941
57942        loop {
57943            let token = match self
57944                .hub
57945                .auth
57946                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
57947                .await
57948            {
57949                Ok(token) => token,
57950                Err(e) => match dlg.token(e) {
57951                    Ok(token) => token,
57952                    Err(e) => {
57953                        dlg.finished(false);
57954                        return Err(common::Error::MissingToken(e));
57955                    }
57956                },
57957            };
57958            let mut req_result = {
57959                let client = &self.hub.client;
57960                dlg.pre_request();
57961                let mut req_builder = hyper::Request::builder()
57962                    .method(hyper::Method::GET)
57963                    .uri(url.as_str())
57964                    .header(USER_AGENT, self.hub._user_agent.clone());
57965
57966                if let Some(token) = token.as_ref() {
57967                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
57968                }
57969
57970                let request = req_builder
57971                    .header(CONTENT_LENGTH, 0_u64)
57972                    .body(common::to_body::<String>(None));
57973
57974                client.request(request.unwrap()).await
57975            };
57976
57977            match req_result {
57978                Err(err) => {
57979                    if let common::Retry::After(d) = dlg.http_error(&err) {
57980                        sleep(d).await;
57981                        continue;
57982                    }
57983                    dlg.finished(false);
57984                    return Err(common::Error::HttpError(err));
57985                }
57986                Ok(res) => {
57987                    let (mut parts, body) = res.into_parts();
57988                    let mut body = common::Body::new(body);
57989                    if !parts.status.is_success() {
57990                        let bytes = common::to_bytes(body).await.unwrap_or_default();
57991                        let error = serde_json::from_str(&common::to_string(&bytes));
57992                        let response = common::to_response(parts, bytes.into());
57993
57994                        if let common::Retry::After(d) =
57995                            dlg.http_failure(&response, error.as_ref().ok())
57996                        {
57997                            sleep(d).await;
57998                            continue;
57999                        }
58000
58001                        dlg.finished(false);
58002
58003                        return Err(match error {
58004                            Ok(value) => common::Error::BadRequest(value),
58005                            _ => common::Error::Failure(response),
58006                        });
58007                    }
58008                    let response = {
58009                        let bytes = common::to_bytes(body).await.unwrap_or_default();
58010                        let encoded = common::to_string(&bytes);
58011                        match serde_json::from_str(&encoded) {
58012                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
58013                            Err(error) => {
58014                                dlg.response_json_decode_error(&encoded, &error);
58015                                return Err(common::Error::JsonDecodeError(
58016                                    encoded.to_string(),
58017                                    error,
58018                                ));
58019                            }
58020                        }
58021                    };
58022
58023                    dlg.finished(true);
58024                    return Ok(response);
58025                }
58026            }
58027        }
58028    }
58029
58030    /// User profile ID associated with this request.
58031    ///
58032    /// Sets the *profile id* path property to the given value.
58033    ///
58034    /// Even though the property as already been set when instantiating this call,
58035    /// we provide this method for API completeness.
58036    pub fn profile_id(mut self, new_value: i64) -> PlacementGroupGetCall<'a, C> {
58037        self._profile_id = new_value;
58038        self
58039    }
58040    /// Placement group ID.
58041    ///
58042    /// Sets the *id* path property to the given value.
58043    ///
58044    /// Even though the property as already been set when instantiating this call,
58045    /// we provide this method for API completeness.
58046    pub fn id(mut self, new_value: i64) -> PlacementGroupGetCall<'a, C> {
58047        self._id = new_value;
58048        self
58049    }
58050    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
58051    /// while executing the actual API request.
58052    ///
58053    /// ````text
58054    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
58055    /// ````
58056    ///
58057    /// Sets the *delegate* property to the given value.
58058    pub fn delegate(
58059        mut self,
58060        new_value: &'a mut dyn common::Delegate,
58061    ) -> PlacementGroupGetCall<'a, C> {
58062        self._delegate = Some(new_value);
58063        self
58064    }
58065
58066    /// Set any additional parameter of the query string used in the request.
58067    /// It should be used to set parameters which are not yet available through their own
58068    /// setters.
58069    ///
58070    /// Please note that this method must not be used to set any of the known parameters
58071    /// which have their own setter method. If done anyway, the request will fail.
58072    ///
58073    /// # Additional Parameters
58074    ///
58075    /// * *$.xgafv* (query-string) - V1 error format.
58076    /// * *access_token* (query-string) - OAuth access token.
58077    /// * *alt* (query-string) - Data format for response.
58078    /// * *callback* (query-string) - JSONP
58079    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
58080    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
58081    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
58082    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
58083    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
58084    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
58085    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
58086    pub fn param<T>(mut self, name: T, value: T) -> PlacementGroupGetCall<'a, C>
58087    where
58088        T: AsRef<str>,
58089    {
58090        self._additional_params
58091            .insert(name.as_ref().to_string(), value.as_ref().to_string());
58092        self
58093    }
58094
58095    /// Identifies the authorization scope for the method you are building.
58096    ///
58097    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
58098    /// [`Scope::Dfatrafficking`].
58099    ///
58100    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
58101    /// tokens for more than one scope.
58102    ///
58103    /// Usually there is more than one suitable scope to authorize an operation, some of which may
58104    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
58105    /// sufficient, a read-write scope will do as well.
58106    pub fn add_scope<St>(mut self, scope: St) -> PlacementGroupGetCall<'a, C>
58107    where
58108        St: AsRef<str>,
58109    {
58110        self._scopes.insert(String::from(scope.as_ref()));
58111        self
58112    }
58113    /// Identifies the authorization scope(s) for the method you are building.
58114    ///
58115    /// See [`Self::add_scope()`] for details.
58116    pub fn add_scopes<I, St>(mut self, scopes: I) -> PlacementGroupGetCall<'a, C>
58117    where
58118        I: IntoIterator<Item = St>,
58119        St: AsRef<str>,
58120    {
58121        self._scopes
58122            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
58123        self
58124    }
58125
58126    /// Removes all scopes, and no default scope will be used either.
58127    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
58128    /// for details).
58129    pub fn clear_scopes(mut self) -> PlacementGroupGetCall<'a, C> {
58130        self._scopes.clear();
58131        self
58132    }
58133}
58134
58135/// Inserts a new placement group.
58136///
58137/// A builder for the *insert* method supported by a *placementGroup* resource.
58138/// It is not used directly, but through a [`PlacementGroupMethods`] instance.
58139///
58140/// # Example
58141///
58142/// Instantiate a resource method builder
58143///
58144/// ```test_harness,no_run
58145/// # extern crate hyper;
58146/// # extern crate hyper_rustls;
58147/// # extern crate google_dfareporting3d3 as dfareporting3d3;
58148/// use dfareporting3d3::api::PlacementGroup;
58149/// # async fn dox() {
58150/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
58151///
58152/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
58153/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
58154/// #     secret,
58155/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
58156/// # ).build().await.unwrap();
58157///
58158/// # let client = hyper_util::client::legacy::Client::builder(
58159/// #     hyper_util::rt::TokioExecutor::new()
58160/// # )
58161/// # .build(
58162/// #     hyper_rustls::HttpsConnectorBuilder::new()
58163/// #         .with_native_roots()
58164/// #         .unwrap()
58165/// #         .https_or_http()
58166/// #         .enable_http1()
58167/// #         .build()
58168/// # );
58169/// # let mut hub = Dfareporting::new(client, auth);
58170/// // As the method needs a request, you would usually fill it with the desired information
58171/// // into the respective structure. Some of the parts shown here might not be applicable !
58172/// // Values shown here are possibly random and not representative !
58173/// let mut req = PlacementGroup::default();
58174///
58175/// // You can configure optional parameters by calling the respective setters at will, and
58176/// // execute the final call using `doit()`.
58177/// // Values shown here are possibly random and not representative !
58178/// let result = hub.placement_groups().insert(req, -49)
58179///              .doit().await;
58180/// # }
58181/// ```
58182pub struct PlacementGroupInsertCall<'a, C>
58183where
58184    C: 'a,
58185{
58186    hub: &'a Dfareporting<C>,
58187    _request: PlacementGroup,
58188    _profile_id: i64,
58189    _delegate: Option<&'a mut dyn common::Delegate>,
58190    _additional_params: HashMap<String, String>,
58191    _scopes: BTreeSet<String>,
58192}
58193
58194impl<'a, C> common::CallBuilder for PlacementGroupInsertCall<'a, C> {}
58195
58196impl<'a, C> PlacementGroupInsertCall<'a, C>
58197where
58198    C: common::Connector,
58199{
58200    /// Perform the operation you have build so far.
58201    pub async fn doit(mut self) -> common::Result<(common::Response, PlacementGroup)> {
58202        use std::borrow::Cow;
58203        use std::io::{Read, Seek};
58204
58205        use common::{url::Params, ToParts};
58206        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
58207
58208        let mut dd = common::DefaultDelegate;
58209        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
58210        dlg.begin(common::MethodInfo {
58211            id: "dfareporting.placementGroups.insert",
58212            http_method: hyper::Method::POST,
58213        });
58214
58215        for &field in ["alt", "profileId"].iter() {
58216            if self._additional_params.contains_key(field) {
58217                dlg.finished(false);
58218                return Err(common::Error::FieldClash(field));
58219            }
58220        }
58221
58222        let mut params = Params::with_capacity(4 + self._additional_params.len());
58223        params.push("profileId", self._profile_id.to_string());
58224
58225        params.extend(self._additional_params.iter());
58226
58227        params.push("alt", "json");
58228        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/placementGroups";
58229        if self._scopes.is_empty() {
58230            self._scopes
58231                .insert(Scope::Dfatrafficking.as_ref().to_string());
58232        }
58233
58234        #[allow(clippy::single_element_loop)]
58235        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
58236            url = params.uri_replacement(url, param_name, find_this, false);
58237        }
58238        {
58239            let to_remove = ["profileId"];
58240            params.remove_params(&to_remove);
58241        }
58242
58243        let url = params.parse_with_url(&url);
58244
58245        let mut json_mime_type = mime::APPLICATION_JSON;
58246        let mut request_value_reader = {
58247            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
58248            common::remove_json_null_values(&mut value);
58249            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
58250            serde_json::to_writer(&mut dst, &value).unwrap();
58251            dst
58252        };
58253        let request_size = request_value_reader
58254            .seek(std::io::SeekFrom::End(0))
58255            .unwrap();
58256        request_value_reader
58257            .seek(std::io::SeekFrom::Start(0))
58258            .unwrap();
58259
58260        loop {
58261            let token = match self
58262                .hub
58263                .auth
58264                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
58265                .await
58266            {
58267                Ok(token) => token,
58268                Err(e) => match dlg.token(e) {
58269                    Ok(token) => token,
58270                    Err(e) => {
58271                        dlg.finished(false);
58272                        return Err(common::Error::MissingToken(e));
58273                    }
58274                },
58275            };
58276            request_value_reader
58277                .seek(std::io::SeekFrom::Start(0))
58278                .unwrap();
58279            let mut req_result = {
58280                let client = &self.hub.client;
58281                dlg.pre_request();
58282                let mut req_builder = hyper::Request::builder()
58283                    .method(hyper::Method::POST)
58284                    .uri(url.as_str())
58285                    .header(USER_AGENT, self.hub._user_agent.clone());
58286
58287                if let Some(token) = token.as_ref() {
58288                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
58289                }
58290
58291                let request = req_builder
58292                    .header(CONTENT_TYPE, json_mime_type.to_string())
58293                    .header(CONTENT_LENGTH, request_size as u64)
58294                    .body(common::to_body(
58295                        request_value_reader.get_ref().clone().into(),
58296                    ));
58297
58298                client.request(request.unwrap()).await
58299            };
58300
58301            match req_result {
58302                Err(err) => {
58303                    if let common::Retry::After(d) = dlg.http_error(&err) {
58304                        sleep(d).await;
58305                        continue;
58306                    }
58307                    dlg.finished(false);
58308                    return Err(common::Error::HttpError(err));
58309                }
58310                Ok(res) => {
58311                    let (mut parts, body) = res.into_parts();
58312                    let mut body = common::Body::new(body);
58313                    if !parts.status.is_success() {
58314                        let bytes = common::to_bytes(body).await.unwrap_or_default();
58315                        let error = serde_json::from_str(&common::to_string(&bytes));
58316                        let response = common::to_response(parts, bytes.into());
58317
58318                        if let common::Retry::After(d) =
58319                            dlg.http_failure(&response, error.as_ref().ok())
58320                        {
58321                            sleep(d).await;
58322                            continue;
58323                        }
58324
58325                        dlg.finished(false);
58326
58327                        return Err(match error {
58328                            Ok(value) => common::Error::BadRequest(value),
58329                            _ => common::Error::Failure(response),
58330                        });
58331                    }
58332                    let response = {
58333                        let bytes = common::to_bytes(body).await.unwrap_or_default();
58334                        let encoded = common::to_string(&bytes);
58335                        match serde_json::from_str(&encoded) {
58336                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
58337                            Err(error) => {
58338                                dlg.response_json_decode_error(&encoded, &error);
58339                                return Err(common::Error::JsonDecodeError(
58340                                    encoded.to_string(),
58341                                    error,
58342                                ));
58343                            }
58344                        }
58345                    };
58346
58347                    dlg.finished(true);
58348                    return Ok(response);
58349                }
58350            }
58351        }
58352    }
58353
58354    ///
58355    /// Sets the *request* property to the given value.
58356    ///
58357    /// Even though the property as already been set when instantiating this call,
58358    /// we provide this method for API completeness.
58359    pub fn request(mut self, new_value: PlacementGroup) -> PlacementGroupInsertCall<'a, C> {
58360        self._request = new_value;
58361        self
58362    }
58363    /// User profile ID associated with this request.
58364    ///
58365    /// Sets the *profile id* path property to the given value.
58366    ///
58367    /// Even though the property as already been set when instantiating this call,
58368    /// we provide this method for API completeness.
58369    pub fn profile_id(mut self, new_value: i64) -> PlacementGroupInsertCall<'a, C> {
58370        self._profile_id = new_value;
58371        self
58372    }
58373    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
58374    /// while executing the actual API request.
58375    ///
58376    /// ````text
58377    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
58378    /// ````
58379    ///
58380    /// Sets the *delegate* property to the given value.
58381    pub fn delegate(
58382        mut self,
58383        new_value: &'a mut dyn common::Delegate,
58384    ) -> PlacementGroupInsertCall<'a, C> {
58385        self._delegate = Some(new_value);
58386        self
58387    }
58388
58389    /// Set any additional parameter of the query string used in the request.
58390    /// It should be used to set parameters which are not yet available through their own
58391    /// setters.
58392    ///
58393    /// Please note that this method must not be used to set any of the known parameters
58394    /// which have their own setter method. If done anyway, the request will fail.
58395    ///
58396    /// # Additional Parameters
58397    ///
58398    /// * *$.xgafv* (query-string) - V1 error format.
58399    /// * *access_token* (query-string) - OAuth access token.
58400    /// * *alt* (query-string) - Data format for response.
58401    /// * *callback* (query-string) - JSONP
58402    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
58403    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
58404    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
58405    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
58406    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
58407    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
58408    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
58409    pub fn param<T>(mut self, name: T, value: T) -> PlacementGroupInsertCall<'a, C>
58410    where
58411        T: AsRef<str>,
58412    {
58413        self._additional_params
58414            .insert(name.as_ref().to_string(), value.as_ref().to_string());
58415        self
58416    }
58417
58418    /// Identifies the authorization scope for the method you are building.
58419    ///
58420    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
58421    /// [`Scope::Dfatrafficking`].
58422    ///
58423    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
58424    /// tokens for more than one scope.
58425    ///
58426    /// Usually there is more than one suitable scope to authorize an operation, some of which may
58427    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
58428    /// sufficient, a read-write scope will do as well.
58429    pub fn add_scope<St>(mut self, scope: St) -> PlacementGroupInsertCall<'a, C>
58430    where
58431        St: AsRef<str>,
58432    {
58433        self._scopes.insert(String::from(scope.as_ref()));
58434        self
58435    }
58436    /// Identifies the authorization scope(s) for the method you are building.
58437    ///
58438    /// See [`Self::add_scope()`] for details.
58439    pub fn add_scopes<I, St>(mut self, scopes: I) -> PlacementGroupInsertCall<'a, C>
58440    where
58441        I: IntoIterator<Item = St>,
58442        St: AsRef<str>,
58443    {
58444        self._scopes
58445            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
58446        self
58447    }
58448
58449    /// Removes all scopes, and no default scope will be used either.
58450    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
58451    /// for details).
58452    pub fn clear_scopes(mut self) -> PlacementGroupInsertCall<'a, C> {
58453        self._scopes.clear();
58454        self
58455    }
58456}
58457
58458/// Retrieves a list of placement groups, possibly filtered. This method supports paging.
58459///
58460/// A builder for the *list* method supported by a *placementGroup* resource.
58461/// It is not used directly, but through a [`PlacementGroupMethods`] instance.
58462///
58463/// # Example
58464///
58465/// Instantiate a resource method builder
58466///
58467/// ```test_harness,no_run
58468/// # extern crate hyper;
58469/// # extern crate hyper_rustls;
58470/// # extern crate google_dfareporting3d3 as dfareporting3d3;
58471/// # async fn dox() {
58472/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
58473///
58474/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
58475/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
58476/// #     secret,
58477/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
58478/// # ).build().await.unwrap();
58479///
58480/// # let client = hyper_util::client::legacy::Client::builder(
58481/// #     hyper_util::rt::TokioExecutor::new()
58482/// # )
58483/// # .build(
58484/// #     hyper_rustls::HttpsConnectorBuilder::new()
58485/// #         .with_native_roots()
58486/// #         .unwrap()
58487/// #         .https_or_http()
58488/// #         .enable_http1()
58489/// #         .build()
58490/// # );
58491/// # let mut hub = Dfareporting::new(client, auth);
58492/// // You can configure optional parameters by calling the respective setters at will, and
58493/// // execute the final call using `doit()`.
58494/// // Values shown here are possibly random and not representative !
58495/// let result = hub.placement_groups().list(-81)
58496///              .sort_order("dolore")
58497///              .sort_field("vero")
58498///              .add_site_ids(-17)
58499///              .search_string("et")
58500///              .add_pricing_types("amet.")
58501///              .add_placement_strategy_ids(-40)
58502///              .placement_group_type("sanctus")
58503///              .page_token("sed")
58504///              .min_start_date("dolor")
58505///              .min_end_date("et")
58506///              .max_start_date("et")
58507///              .max_results(-81)
58508///              .max_end_date("eos")
58509///              .add_ids(-41)
58510///              .add_directory_site_ids(-67)
58511///              .add_content_category_ids(-32)
58512///              .add_campaign_ids(-91)
58513///              .archived(true)
58514///              .add_advertiser_ids(-40)
58515///              .doit().await;
58516/// # }
58517/// ```
58518pub struct PlacementGroupListCall<'a, C>
58519where
58520    C: 'a,
58521{
58522    hub: &'a Dfareporting<C>,
58523    _profile_id: i64,
58524    _sort_order: Option<String>,
58525    _sort_field: Option<String>,
58526    _site_ids: Vec<i64>,
58527    _search_string: Option<String>,
58528    _pricing_types: Vec<String>,
58529    _placement_strategy_ids: Vec<i64>,
58530    _placement_group_type: Option<String>,
58531    _page_token: Option<String>,
58532    _min_start_date: Option<String>,
58533    _min_end_date: Option<String>,
58534    _max_start_date: Option<String>,
58535    _max_results: Option<i32>,
58536    _max_end_date: Option<String>,
58537    _ids: Vec<i64>,
58538    _directory_site_ids: Vec<i64>,
58539    _content_category_ids: Vec<i64>,
58540    _campaign_ids: Vec<i64>,
58541    _archived: Option<bool>,
58542    _advertiser_ids: Vec<i64>,
58543    _delegate: Option<&'a mut dyn common::Delegate>,
58544    _additional_params: HashMap<String, String>,
58545    _scopes: BTreeSet<String>,
58546}
58547
58548impl<'a, C> common::CallBuilder for PlacementGroupListCall<'a, C> {}
58549
58550impl<'a, C> PlacementGroupListCall<'a, C>
58551where
58552    C: common::Connector,
58553{
58554    /// Perform the operation you have build so far.
58555    pub async fn doit(mut self) -> common::Result<(common::Response, PlacementGroupsListResponse)> {
58556        use std::borrow::Cow;
58557        use std::io::{Read, Seek};
58558
58559        use common::{url::Params, ToParts};
58560        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
58561
58562        let mut dd = common::DefaultDelegate;
58563        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
58564        dlg.begin(common::MethodInfo {
58565            id: "dfareporting.placementGroups.list",
58566            http_method: hyper::Method::GET,
58567        });
58568
58569        for &field in [
58570            "alt",
58571            "profileId",
58572            "sortOrder",
58573            "sortField",
58574            "siteIds",
58575            "searchString",
58576            "pricingTypes",
58577            "placementStrategyIds",
58578            "placementGroupType",
58579            "pageToken",
58580            "minStartDate",
58581            "minEndDate",
58582            "maxStartDate",
58583            "maxResults",
58584            "maxEndDate",
58585            "ids",
58586            "directorySiteIds",
58587            "contentCategoryIds",
58588            "campaignIds",
58589            "archived",
58590            "advertiserIds",
58591        ]
58592        .iter()
58593        {
58594            if self._additional_params.contains_key(field) {
58595                dlg.finished(false);
58596                return Err(common::Error::FieldClash(field));
58597            }
58598        }
58599
58600        let mut params = Params::with_capacity(22 + self._additional_params.len());
58601        params.push("profileId", self._profile_id.to_string());
58602        if let Some(value) = self._sort_order.as_ref() {
58603            params.push("sortOrder", value);
58604        }
58605        if let Some(value) = self._sort_field.as_ref() {
58606            params.push("sortField", value);
58607        }
58608        if !self._site_ids.is_empty() {
58609            for f in self._site_ids.iter() {
58610                params.push("siteIds", f.to_string());
58611            }
58612        }
58613        if let Some(value) = self._search_string.as_ref() {
58614            params.push("searchString", value);
58615        }
58616        if !self._pricing_types.is_empty() {
58617            for f in self._pricing_types.iter() {
58618                params.push("pricingTypes", f);
58619            }
58620        }
58621        if !self._placement_strategy_ids.is_empty() {
58622            for f in self._placement_strategy_ids.iter() {
58623                params.push("placementStrategyIds", f.to_string());
58624            }
58625        }
58626        if let Some(value) = self._placement_group_type.as_ref() {
58627            params.push("placementGroupType", value);
58628        }
58629        if let Some(value) = self._page_token.as_ref() {
58630            params.push("pageToken", value);
58631        }
58632        if let Some(value) = self._min_start_date.as_ref() {
58633            params.push("minStartDate", value);
58634        }
58635        if let Some(value) = self._min_end_date.as_ref() {
58636            params.push("minEndDate", value);
58637        }
58638        if let Some(value) = self._max_start_date.as_ref() {
58639            params.push("maxStartDate", value);
58640        }
58641        if let Some(value) = self._max_results.as_ref() {
58642            params.push("maxResults", value.to_string());
58643        }
58644        if let Some(value) = self._max_end_date.as_ref() {
58645            params.push("maxEndDate", value);
58646        }
58647        if !self._ids.is_empty() {
58648            for f in self._ids.iter() {
58649                params.push("ids", f.to_string());
58650            }
58651        }
58652        if !self._directory_site_ids.is_empty() {
58653            for f in self._directory_site_ids.iter() {
58654                params.push("directorySiteIds", f.to_string());
58655            }
58656        }
58657        if !self._content_category_ids.is_empty() {
58658            for f in self._content_category_ids.iter() {
58659                params.push("contentCategoryIds", f.to_string());
58660            }
58661        }
58662        if !self._campaign_ids.is_empty() {
58663            for f in self._campaign_ids.iter() {
58664                params.push("campaignIds", f.to_string());
58665            }
58666        }
58667        if let Some(value) = self._archived.as_ref() {
58668            params.push("archived", value.to_string());
58669        }
58670        if !self._advertiser_ids.is_empty() {
58671            for f in self._advertiser_ids.iter() {
58672                params.push("advertiserIds", f.to_string());
58673            }
58674        }
58675
58676        params.extend(self._additional_params.iter());
58677
58678        params.push("alt", "json");
58679        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/placementGroups";
58680        if self._scopes.is_empty() {
58681            self._scopes
58682                .insert(Scope::Dfatrafficking.as_ref().to_string());
58683        }
58684
58685        #[allow(clippy::single_element_loop)]
58686        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
58687            url = params.uri_replacement(url, param_name, find_this, false);
58688        }
58689        {
58690            let to_remove = ["profileId"];
58691            params.remove_params(&to_remove);
58692        }
58693
58694        let url = params.parse_with_url(&url);
58695
58696        loop {
58697            let token = match self
58698                .hub
58699                .auth
58700                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
58701                .await
58702            {
58703                Ok(token) => token,
58704                Err(e) => match dlg.token(e) {
58705                    Ok(token) => token,
58706                    Err(e) => {
58707                        dlg.finished(false);
58708                        return Err(common::Error::MissingToken(e));
58709                    }
58710                },
58711            };
58712            let mut req_result = {
58713                let client = &self.hub.client;
58714                dlg.pre_request();
58715                let mut req_builder = hyper::Request::builder()
58716                    .method(hyper::Method::GET)
58717                    .uri(url.as_str())
58718                    .header(USER_AGENT, self.hub._user_agent.clone());
58719
58720                if let Some(token) = token.as_ref() {
58721                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
58722                }
58723
58724                let request = req_builder
58725                    .header(CONTENT_LENGTH, 0_u64)
58726                    .body(common::to_body::<String>(None));
58727
58728                client.request(request.unwrap()).await
58729            };
58730
58731            match req_result {
58732                Err(err) => {
58733                    if let common::Retry::After(d) = dlg.http_error(&err) {
58734                        sleep(d).await;
58735                        continue;
58736                    }
58737                    dlg.finished(false);
58738                    return Err(common::Error::HttpError(err));
58739                }
58740                Ok(res) => {
58741                    let (mut parts, body) = res.into_parts();
58742                    let mut body = common::Body::new(body);
58743                    if !parts.status.is_success() {
58744                        let bytes = common::to_bytes(body).await.unwrap_or_default();
58745                        let error = serde_json::from_str(&common::to_string(&bytes));
58746                        let response = common::to_response(parts, bytes.into());
58747
58748                        if let common::Retry::After(d) =
58749                            dlg.http_failure(&response, error.as_ref().ok())
58750                        {
58751                            sleep(d).await;
58752                            continue;
58753                        }
58754
58755                        dlg.finished(false);
58756
58757                        return Err(match error {
58758                            Ok(value) => common::Error::BadRequest(value),
58759                            _ => common::Error::Failure(response),
58760                        });
58761                    }
58762                    let response = {
58763                        let bytes = common::to_bytes(body).await.unwrap_or_default();
58764                        let encoded = common::to_string(&bytes);
58765                        match serde_json::from_str(&encoded) {
58766                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
58767                            Err(error) => {
58768                                dlg.response_json_decode_error(&encoded, &error);
58769                                return Err(common::Error::JsonDecodeError(
58770                                    encoded.to_string(),
58771                                    error,
58772                                ));
58773                            }
58774                        }
58775                    };
58776
58777                    dlg.finished(true);
58778                    return Ok(response);
58779                }
58780            }
58781        }
58782    }
58783
58784    /// User profile ID associated with this request.
58785    ///
58786    /// Sets the *profile id* path property to the given value.
58787    ///
58788    /// Even though the property as already been set when instantiating this call,
58789    /// we provide this method for API completeness.
58790    pub fn profile_id(mut self, new_value: i64) -> PlacementGroupListCall<'a, C> {
58791        self._profile_id = new_value;
58792        self
58793    }
58794    /// Order of sorted results.
58795    ///
58796    /// Sets the *sort order* query property to the given value.
58797    pub fn sort_order(mut self, new_value: &str) -> PlacementGroupListCall<'a, C> {
58798        self._sort_order = Some(new_value.to_string());
58799        self
58800    }
58801    /// Field by which to sort the list.
58802    ///
58803    /// Sets the *sort field* query property to the given value.
58804    pub fn sort_field(mut self, new_value: &str) -> PlacementGroupListCall<'a, C> {
58805        self._sort_field = Some(new_value.to_string());
58806        self
58807    }
58808    /// Select only placement groups that are associated with these sites.
58809    ///
58810    /// Append the given value to the *site ids* query property.
58811    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
58812    pub fn add_site_ids(mut self, new_value: i64) -> PlacementGroupListCall<'a, C> {
58813        self._site_ids.push(new_value);
58814        self
58815    }
58816    /// Allows searching for placement groups by name or ID. Wildcards (*) are allowed. For example, "placement*2015" will return placement groups with names like "placement group June 2015", "placement group May 2015", or simply "placements 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "placementgroup" will match placement groups with name "my placementgroup", "placementgroup 2015", or simply "placementgroup".
58817    ///
58818    /// Sets the *search string* query property to the given value.
58819    pub fn search_string(mut self, new_value: &str) -> PlacementGroupListCall<'a, C> {
58820        self._search_string = Some(new_value.to_string());
58821        self
58822    }
58823    /// Select only placement groups with these pricing types.
58824    ///
58825    /// Append the given value to the *pricing types* query property.
58826    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
58827    pub fn add_pricing_types(mut self, new_value: &str) -> PlacementGroupListCall<'a, C> {
58828        self._pricing_types.push(new_value.to_string());
58829        self
58830    }
58831    /// Select only placement groups that are associated with these placement strategies.
58832    ///
58833    /// Append the given value to the *placement strategy ids* query property.
58834    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
58835    pub fn add_placement_strategy_ids(mut self, new_value: i64) -> PlacementGroupListCall<'a, C> {
58836        self._placement_strategy_ids.push(new_value);
58837        self
58838    }
58839    /// Select only placement groups belonging with this group type. A package is a simple group of placements that acts as a single pricing point for a group of tags. A roadblock is a group of placements that not only acts as a single pricing point but also assumes that all the tags in it will be served at the same time. A roadblock requires one of its assigned placements to be marked as primary for reporting.
58840    ///
58841    /// Sets the *placement group type* query property to the given value.
58842    pub fn placement_group_type(mut self, new_value: &str) -> PlacementGroupListCall<'a, C> {
58843        self._placement_group_type = Some(new_value.to_string());
58844        self
58845    }
58846    /// Value of the nextPageToken from the previous result page.
58847    ///
58848    /// Sets the *page token* query property to the given value.
58849    pub fn page_token(mut self, new_value: &str) -> PlacementGroupListCall<'a, C> {
58850        self._page_token = Some(new_value.to_string());
58851        self
58852    }
58853    /// Select only placements or placement groups whose start date is on or after the specified minStartDate. The date should be formatted as "yyyy-MM-dd".
58854    ///
58855    /// Sets the *min start date* query property to the given value.
58856    pub fn min_start_date(mut self, new_value: &str) -> PlacementGroupListCall<'a, C> {
58857        self._min_start_date = Some(new_value.to_string());
58858        self
58859    }
58860    /// Select only placements or placement groups whose end date is on or after the specified minEndDate. The date should be formatted as "yyyy-MM-dd".
58861    ///
58862    /// Sets the *min end date* query property to the given value.
58863    pub fn min_end_date(mut self, new_value: &str) -> PlacementGroupListCall<'a, C> {
58864        self._min_end_date = Some(new_value.to_string());
58865        self
58866    }
58867    /// Select only placements or placement groups whose start date is on or before the specified maxStartDate. The date should be formatted as "yyyy-MM-dd".
58868    ///
58869    /// Sets the *max start date* query property to the given value.
58870    pub fn max_start_date(mut self, new_value: &str) -> PlacementGroupListCall<'a, C> {
58871        self._max_start_date = Some(new_value.to_string());
58872        self
58873    }
58874    /// Maximum number of results to return.
58875    ///
58876    /// Sets the *max results* query property to the given value.
58877    pub fn max_results(mut self, new_value: i32) -> PlacementGroupListCall<'a, C> {
58878        self._max_results = Some(new_value);
58879        self
58880    }
58881    /// Select only placements or placement groups whose end date is on or before the specified maxEndDate. The date should be formatted as "yyyy-MM-dd".
58882    ///
58883    /// Sets the *max end date* query property to the given value.
58884    pub fn max_end_date(mut self, new_value: &str) -> PlacementGroupListCall<'a, C> {
58885        self._max_end_date = Some(new_value.to_string());
58886        self
58887    }
58888    /// Select only placement groups with these IDs.
58889    ///
58890    /// Append the given value to the *ids* query property.
58891    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
58892    pub fn add_ids(mut self, new_value: i64) -> PlacementGroupListCall<'a, C> {
58893        self._ids.push(new_value);
58894        self
58895    }
58896    /// Select only placement groups that are associated with these directory sites.
58897    ///
58898    /// Append the given value to the *directory site ids* query property.
58899    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
58900    pub fn add_directory_site_ids(mut self, new_value: i64) -> PlacementGroupListCall<'a, C> {
58901        self._directory_site_ids.push(new_value);
58902        self
58903    }
58904    /// Select only placement groups that are associated with these content categories.
58905    ///
58906    /// Append the given value to the *content category ids* query property.
58907    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
58908    pub fn add_content_category_ids(mut self, new_value: i64) -> PlacementGroupListCall<'a, C> {
58909        self._content_category_ids.push(new_value);
58910        self
58911    }
58912    /// Select only placement groups that belong to these campaigns.
58913    ///
58914    /// Append the given value to the *campaign ids* query property.
58915    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
58916    pub fn add_campaign_ids(mut self, new_value: i64) -> PlacementGroupListCall<'a, C> {
58917        self._campaign_ids.push(new_value);
58918        self
58919    }
58920    /// Select only archived placements. Don't set this field to select both archived and non-archived placements.
58921    ///
58922    /// Sets the *archived* query property to the given value.
58923    pub fn archived(mut self, new_value: bool) -> PlacementGroupListCall<'a, C> {
58924        self._archived = Some(new_value);
58925        self
58926    }
58927    /// Select only placement groups that belong to these advertisers.
58928    ///
58929    /// Append the given value to the *advertiser ids* query property.
58930    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
58931    pub fn add_advertiser_ids(mut self, new_value: i64) -> PlacementGroupListCall<'a, C> {
58932        self._advertiser_ids.push(new_value);
58933        self
58934    }
58935    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
58936    /// while executing the actual API request.
58937    ///
58938    /// ````text
58939    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
58940    /// ````
58941    ///
58942    /// Sets the *delegate* property to the given value.
58943    pub fn delegate(
58944        mut self,
58945        new_value: &'a mut dyn common::Delegate,
58946    ) -> PlacementGroupListCall<'a, C> {
58947        self._delegate = Some(new_value);
58948        self
58949    }
58950
58951    /// Set any additional parameter of the query string used in the request.
58952    /// It should be used to set parameters which are not yet available through their own
58953    /// setters.
58954    ///
58955    /// Please note that this method must not be used to set any of the known parameters
58956    /// which have their own setter method. If done anyway, the request will fail.
58957    ///
58958    /// # Additional Parameters
58959    ///
58960    /// * *$.xgafv* (query-string) - V1 error format.
58961    /// * *access_token* (query-string) - OAuth access token.
58962    /// * *alt* (query-string) - Data format for response.
58963    /// * *callback* (query-string) - JSONP
58964    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
58965    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
58966    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
58967    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
58968    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
58969    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
58970    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
58971    pub fn param<T>(mut self, name: T, value: T) -> PlacementGroupListCall<'a, C>
58972    where
58973        T: AsRef<str>,
58974    {
58975        self._additional_params
58976            .insert(name.as_ref().to_string(), value.as_ref().to_string());
58977        self
58978    }
58979
58980    /// Identifies the authorization scope for the method you are building.
58981    ///
58982    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
58983    /// [`Scope::Dfatrafficking`].
58984    ///
58985    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
58986    /// tokens for more than one scope.
58987    ///
58988    /// Usually there is more than one suitable scope to authorize an operation, some of which may
58989    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
58990    /// sufficient, a read-write scope will do as well.
58991    pub fn add_scope<St>(mut self, scope: St) -> PlacementGroupListCall<'a, C>
58992    where
58993        St: AsRef<str>,
58994    {
58995        self._scopes.insert(String::from(scope.as_ref()));
58996        self
58997    }
58998    /// Identifies the authorization scope(s) for the method you are building.
58999    ///
59000    /// See [`Self::add_scope()`] for details.
59001    pub fn add_scopes<I, St>(mut self, scopes: I) -> PlacementGroupListCall<'a, C>
59002    where
59003        I: IntoIterator<Item = St>,
59004        St: AsRef<str>,
59005    {
59006        self._scopes
59007            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
59008        self
59009    }
59010
59011    /// Removes all scopes, and no default scope will be used either.
59012    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
59013    /// for details).
59014    pub fn clear_scopes(mut self) -> PlacementGroupListCall<'a, C> {
59015        self._scopes.clear();
59016        self
59017    }
59018}
59019
59020/// Updates an existing placement group. This method supports patch semantics.
59021///
59022/// A builder for the *patch* method supported by a *placementGroup* resource.
59023/// It is not used directly, but through a [`PlacementGroupMethods`] instance.
59024///
59025/// # Example
59026///
59027/// Instantiate a resource method builder
59028///
59029/// ```test_harness,no_run
59030/// # extern crate hyper;
59031/// # extern crate hyper_rustls;
59032/// # extern crate google_dfareporting3d3 as dfareporting3d3;
59033/// use dfareporting3d3::api::PlacementGroup;
59034/// # async fn dox() {
59035/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
59036///
59037/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
59038/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
59039/// #     secret,
59040/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
59041/// # ).build().await.unwrap();
59042///
59043/// # let client = hyper_util::client::legacy::Client::builder(
59044/// #     hyper_util::rt::TokioExecutor::new()
59045/// # )
59046/// # .build(
59047/// #     hyper_rustls::HttpsConnectorBuilder::new()
59048/// #         .with_native_roots()
59049/// #         .unwrap()
59050/// #         .https_or_http()
59051/// #         .enable_http1()
59052/// #         .build()
59053/// # );
59054/// # let mut hub = Dfareporting::new(client, auth);
59055/// // As the method needs a request, you would usually fill it with the desired information
59056/// // into the respective structure. Some of the parts shown here might not be applicable !
59057/// // Values shown here are possibly random and not representative !
59058/// let mut req = PlacementGroup::default();
59059///
59060/// // You can configure optional parameters by calling the respective setters at will, and
59061/// // execute the final call using `doit()`.
59062/// // Values shown here are possibly random and not representative !
59063/// let result = hub.placement_groups().patch(req, -69, -82)
59064///              .doit().await;
59065/// # }
59066/// ```
59067pub struct PlacementGroupPatchCall<'a, C>
59068where
59069    C: 'a,
59070{
59071    hub: &'a Dfareporting<C>,
59072    _request: PlacementGroup,
59073    _profile_id: i64,
59074    _id: i64,
59075    _delegate: Option<&'a mut dyn common::Delegate>,
59076    _additional_params: HashMap<String, String>,
59077    _scopes: BTreeSet<String>,
59078}
59079
59080impl<'a, C> common::CallBuilder for PlacementGroupPatchCall<'a, C> {}
59081
59082impl<'a, C> PlacementGroupPatchCall<'a, C>
59083where
59084    C: common::Connector,
59085{
59086    /// Perform the operation you have build so far.
59087    pub async fn doit(mut self) -> common::Result<(common::Response, PlacementGroup)> {
59088        use std::borrow::Cow;
59089        use std::io::{Read, Seek};
59090
59091        use common::{url::Params, ToParts};
59092        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
59093
59094        let mut dd = common::DefaultDelegate;
59095        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
59096        dlg.begin(common::MethodInfo {
59097            id: "dfareporting.placementGroups.patch",
59098            http_method: hyper::Method::PATCH,
59099        });
59100
59101        for &field in ["alt", "profileId", "id"].iter() {
59102            if self._additional_params.contains_key(field) {
59103                dlg.finished(false);
59104                return Err(common::Error::FieldClash(field));
59105            }
59106        }
59107
59108        let mut params = Params::with_capacity(5 + self._additional_params.len());
59109        params.push("profileId", self._profile_id.to_string());
59110        params.push("id", self._id.to_string());
59111
59112        params.extend(self._additional_params.iter());
59113
59114        params.push("alt", "json");
59115        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/placementGroups";
59116        if self._scopes.is_empty() {
59117            self._scopes
59118                .insert(Scope::Dfatrafficking.as_ref().to_string());
59119        }
59120
59121        #[allow(clippy::single_element_loop)]
59122        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
59123            url = params.uri_replacement(url, param_name, find_this, false);
59124        }
59125        {
59126            let to_remove = ["profileId"];
59127            params.remove_params(&to_remove);
59128        }
59129
59130        let url = params.parse_with_url(&url);
59131
59132        let mut json_mime_type = mime::APPLICATION_JSON;
59133        let mut request_value_reader = {
59134            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
59135            common::remove_json_null_values(&mut value);
59136            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
59137            serde_json::to_writer(&mut dst, &value).unwrap();
59138            dst
59139        };
59140        let request_size = request_value_reader
59141            .seek(std::io::SeekFrom::End(0))
59142            .unwrap();
59143        request_value_reader
59144            .seek(std::io::SeekFrom::Start(0))
59145            .unwrap();
59146
59147        loop {
59148            let token = match self
59149                .hub
59150                .auth
59151                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
59152                .await
59153            {
59154                Ok(token) => token,
59155                Err(e) => match dlg.token(e) {
59156                    Ok(token) => token,
59157                    Err(e) => {
59158                        dlg.finished(false);
59159                        return Err(common::Error::MissingToken(e));
59160                    }
59161                },
59162            };
59163            request_value_reader
59164                .seek(std::io::SeekFrom::Start(0))
59165                .unwrap();
59166            let mut req_result = {
59167                let client = &self.hub.client;
59168                dlg.pre_request();
59169                let mut req_builder = hyper::Request::builder()
59170                    .method(hyper::Method::PATCH)
59171                    .uri(url.as_str())
59172                    .header(USER_AGENT, self.hub._user_agent.clone());
59173
59174                if let Some(token) = token.as_ref() {
59175                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
59176                }
59177
59178                let request = req_builder
59179                    .header(CONTENT_TYPE, json_mime_type.to_string())
59180                    .header(CONTENT_LENGTH, request_size as u64)
59181                    .body(common::to_body(
59182                        request_value_reader.get_ref().clone().into(),
59183                    ));
59184
59185                client.request(request.unwrap()).await
59186            };
59187
59188            match req_result {
59189                Err(err) => {
59190                    if let common::Retry::After(d) = dlg.http_error(&err) {
59191                        sleep(d).await;
59192                        continue;
59193                    }
59194                    dlg.finished(false);
59195                    return Err(common::Error::HttpError(err));
59196                }
59197                Ok(res) => {
59198                    let (mut parts, body) = res.into_parts();
59199                    let mut body = common::Body::new(body);
59200                    if !parts.status.is_success() {
59201                        let bytes = common::to_bytes(body).await.unwrap_or_default();
59202                        let error = serde_json::from_str(&common::to_string(&bytes));
59203                        let response = common::to_response(parts, bytes.into());
59204
59205                        if let common::Retry::After(d) =
59206                            dlg.http_failure(&response, error.as_ref().ok())
59207                        {
59208                            sleep(d).await;
59209                            continue;
59210                        }
59211
59212                        dlg.finished(false);
59213
59214                        return Err(match error {
59215                            Ok(value) => common::Error::BadRequest(value),
59216                            _ => common::Error::Failure(response),
59217                        });
59218                    }
59219                    let response = {
59220                        let bytes = common::to_bytes(body).await.unwrap_or_default();
59221                        let encoded = common::to_string(&bytes);
59222                        match serde_json::from_str(&encoded) {
59223                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
59224                            Err(error) => {
59225                                dlg.response_json_decode_error(&encoded, &error);
59226                                return Err(common::Error::JsonDecodeError(
59227                                    encoded.to_string(),
59228                                    error,
59229                                ));
59230                            }
59231                        }
59232                    };
59233
59234                    dlg.finished(true);
59235                    return Ok(response);
59236                }
59237            }
59238        }
59239    }
59240
59241    ///
59242    /// Sets the *request* property to the given value.
59243    ///
59244    /// Even though the property as already been set when instantiating this call,
59245    /// we provide this method for API completeness.
59246    pub fn request(mut self, new_value: PlacementGroup) -> PlacementGroupPatchCall<'a, C> {
59247        self._request = new_value;
59248        self
59249    }
59250    /// User profile ID associated with this request.
59251    ///
59252    /// Sets the *profile id* path property to the given value.
59253    ///
59254    /// Even though the property as already been set when instantiating this call,
59255    /// we provide this method for API completeness.
59256    pub fn profile_id(mut self, new_value: i64) -> PlacementGroupPatchCall<'a, C> {
59257        self._profile_id = new_value;
59258        self
59259    }
59260    /// PlacementGroup ID.
59261    ///
59262    /// Sets the *id* query property to the given value.
59263    ///
59264    /// Even though the property as already been set when instantiating this call,
59265    /// we provide this method for API completeness.
59266    pub fn id(mut self, new_value: i64) -> PlacementGroupPatchCall<'a, C> {
59267        self._id = new_value;
59268        self
59269    }
59270    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
59271    /// while executing the actual API request.
59272    ///
59273    /// ````text
59274    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
59275    /// ````
59276    ///
59277    /// Sets the *delegate* property to the given value.
59278    pub fn delegate(
59279        mut self,
59280        new_value: &'a mut dyn common::Delegate,
59281    ) -> PlacementGroupPatchCall<'a, C> {
59282        self._delegate = Some(new_value);
59283        self
59284    }
59285
59286    /// Set any additional parameter of the query string used in the request.
59287    /// It should be used to set parameters which are not yet available through their own
59288    /// setters.
59289    ///
59290    /// Please note that this method must not be used to set any of the known parameters
59291    /// which have their own setter method. If done anyway, the request will fail.
59292    ///
59293    /// # Additional Parameters
59294    ///
59295    /// * *$.xgafv* (query-string) - V1 error format.
59296    /// * *access_token* (query-string) - OAuth access token.
59297    /// * *alt* (query-string) - Data format for response.
59298    /// * *callback* (query-string) - JSONP
59299    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
59300    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
59301    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
59302    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
59303    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
59304    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
59305    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
59306    pub fn param<T>(mut self, name: T, value: T) -> PlacementGroupPatchCall<'a, C>
59307    where
59308        T: AsRef<str>,
59309    {
59310        self._additional_params
59311            .insert(name.as_ref().to_string(), value.as_ref().to_string());
59312        self
59313    }
59314
59315    /// Identifies the authorization scope for the method you are building.
59316    ///
59317    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
59318    /// [`Scope::Dfatrafficking`].
59319    ///
59320    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
59321    /// tokens for more than one scope.
59322    ///
59323    /// Usually there is more than one suitable scope to authorize an operation, some of which may
59324    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
59325    /// sufficient, a read-write scope will do as well.
59326    pub fn add_scope<St>(mut self, scope: St) -> PlacementGroupPatchCall<'a, C>
59327    where
59328        St: AsRef<str>,
59329    {
59330        self._scopes.insert(String::from(scope.as_ref()));
59331        self
59332    }
59333    /// Identifies the authorization scope(s) for the method you are building.
59334    ///
59335    /// See [`Self::add_scope()`] for details.
59336    pub fn add_scopes<I, St>(mut self, scopes: I) -> PlacementGroupPatchCall<'a, C>
59337    where
59338        I: IntoIterator<Item = St>,
59339        St: AsRef<str>,
59340    {
59341        self._scopes
59342            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
59343        self
59344    }
59345
59346    /// Removes all scopes, and no default scope will be used either.
59347    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
59348    /// for details).
59349    pub fn clear_scopes(mut self) -> PlacementGroupPatchCall<'a, C> {
59350        self._scopes.clear();
59351        self
59352    }
59353}
59354
59355/// Updates an existing placement group.
59356///
59357/// A builder for the *update* method supported by a *placementGroup* resource.
59358/// It is not used directly, but through a [`PlacementGroupMethods`] instance.
59359///
59360/// # Example
59361///
59362/// Instantiate a resource method builder
59363///
59364/// ```test_harness,no_run
59365/// # extern crate hyper;
59366/// # extern crate hyper_rustls;
59367/// # extern crate google_dfareporting3d3 as dfareporting3d3;
59368/// use dfareporting3d3::api::PlacementGroup;
59369/// # async fn dox() {
59370/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
59371///
59372/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
59373/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
59374/// #     secret,
59375/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
59376/// # ).build().await.unwrap();
59377///
59378/// # let client = hyper_util::client::legacy::Client::builder(
59379/// #     hyper_util::rt::TokioExecutor::new()
59380/// # )
59381/// # .build(
59382/// #     hyper_rustls::HttpsConnectorBuilder::new()
59383/// #         .with_native_roots()
59384/// #         .unwrap()
59385/// #         .https_or_http()
59386/// #         .enable_http1()
59387/// #         .build()
59388/// # );
59389/// # let mut hub = Dfareporting::new(client, auth);
59390/// // As the method needs a request, you would usually fill it with the desired information
59391/// // into the respective structure. Some of the parts shown here might not be applicable !
59392/// // Values shown here are possibly random and not representative !
59393/// let mut req = PlacementGroup::default();
59394///
59395/// // You can configure optional parameters by calling the respective setters at will, and
59396/// // execute the final call using `doit()`.
59397/// // Values shown here are possibly random and not representative !
59398/// let result = hub.placement_groups().update(req, -8)
59399///              .doit().await;
59400/// # }
59401/// ```
59402pub struct PlacementGroupUpdateCall<'a, C>
59403where
59404    C: 'a,
59405{
59406    hub: &'a Dfareporting<C>,
59407    _request: PlacementGroup,
59408    _profile_id: i64,
59409    _delegate: Option<&'a mut dyn common::Delegate>,
59410    _additional_params: HashMap<String, String>,
59411    _scopes: BTreeSet<String>,
59412}
59413
59414impl<'a, C> common::CallBuilder for PlacementGroupUpdateCall<'a, C> {}
59415
59416impl<'a, C> PlacementGroupUpdateCall<'a, C>
59417where
59418    C: common::Connector,
59419{
59420    /// Perform the operation you have build so far.
59421    pub async fn doit(mut self) -> common::Result<(common::Response, PlacementGroup)> {
59422        use std::borrow::Cow;
59423        use std::io::{Read, Seek};
59424
59425        use common::{url::Params, ToParts};
59426        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
59427
59428        let mut dd = common::DefaultDelegate;
59429        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
59430        dlg.begin(common::MethodInfo {
59431            id: "dfareporting.placementGroups.update",
59432            http_method: hyper::Method::PUT,
59433        });
59434
59435        for &field in ["alt", "profileId"].iter() {
59436            if self._additional_params.contains_key(field) {
59437                dlg.finished(false);
59438                return Err(common::Error::FieldClash(field));
59439            }
59440        }
59441
59442        let mut params = Params::with_capacity(4 + self._additional_params.len());
59443        params.push("profileId", self._profile_id.to_string());
59444
59445        params.extend(self._additional_params.iter());
59446
59447        params.push("alt", "json");
59448        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/placementGroups";
59449        if self._scopes.is_empty() {
59450            self._scopes
59451                .insert(Scope::Dfatrafficking.as_ref().to_string());
59452        }
59453
59454        #[allow(clippy::single_element_loop)]
59455        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
59456            url = params.uri_replacement(url, param_name, find_this, false);
59457        }
59458        {
59459            let to_remove = ["profileId"];
59460            params.remove_params(&to_remove);
59461        }
59462
59463        let url = params.parse_with_url(&url);
59464
59465        let mut json_mime_type = mime::APPLICATION_JSON;
59466        let mut request_value_reader = {
59467            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
59468            common::remove_json_null_values(&mut value);
59469            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
59470            serde_json::to_writer(&mut dst, &value).unwrap();
59471            dst
59472        };
59473        let request_size = request_value_reader
59474            .seek(std::io::SeekFrom::End(0))
59475            .unwrap();
59476        request_value_reader
59477            .seek(std::io::SeekFrom::Start(0))
59478            .unwrap();
59479
59480        loop {
59481            let token = match self
59482                .hub
59483                .auth
59484                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
59485                .await
59486            {
59487                Ok(token) => token,
59488                Err(e) => match dlg.token(e) {
59489                    Ok(token) => token,
59490                    Err(e) => {
59491                        dlg.finished(false);
59492                        return Err(common::Error::MissingToken(e));
59493                    }
59494                },
59495            };
59496            request_value_reader
59497                .seek(std::io::SeekFrom::Start(0))
59498                .unwrap();
59499            let mut req_result = {
59500                let client = &self.hub.client;
59501                dlg.pre_request();
59502                let mut req_builder = hyper::Request::builder()
59503                    .method(hyper::Method::PUT)
59504                    .uri(url.as_str())
59505                    .header(USER_AGENT, self.hub._user_agent.clone());
59506
59507                if let Some(token) = token.as_ref() {
59508                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
59509                }
59510
59511                let request = req_builder
59512                    .header(CONTENT_TYPE, json_mime_type.to_string())
59513                    .header(CONTENT_LENGTH, request_size as u64)
59514                    .body(common::to_body(
59515                        request_value_reader.get_ref().clone().into(),
59516                    ));
59517
59518                client.request(request.unwrap()).await
59519            };
59520
59521            match req_result {
59522                Err(err) => {
59523                    if let common::Retry::After(d) = dlg.http_error(&err) {
59524                        sleep(d).await;
59525                        continue;
59526                    }
59527                    dlg.finished(false);
59528                    return Err(common::Error::HttpError(err));
59529                }
59530                Ok(res) => {
59531                    let (mut parts, body) = res.into_parts();
59532                    let mut body = common::Body::new(body);
59533                    if !parts.status.is_success() {
59534                        let bytes = common::to_bytes(body).await.unwrap_or_default();
59535                        let error = serde_json::from_str(&common::to_string(&bytes));
59536                        let response = common::to_response(parts, bytes.into());
59537
59538                        if let common::Retry::After(d) =
59539                            dlg.http_failure(&response, error.as_ref().ok())
59540                        {
59541                            sleep(d).await;
59542                            continue;
59543                        }
59544
59545                        dlg.finished(false);
59546
59547                        return Err(match error {
59548                            Ok(value) => common::Error::BadRequest(value),
59549                            _ => common::Error::Failure(response),
59550                        });
59551                    }
59552                    let response = {
59553                        let bytes = common::to_bytes(body).await.unwrap_or_default();
59554                        let encoded = common::to_string(&bytes);
59555                        match serde_json::from_str(&encoded) {
59556                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
59557                            Err(error) => {
59558                                dlg.response_json_decode_error(&encoded, &error);
59559                                return Err(common::Error::JsonDecodeError(
59560                                    encoded.to_string(),
59561                                    error,
59562                                ));
59563                            }
59564                        }
59565                    };
59566
59567                    dlg.finished(true);
59568                    return Ok(response);
59569                }
59570            }
59571        }
59572    }
59573
59574    ///
59575    /// Sets the *request* property to the given value.
59576    ///
59577    /// Even though the property as already been set when instantiating this call,
59578    /// we provide this method for API completeness.
59579    pub fn request(mut self, new_value: PlacementGroup) -> PlacementGroupUpdateCall<'a, C> {
59580        self._request = new_value;
59581        self
59582    }
59583    /// User profile ID associated with this request.
59584    ///
59585    /// Sets the *profile id* path property to the given value.
59586    ///
59587    /// Even though the property as already been set when instantiating this call,
59588    /// we provide this method for API completeness.
59589    pub fn profile_id(mut self, new_value: i64) -> PlacementGroupUpdateCall<'a, C> {
59590        self._profile_id = new_value;
59591        self
59592    }
59593    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
59594    /// while executing the actual API request.
59595    ///
59596    /// ````text
59597    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
59598    /// ````
59599    ///
59600    /// Sets the *delegate* property to the given value.
59601    pub fn delegate(
59602        mut self,
59603        new_value: &'a mut dyn common::Delegate,
59604    ) -> PlacementGroupUpdateCall<'a, C> {
59605        self._delegate = Some(new_value);
59606        self
59607    }
59608
59609    /// Set any additional parameter of the query string used in the request.
59610    /// It should be used to set parameters which are not yet available through their own
59611    /// setters.
59612    ///
59613    /// Please note that this method must not be used to set any of the known parameters
59614    /// which have their own setter method. If done anyway, the request will fail.
59615    ///
59616    /// # Additional Parameters
59617    ///
59618    /// * *$.xgafv* (query-string) - V1 error format.
59619    /// * *access_token* (query-string) - OAuth access token.
59620    /// * *alt* (query-string) - Data format for response.
59621    /// * *callback* (query-string) - JSONP
59622    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
59623    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
59624    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
59625    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
59626    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
59627    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
59628    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
59629    pub fn param<T>(mut self, name: T, value: T) -> PlacementGroupUpdateCall<'a, C>
59630    where
59631        T: AsRef<str>,
59632    {
59633        self._additional_params
59634            .insert(name.as_ref().to_string(), value.as_ref().to_string());
59635        self
59636    }
59637
59638    /// Identifies the authorization scope for the method you are building.
59639    ///
59640    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
59641    /// [`Scope::Dfatrafficking`].
59642    ///
59643    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
59644    /// tokens for more than one scope.
59645    ///
59646    /// Usually there is more than one suitable scope to authorize an operation, some of which may
59647    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
59648    /// sufficient, a read-write scope will do as well.
59649    pub fn add_scope<St>(mut self, scope: St) -> PlacementGroupUpdateCall<'a, C>
59650    where
59651        St: AsRef<str>,
59652    {
59653        self._scopes.insert(String::from(scope.as_ref()));
59654        self
59655    }
59656    /// Identifies the authorization scope(s) for the method you are building.
59657    ///
59658    /// See [`Self::add_scope()`] for details.
59659    pub fn add_scopes<I, St>(mut self, scopes: I) -> PlacementGroupUpdateCall<'a, C>
59660    where
59661        I: IntoIterator<Item = St>,
59662        St: AsRef<str>,
59663    {
59664        self._scopes
59665            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
59666        self
59667    }
59668
59669    /// Removes all scopes, and no default scope will be used either.
59670    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
59671    /// for details).
59672    pub fn clear_scopes(mut self) -> PlacementGroupUpdateCall<'a, C> {
59673        self._scopes.clear();
59674        self
59675    }
59676}
59677
59678/// Deletes an existing placement strategy.
59679///
59680/// A builder for the *delete* method supported by a *placementStrategy* resource.
59681/// It is not used directly, but through a [`PlacementStrategyMethods`] instance.
59682///
59683/// # Example
59684///
59685/// Instantiate a resource method builder
59686///
59687/// ```test_harness,no_run
59688/// # extern crate hyper;
59689/// # extern crate hyper_rustls;
59690/// # extern crate google_dfareporting3d3 as dfareporting3d3;
59691/// # async fn dox() {
59692/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
59693///
59694/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
59695/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
59696/// #     secret,
59697/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
59698/// # ).build().await.unwrap();
59699///
59700/// # let client = hyper_util::client::legacy::Client::builder(
59701/// #     hyper_util::rt::TokioExecutor::new()
59702/// # )
59703/// # .build(
59704/// #     hyper_rustls::HttpsConnectorBuilder::new()
59705/// #         .with_native_roots()
59706/// #         .unwrap()
59707/// #         .https_or_http()
59708/// #         .enable_http1()
59709/// #         .build()
59710/// # );
59711/// # let mut hub = Dfareporting::new(client, auth);
59712/// // You can configure optional parameters by calling the respective setters at will, and
59713/// // execute the final call using `doit()`.
59714/// // Values shown here are possibly random and not representative !
59715/// let result = hub.placement_strategies().delete(-88, -4)
59716///              .doit().await;
59717/// # }
59718/// ```
59719pub struct PlacementStrategyDeleteCall<'a, C>
59720where
59721    C: 'a,
59722{
59723    hub: &'a Dfareporting<C>,
59724    _profile_id: i64,
59725    _id: i64,
59726    _delegate: Option<&'a mut dyn common::Delegate>,
59727    _additional_params: HashMap<String, String>,
59728    _scopes: BTreeSet<String>,
59729}
59730
59731impl<'a, C> common::CallBuilder for PlacementStrategyDeleteCall<'a, C> {}
59732
59733impl<'a, C> PlacementStrategyDeleteCall<'a, C>
59734where
59735    C: common::Connector,
59736{
59737    /// Perform the operation you have build so far.
59738    pub async fn doit(mut self) -> common::Result<common::Response> {
59739        use std::borrow::Cow;
59740        use std::io::{Read, Seek};
59741
59742        use common::{url::Params, ToParts};
59743        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
59744
59745        let mut dd = common::DefaultDelegate;
59746        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
59747        dlg.begin(common::MethodInfo {
59748            id: "dfareporting.placementStrategies.delete",
59749            http_method: hyper::Method::DELETE,
59750        });
59751
59752        for &field in ["profileId", "id"].iter() {
59753            if self._additional_params.contains_key(field) {
59754                dlg.finished(false);
59755                return Err(common::Error::FieldClash(field));
59756            }
59757        }
59758
59759        let mut params = Params::with_capacity(3 + self._additional_params.len());
59760        params.push("profileId", self._profile_id.to_string());
59761        params.push("id", self._id.to_string());
59762
59763        params.extend(self._additional_params.iter());
59764
59765        let mut url =
59766            self.hub._base_url.clone() + "userprofiles/{profileId}/placementStrategies/{id}";
59767        if self._scopes.is_empty() {
59768            self._scopes
59769                .insert(Scope::Dfatrafficking.as_ref().to_string());
59770        }
59771
59772        #[allow(clippy::single_element_loop)]
59773        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
59774            url = params.uri_replacement(url, param_name, find_this, false);
59775        }
59776        {
59777            let to_remove = ["id", "profileId"];
59778            params.remove_params(&to_remove);
59779        }
59780
59781        let url = params.parse_with_url(&url);
59782
59783        loop {
59784            let token = match self
59785                .hub
59786                .auth
59787                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
59788                .await
59789            {
59790                Ok(token) => token,
59791                Err(e) => match dlg.token(e) {
59792                    Ok(token) => token,
59793                    Err(e) => {
59794                        dlg.finished(false);
59795                        return Err(common::Error::MissingToken(e));
59796                    }
59797                },
59798            };
59799            let mut req_result = {
59800                let client = &self.hub.client;
59801                dlg.pre_request();
59802                let mut req_builder = hyper::Request::builder()
59803                    .method(hyper::Method::DELETE)
59804                    .uri(url.as_str())
59805                    .header(USER_AGENT, self.hub._user_agent.clone());
59806
59807                if let Some(token) = token.as_ref() {
59808                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
59809                }
59810
59811                let request = req_builder
59812                    .header(CONTENT_LENGTH, 0_u64)
59813                    .body(common::to_body::<String>(None));
59814
59815                client.request(request.unwrap()).await
59816            };
59817
59818            match req_result {
59819                Err(err) => {
59820                    if let common::Retry::After(d) = dlg.http_error(&err) {
59821                        sleep(d).await;
59822                        continue;
59823                    }
59824                    dlg.finished(false);
59825                    return Err(common::Error::HttpError(err));
59826                }
59827                Ok(res) => {
59828                    let (mut parts, body) = res.into_parts();
59829                    let mut body = common::Body::new(body);
59830                    if !parts.status.is_success() {
59831                        let bytes = common::to_bytes(body).await.unwrap_or_default();
59832                        let error = serde_json::from_str(&common::to_string(&bytes));
59833                        let response = common::to_response(parts, bytes.into());
59834
59835                        if let common::Retry::After(d) =
59836                            dlg.http_failure(&response, error.as_ref().ok())
59837                        {
59838                            sleep(d).await;
59839                            continue;
59840                        }
59841
59842                        dlg.finished(false);
59843
59844                        return Err(match error {
59845                            Ok(value) => common::Error::BadRequest(value),
59846                            _ => common::Error::Failure(response),
59847                        });
59848                    }
59849                    let response = common::Response::from_parts(parts, body);
59850
59851                    dlg.finished(true);
59852                    return Ok(response);
59853                }
59854            }
59855        }
59856    }
59857
59858    /// User profile ID associated with this request.
59859    ///
59860    /// Sets the *profile id* path property to the given value.
59861    ///
59862    /// Even though the property as already been set when instantiating this call,
59863    /// we provide this method for API completeness.
59864    pub fn profile_id(mut self, new_value: i64) -> PlacementStrategyDeleteCall<'a, C> {
59865        self._profile_id = new_value;
59866        self
59867    }
59868    /// Placement strategy ID.
59869    ///
59870    /// Sets the *id* path property to the given value.
59871    ///
59872    /// Even though the property as already been set when instantiating this call,
59873    /// we provide this method for API completeness.
59874    pub fn id(mut self, new_value: i64) -> PlacementStrategyDeleteCall<'a, C> {
59875        self._id = new_value;
59876        self
59877    }
59878    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
59879    /// while executing the actual API request.
59880    ///
59881    /// ````text
59882    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
59883    /// ````
59884    ///
59885    /// Sets the *delegate* property to the given value.
59886    pub fn delegate(
59887        mut self,
59888        new_value: &'a mut dyn common::Delegate,
59889    ) -> PlacementStrategyDeleteCall<'a, C> {
59890        self._delegate = Some(new_value);
59891        self
59892    }
59893
59894    /// Set any additional parameter of the query string used in the request.
59895    /// It should be used to set parameters which are not yet available through their own
59896    /// setters.
59897    ///
59898    /// Please note that this method must not be used to set any of the known parameters
59899    /// which have their own setter method. If done anyway, the request will fail.
59900    ///
59901    /// # Additional Parameters
59902    ///
59903    /// * *$.xgafv* (query-string) - V1 error format.
59904    /// * *access_token* (query-string) - OAuth access token.
59905    /// * *alt* (query-string) - Data format for response.
59906    /// * *callback* (query-string) - JSONP
59907    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
59908    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
59909    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
59910    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
59911    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
59912    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
59913    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
59914    pub fn param<T>(mut self, name: T, value: T) -> PlacementStrategyDeleteCall<'a, C>
59915    where
59916        T: AsRef<str>,
59917    {
59918        self._additional_params
59919            .insert(name.as_ref().to_string(), value.as_ref().to_string());
59920        self
59921    }
59922
59923    /// Identifies the authorization scope for the method you are building.
59924    ///
59925    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
59926    /// [`Scope::Dfatrafficking`].
59927    ///
59928    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
59929    /// tokens for more than one scope.
59930    ///
59931    /// Usually there is more than one suitable scope to authorize an operation, some of which may
59932    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
59933    /// sufficient, a read-write scope will do as well.
59934    pub fn add_scope<St>(mut self, scope: St) -> PlacementStrategyDeleteCall<'a, C>
59935    where
59936        St: AsRef<str>,
59937    {
59938        self._scopes.insert(String::from(scope.as_ref()));
59939        self
59940    }
59941    /// Identifies the authorization scope(s) for the method you are building.
59942    ///
59943    /// See [`Self::add_scope()`] for details.
59944    pub fn add_scopes<I, St>(mut self, scopes: I) -> PlacementStrategyDeleteCall<'a, C>
59945    where
59946        I: IntoIterator<Item = St>,
59947        St: AsRef<str>,
59948    {
59949        self._scopes
59950            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
59951        self
59952    }
59953
59954    /// Removes all scopes, and no default scope will be used either.
59955    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
59956    /// for details).
59957    pub fn clear_scopes(mut self) -> PlacementStrategyDeleteCall<'a, C> {
59958        self._scopes.clear();
59959        self
59960    }
59961}
59962
59963/// Gets one placement strategy by ID.
59964///
59965/// A builder for the *get* method supported by a *placementStrategy* resource.
59966/// It is not used directly, but through a [`PlacementStrategyMethods`] instance.
59967///
59968/// # Example
59969///
59970/// Instantiate a resource method builder
59971///
59972/// ```test_harness,no_run
59973/// # extern crate hyper;
59974/// # extern crate hyper_rustls;
59975/// # extern crate google_dfareporting3d3 as dfareporting3d3;
59976/// # async fn dox() {
59977/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
59978///
59979/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
59980/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
59981/// #     secret,
59982/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
59983/// # ).build().await.unwrap();
59984///
59985/// # let client = hyper_util::client::legacy::Client::builder(
59986/// #     hyper_util::rt::TokioExecutor::new()
59987/// # )
59988/// # .build(
59989/// #     hyper_rustls::HttpsConnectorBuilder::new()
59990/// #         .with_native_roots()
59991/// #         .unwrap()
59992/// #         .https_or_http()
59993/// #         .enable_http1()
59994/// #         .build()
59995/// # );
59996/// # let mut hub = Dfareporting::new(client, auth);
59997/// // You can configure optional parameters by calling the respective setters at will, and
59998/// // execute the final call using `doit()`.
59999/// // Values shown here are possibly random and not representative !
60000/// let result = hub.placement_strategies().get(-75, -83)
60001///              .doit().await;
60002/// # }
60003/// ```
60004pub struct PlacementStrategyGetCall<'a, C>
60005where
60006    C: 'a,
60007{
60008    hub: &'a Dfareporting<C>,
60009    _profile_id: i64,
60010    _id: i64,
60011    _delegate: Option<&'a mut dyn common::Delegate>,
60012    _additional_params: HashMap<String, String>,
60013    _scopes: BTreeSet<String>,
60014}
60015
60016impl<'a, C> common::CallBuilder for PlacementStrategyGetCall<'a, C> {}
60017
60018impl<'a, C> PlacementStrategyGetCall<'a, C>
60019where
60020    C: common::Connector,
60021{
60022    /// Perform the operation you have build so far.
60023    pub async fn doit(mut self) -> common::Result<(common::Response, PlacementStrategy)> {
60024        use std::borrow::Cow;
60025        use std::io::{Read, Seek};
60026
60027        use common::{url::Params, ToParts};
60028        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
60029
60030        let mut dd = common::DefaultDelegate;
60031        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
60032        dlg.begin(common::MethodInfo {
60033            id: "dfareporting.placementStrategies.get",
60034            http_method: hyper::Method::GET,
60035        });
60036
60037        for &field in ["alt", "profileId", "id"].iter() {
60038            if self._additional_params.contains_key(field) {
60039                dlg.finished(false);
60040                return Err(common::Error::FieldClash(field));
60041            }
60042        }
60043
60044        let mut params = Params::with_capacity(4 + self._additional_params.len());
60045        params.push("profileId", self._profile_id.to_string());
60046        params.push("id", self._id.to_string());
60047
60048        params.extend(self._additional_params.iter());
60049
60050        params.push("alt", "json");
60051        let mut url =
60052            self.hub._base_url.clone() + "userprofiles/{profileId}/placementStrategies/{id}";
60053        if self._scopes.is_empty() {
60054            self._scopes
60055                .insert(Scope::Dfatrafficking.as_ref().to_string());
60056        }
60057
60058        #[allow(clippy::single_element_loop)]
60059        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
60060            url = params.uri_replacement(url, param_name, find_this, false);
60061        }
60062        {
60063            let to_remove = ["id", "profileId"];
60064            params.remove_params(&to_remove);
60065        }
60066
60067        let url = params.parse_with_url(&url);
60068
60069        loop {
60070            let token = match self
60071                .hub
60072                .auth
60073                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
60074                .await
60075            {
60076                Ok(token) => token,
60077                Err(e) => match dlg.token(e) {
60078                    Ok(token) => token,
60079                    Err(e) => {
60080                        dlg.finished(false);
60081                        return Err(common::Error::MissingToken(e));
60082                    }
60083                },
60084            };
60085            let mut req_result = {
60086                let client = &self.hub.client;
60087                dlg.pre_request();
60088                let mut req_builder = hyper::Request::builder()
60089                    .method(hyper::Method::GET)
60090                    .uri(url.as_str())
60091                    .header(USER_AGENT, self.hub._user_agent.clone());
60092
60093                if let Some(token) = token.as_ref() {
60094                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
60095                }
60096
60097                let request = req_builder
60098                    .header(CONTENT_LENGTH, 0_u64)
60099                    .body(common::to_body::<String>(None));
60100
60101                client.request(request.unwrap()).await
60102            };
60103
60104            match req_result {
60105                Err(err) => {
60106                    if let common::Retry::After(d) = dlg.http_error(&err) {
60107                        sleep(d).await;
60108                        continue;
60109                    }
60110                    dlg.finished(false);
60111                    return Err(common::Error::HttpError(err));
60112                }
60113                Ok(res) => {
60114                    let (mut parts, body) = res.into_parts();
60115                    let mut body = common::Body::new(body);
60116                    if !parts.status.is_success() {
60117                        let bytes = common::to_bytes(body).await.unwrap_or_default();
60118                        let error = serde_json::from_str(&common::to_string(&bytes));
60119                        let response = common::to_response(parts, bytes.into());
60120
60121                        if let common::Retry::After(d) =
60122                            dlg.http_failure(&response, error.as_ref().ok())
60123                        {
60124                            sleep(d).await;
60125                            continue;
60126                        }
60127
60128                        dlg.finished(false);
60129
60130                        return Err(match error {
60131                            Ok(value) => common::Error::BadRequest(value),
60132                            _ => common::Error::Failure(response),
60133                        });
60134                    }
60135                    let response = {
60136                        let bytes = common::to_bytes(body).await.unwrap_or_default();
60137                        let encoded = common::to_string(&bytes);
60138                        match serde_json::from_str(&encoded) {
60139                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
60140                            Err(error) => {
60141                                dlg.response_json_decode_error(&encoded, &error);
60142                                return Err(common::Error::JsonDecodeError(
60143                                    encoded.to_string(),
60144                                    error,
60145                                ));
60146                            }
60147                        }
60148                    };
60149
60150                    dlg.finished(true);
60151                    return Ok(response);
60152                }
60153            }
60154        }
60155    }
60156
60157    /// User profile ID associated with this request.
60158    ///
60159    /// Sets the *profile id* path property to the given value.
60160    ///
60161    /// Even though the property as already been set when instantiating this call,
60162    /// we provide this method for API completeness.
60163    pub fn profile_id(mut self, new_value: i64) -> PlacementStrategyGetCall<'a, C> {
60164        self._profile_id = new_value;
60165        self
60166    }
60167    /// Placement strategy ID.
60168    ///
60169    /// Sets the *id* path property to the given value.
60170    ///
60171    /// Even though the property as already been set when instantiating this call,
60172    /// we provide this method for API completeness.
60173    pub fn id(mut self, new_value: i64) -> PlacementStrategyGetCall<'a, C> {
60174        self._id = new_value;
60175        self
60176    }
60177    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
60178    /// while executing the actual API request.
60179    ///
60180    /// ````text
60181    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
60182    /// ````
60183    ///
60184    /// Sets the *delegate* property to the given value.
60185    pub fn delegate(
60186        mut self,
60187        new_value: &'a mut dyn common::Delegate,
60188    ) -> PlacementStrategyGetCall<'a, C> {
60189        self._delegate = Some(new_value);
60190        self
60191    }
60192
60193    /// Set any additional parameter of the query string used in the request.
60194    /// It should be used to set parameters which are not yet available through their own
60195    /// setters.
60196    ///
60197    /// Please note that this method must not be used to set any of the known parameters
60198    /// which have their own setter method. If done anyway, the request will fail.
60199    ///
60200    /// # Additional Parameters
60201    ///
60202    /// * *$.xgafv* (query-string) - V1 error format.
60203    /// * *access_token* (query-string) - OAuth access token.
60204    /// * *alt* (query-string) - Data format for response.
60205    /// * *callback* (query-string) - JSONP
60206    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
60207    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
60208    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
60209    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
60210    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
60211    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
60212    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
60213    pub fn param<T>(mut self, name: T, value: T) -> PlacementStrategyGetCall<'a, C>
60214    where
60215        T: AsRef<str>,
60216    {
60217        self._additional_params
60218            .insert(name.as_ref().to_string(), value.as_ref().to_string());
60219        self
60220    }
60221
60222    /// Identifies the authorization scope for the method you are building.
60223    ///
60224    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
60225    /// [`Scope::Dfatrafficking`].
60226    ///
60227    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
60228    /// tokens for more than one scope.
60229    ///
60230    /// Usually there is more than one suitable scope to authorize an operation, some of which may
60231    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
60232    /// sufficient, a read-write scope will do as well.
60233    pub fn add_scope<St>(mut self, scope: St) -> PlacementStrategyGetCall<'a, C>
60234    where
60235        St: AsRef<str>,
60236    {
60237        self._scopes.insert(String::from(scope.as_ref()));
60238        self
60239    }
60240    /// Identifies the authorization scope(s) for the method you are building.
60241    ///
60242    /// See [`Self::add_scope()`] for details.
60243    pub fn add_scopes<I, St>(mut self, scopes: I) -> PlacementStrategyGetCall<'a, C>
60244    where
60245        I: IntoIterator<Item = St>,
60246        St: AsRef<str>,
60247    {
60248        self._scopes
60249            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
60250        self
60251    }
60252
60253    /// Removes all scopes, and no default scope will be used either.
60254    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
60255    /// for details).
60256    pub fn clear_scopes(mut self) -> PlacementStrategyGetCall<'a, C> {
60257        self._scopes.clear();
60258        self
60259    }
60260}
60261
60262/// Inserts a new placement strategy.
60263///
60264/// A builder for the *insert* method supported by a *placementStrategy* resource.
60265/// It is not used directly, but through a [`PlacementStrategyMethods`] instance.
60266///
60267/// # Example
60268///
60269/// Instantiate a resource method builder
60270///
60271/// ```test_harness,no_run
60272/// # extern crate hyper;
60273/// # extern crate hyper_rustls;
60274/// # extern crate google_dfareporting3d3 as dfareporting3d3;
60275/// use dfareporting3d3::api::PlacementStrategy;
60276/// # async fn dox() {
60277/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
60278///
60279/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
60280/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
60281/// #     secret,
60282/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
60283/// # ).build().await.unwrap();
60284///
60285/// # let client = hyper_util::client::legacy::Client::builder(
60286/// #     hyper_util::rt::TokioExecutor::new()
60287/// # )
60288/// # .build(
60289/// #     hyper_rustls::HttpsConnectorBuilder::new()
60290/// #         .with_native_roots()
60291/// #         .unwrap()
60292/// #         .https_or_http()
60293/// #         .enable_http1()
60294/// #         .build()
60295/// # );
60296/// # let mut hub = Dfareporting::new(client, auth);
60297/// // As the method needs a request, you would usually fill it with the desired information
60298/// // into the respective structure. Some of the parts shown here might not be applicable !
60299/// // Values shown here are possibly random and not representative !
60300/// let mut req = PlacementStrategy::default();
60301///
60302/// // You can configure optional parameters by calling the respective setters at will, and
60303/// // execute the final call using `doit()`.
60304/// // Values shown here are possibly random and not representative !
60305/// let result = hub.placement_strategies().insert(req, -11)
60306///              .doit().await;
60307/// # }
60308/// ```
60309pub struct PlacementStrategyInsertCall<'a, C>
60310where
60311    C: 'a,
60312{
60313    hub: &'a Dfareporting<C>,
60314    _request: PlacementStrategy,
60315    _profile_id: i64,
60316    _delegate: Option<&'a mut dyn common::Delegate>,
60317    _additional_params: HashMap<String, String>,
60318    _scopes: BTreeSet<String>,
60319}
60320
60321impl<'a, C> common::CallBuilder for PlacementStrategyInsertCall<'a, C> {}
60322
60323impl<'a, C> PlacementStrategyInsertCall<'a, C>
60324where
60325    C: common::Connector,
60326{
60327    /// Perform the operation you have build so far.
60328    pub async fn doit(mut self) -> common::Result<(common::Response, PlacementStrategy)> {
60329        use std::borrow::Cow;
60330        use std::io::{Read, Seek};
60331
60332        use common::{url::Params, ToParts};
60333        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
60334
60335        let mut dd = common::DefaultDelegate;
60336        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
60337        dlg.begin(common::MethodInfo {
60338            id: "dfareporting.placementStrategies.insert",
60339            http_method: hyper::Method::POST,
60340        });
60341
60342        for &field in ["alt", "profileId"].iter() {
60343            if self._additional_params.contains_key(field) {
60344                dlg.finished(false);
60345                return Err(common::Error::FieldClash(field));
60346            }
60347        }
60348
60349        let mut params = Params::with_capacity(4 + self._additional_params.len());
60350        params.push("profileId", self._profile_id.to_string());
60351
60352        params.extend(self._additional_params.iter());
60353
60354        params.push("alt", "json");
60355        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/placementStrategies";
60356        if self._scopes.is_empty() {
60357            self._scopes
60358                .insert(Scope::Dfatrafficking.as_ref().to_string());
60359        }
60360
60361        #[allow(clippy::single_element_loop)]
60362        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
60363            url = params.uri_replacement(url, param_name, find_this, false);
60364        }
60365        {
60366            let to_remove = ["profileId"];
60367            params.remove_params(&to_remove);
60368        }
60369
60370        let url = params.parse_with_url(&url);
60371
60372        let mut json_mime_type = mime::APPLICATION_JSON;
60373        let mut request_value_reader = {
60374            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
60375            common::remove_json_null_values(&mut value);
60376            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
60377            serde_json::to_writer(&mut dst, &value).unwrap();
60378            dst
60379        };
60380        let request_size = request_value_reader
60381            .seek(std::io::SeekFrom::End(0))
60382            .unwrap();
60383        request_value_reader
60384            .seek(std::io::SeekFrom::Start(0))
60385            .unwrap();
60386
60387        loop {
60388            let token = match self
60389                .hub
60390                .auth
60391                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
60392                .await
60393            {
60394                Ok(token) => token,
60395                Err(e) => match dlg.token(e) {
60396                    Ok(token) => token,
60397                    Err(e) => {
60398                        dlg.finished(false);
60399                        return Err(common::Error::MissingToken(e));
60400                    }
60401                },
60402            };
60403            request_value_reader
60404                .seek(std::io::SeekFrom::Start(0))
60405                .unwrap();
60406            let mut req_result = {
60407                let client = &self.hub.client;
60408                dlg.pre_request();
60409                let mut req_builder = hyper::Request::builder()
60410                    .method(hyper::Method::POST)
60411                    .uri(url.as_str())
60412                    .header(USER_AGENT, self.hub._user_agent.clone());
60413
60414                if let Some(token) = token.as_ref() {
60415                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
60416                }
60417
60418                let request = req_builder
60419                    .header(CONTENT_TYPE, json_mime_type.to_string())
60420                    .header(CONTENT_LENGTH, request_size as u64)
60421                    .body(common::to_body(
60422                        request_value_reader.get_ref().clone().into(),
60423                    ));
60424
60425                client.request(request.unwrap()).await
60426            };
60427
60428            match req_result {
60429                Err(err) => {
60430                    if let common::Retry::After(d) = dlg.http_error(&err) {
60431                        sleep(d).await;
60432                        continue;
60433                    }
60434                    dlg.finished(false);
60435                    return Err(common::Error::HttpError(err));
60436                }
60437                Ok(res) => {
60438                    let (mut parts, body) = res.into_parts();
60439                    let mut body = common::Body::new(body);
60440                    if !parts.status.is_success() {
60441                        let bytes = common::to_bytes(body).await.unwrap_or_default();
60442                        let error = serde_json::from_str(&common::to_string(&bytes));
60443                        let response = common::to_response(parts, bytes.into());
60444
60445                        if let common::Retry::After(d) =
60446                            dlg.http_failure(&response, error.as_ref().ok())
60447                        {
60448                            sleep(d).await;
60449                            continue;
60450                        }
60451
60452                        dlg.finished(false);
60453
60454                        return Err(match error {
60455                            Ok(value) => common::Error::BadRequest(value),
60456                            _ => common::Error::Failure(response),
60457                        });
60458                    }
60459                    let response = {
60460                        let bytes = common::to_bytes(body).await.unwrap_or_default();
60461                        let encoded = common::to_string(&bytes);
60462                        match serde_json::from_str(&encoded) {
60463                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
60464                            Err(error) => {
60465                                dlg.response_json_decode_error(&encoded, &error);
60466                                return Err(common::Error::JsonDecodeError(
60467                                    encoded.to_string(),
60468                                    error,
60469                                ));
60470                            }
60471                        }
60472                    };
60473
60474                    dlg.finished(true);
60475                    return Ok(response);
60476                }
60477            }
60478        }
60479    }
60480
60481    ///
60482    /// Sets the *request* property to the given value.
60483    ///
60484    /// Even though the property as already been set when instantiating this call,
60485    /// we provide this method for API completeness.
60486    pub fn request(mut self, new_value: PlacementStrategy) -> PlacementStrategyInsertCall<'a, C> {
60487        self._request = new_value;
60488        self
60489    }
60490    /// User profile ID associated with this request.
60491    ///
60492    /// Sets the *profile id* path property to the given value.
60493    ///
60494    /// Even though the property as already been set when instantiating this call,
60495    /// we provide this method for API completeness.
60496    pub fn profile_id(mut self, new_value: i64) -> PlacementStrategyInsertCall<'a, C> {
60497        self._profile_id = new_value;
60498        self
60499    }
60500    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
60501    /// while executing the actual API request.
60502    ///
60503    /// ````text
60504    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
60505    /// ````
60506    ///
60507    /// Sets the *delegate* property to the given value.
60508    pub fn delegate(
60509        mut self,
60510        new_value: &'a mut dyn common::Delegate,
60511    ) -> PlacementStrategyInsertCall<'a, C> {
60512        self._delegate = Some(new_value);
60513        self
60514    }
60515
60516    /// Set any additional parameter of the query string used in the request.
60517    /// It should be used to set parameters which are not yet available through their own
60518    /// setters.
60519    ///
60520    /// Please note that this method must not be used to set any of the known parameters
60521    /// which have their own setter method. If done anyway, the request will fail.
60522    ///
60523    /// # Additional Parameters
60524    ///
60525    /// * *$.xgafv* (query-string) - V1 error format.
60526    /// * *access_token* (query-string) - OAuth access token.
60527    /// * *alt* (query-string) - Data format for response.
60528    /// * *callback* (query-string) - JSONP
60529    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
60530    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
60531    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
60532    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
60533    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
60534    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
60535    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
60536    pub fn param<T>(mut self, name: T, value: T) -> PlacementStrategyInsertCall<'a, C>
60537    where
60538        T: AsRef<str>,
60539    {
60540        self._additional_params
60541            .insert(name.as_ref().to_string(), value.as_ref().to_string());
60542        self
60543    }
60544
60545    /// Identifies the authorization scope for the method you are building.
60546    ///
60547    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
60548    /// [`Scope::Dfatrafficking`].
60549    ///
60550    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
60551    /// tokens for more than one scope.
60552    ///
60553    /// Usually there is more than one suitable scope to authorize an operation, some of which may
60554    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
60555    /// sufficient, a read-write scope will do as well.
60556    pub fn add_scope<St>(mut self, scope: St) -> PlacementStrategyInsertCall<'a, C>
60557    where
60558        St: AsRef<str>,
60559    {
60560        self._scopes.insert(String::from(scope.as_ref()));
60561        self
60562    }
60563    /// Identifies the authorization scope(s) for the method you are building.
60564    ///
60565    /// See [`Self::add_scope()`] for details.
60566    pub fn add_scopes<I, St>(mut self, scopes: I) -> PlacementStrategyInsertCall<'a, C>
60567    where
60568        I: IntoIterator<Item = St>,
60569        St: AsRef<str>,
60570    {
60571        self._scopes
60572            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
60573        self
60574    }
60575
60576    /// Removes all scopes, and no default scope will be used either.
60577    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
60578    /// for details).
60579    pub fn clear_scopes(mut self) -> PlacementStrategyInsertCall<'a, C> {
60580        self._scopes.clear();
60581        self
60582    }
60583}
60584
60585/// Retrieves a list of placement strategies, possibly filtered. This method supports paging.
60586///
60587/// A builder for the *list* method supported by a *placementStrategy* resource.
60588/// It is not used directly, but through a [`PlacementStrategyMethods`] instance.
60589///
60590/// # Example
60591///
60592/// Instantiate a resource method builder
60593///
60594/// ```test_harness,no_run
60595/// # extern crate hyper;
60596/// # extern crate hyper_rustls;
60597/// # extern crate google_dfareporting3d3 as dfareporting3d3;
60598/// # async fn dox() {
60599/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
60600///
60601/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
60602/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
60603/// #     secret,
60604/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
60605/// # ).build().await.unwrap();
60606///
60607/// # let client = hyper_util::client::legacy::Client::builder(
60608/// #     hyper_util::rt::TokioExecutor::new()
60609/// # )
60610/// # .build(
60611/// #     hyper_rustls::HttpsConnectorBuilder::new()
60612/// #         .with_native_roots()
60613/// #         .unwrap()
60614/// #         .https_or_http()
60615/// #         .enable_http1()
60616/// #         .build()
60617/// # );
60618/// # let mut hub = Dfareporting::new(client, auth);
60619/// // You can configure optional parameters by calling the respective setters at will, and
60620/// // execute the final call using `doit()`.
60621/// // Values shown here are possibly random and not representative !
60622/// let result = hub.placement_strategies().list(-12)
60623///              .sort_order("erat")
60624///              .sort_field("aliquyam")
60625///              .search_string("consetetur")
60626///              .page_token("ea")
60627///              .max_results(-101)
60628///              .add_ids(-94)
60629///              .doit().await;
60630/// # }
60631/// ```
60632pub struct PlacementStrategyListCall<'a, C>
60633where
60634    C: 'a,
60635{
60636    hub: &'a Dfareporting<C>,
60637    _profile_id: i64,
60638    _sort_order: Option<String>,
60639    _sort_field: Option<String>,
60640    _search_string: Option<String>,
60641    _page_token: Option<String>,
60642    _max_results: Option<i32>,
60643    _ids: Vec<i64>,
60644    _delegate: Option<&'a mut dyn common::Delegate>,
60645    _additional_params: HashMap<String, String>,
60646    _scopes: BTreeSet<String>,
60647}
60648
60649impl<'a, C> common::CallBuilder for PlacementStrategyListCall<'a, C> {}
60650
60651impl<'a, C> PlacementStrategyListCall<'a, C>
60652where
60653    C: common::Connector,
60654{
60655    /// Perform the operation you have build so far.
60656    pub async fn doit(
60657        mut self,
60658    ) -> common::Result<(common::Response, PlacementStrategiesListResponse)> {
60659        use std::borrow::Cow;
60660        use std::io::{Read, Seek};
60661
60662        use common::{url::Params, ToParts};
60663        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
60664
60665        let mut dd = common::DefaultDelegate;
60666        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
60667        dlg.begin(common::MethodInfo {
60668            id: "dfareporting.placementStrategies.list",
60669            http_method: hyper::Method::GET,
60670        });
60671
60672        for &field in [
60673            "alt",
60674            "profileId",
60675            "sortOrder",
60676            "sortField",
60677            "searchString",
60678            "pageToken",
60679            "maxResults",
60680            "ids",
60681        ]
60682        .iter()
60683        {
60684            if self._additional_params.contains_key(field) {
60685                dlg.finished(false);
60686                return Err(common::Error::FieldClash(field));
60687            }
60688        }
60689
60690        let mut params = Params::with_capacity(9 + self._additional_params.len());
60691        params.push("profileId", self._profile_id.to_string());
60692        if let Some(value) = self._sort_order.as_ref() {
60693            params.push("sortOrder", value);
60694        }
60695        if let Some(value) = self._sort_field.as_ref() {
60696            params.push("sortField", value);
60697        }
60698        if let Some(value) = self._search_string.as_ref() {
60699            params.push("searchString", value);
60700        }
60701        if let Some(value) = self._page_token.as_ref() {
60702            params.push("pageToken", value);
60703        }
60704        if let Some(value) = self._max_results.as_ref() {
60705            params.push("maxResults", value.to_string());
60706        }
60707        if !self._ids.is_empty() {
60708            for f in self._ids.iter() {
60709                params.push("ids", f.to_string());
60710            }
60711        }
60712
60713        params.extend(self._additional_params.iter());
60714
60715        params.push("alt", "json");
60716        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/placementStrategies";
60717        if self._scopes.is_empty() {
60718            self._scopes
60719                .insert(Scope::Dfatrafficking.as_ref().to_string());
60720        }
60721
60722        #[allow(clippy::single_element_loop)]
60723        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
60724            url = params.uri_replacement(url, param_name, find_this, false);
60725        }
60726        {
60727            let to_remove = ["profileId"];
60728            params.remove_params(&to_remove);
60729        }
60730
60731        let url = params.parse_with_url(&url);
60732
60733        loop {
60734            let token = match self
60735                .hub
60736                .auth
60737                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
60738                .await
60739            {
60740                Ok(token) => token,
60741                Err(e) => match dlg.token(e) {
60742                    Ok(token) => token,
60743                    Err(e) => {
60744                        dlg.finished(false);
60745                        return Err(common::Error::MissingToken(e));
60746                    }
60747                },
60748            };
60749            let mut req_result = {
60750                let client = &self.hub.client;
60751                dlg.pre_request();
60752                let mut req_builder = hyper::Request::builder()
60753                    .method(hyper::Method::GET)
60754                    .uri(url.as_str())
60755                    .header(USER_AGENT, self.hub._user_agent.clone());
60756
60757                if let Some(token) = token.as_ref() {
60758                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
60759                }
60760
60761                let request = req_builder
60762                    .header(CONTENT_LENGTH, 0_u64)
60763                    .body(common::to_body::<String>(None));
60764
60765                client.request(request.unwrap()).await
60766            };
60767
60768            match req_result {
60769                Err(err) => {
60770                    if let common::Retry::After(d) = dlg.http_error(&err) {
60771                        sleep(d).await;
60772                        continue;
60773                    }
60774                    dlg.finished(false);
60775                    return Err(common::Error::HttpError(err));
60776                }
60777                Ok(res) => {
60778                    let (mut parts, body) = res.into_parts();
60779                    let mut body = common::Body::new(body);
60780                    if !parts.status.is_success() {
60781                        let bytes = common::to_bytes(body).await.unwrap_or_default();
60782                        let error = serde_json::from_str(&common::to_string(&bytes));
60783                        let response = common::to_response(parts, bytes.into());
60784
60785                        if let common::Retry::After(d) =
60786                            dlg.http_failure(&response, error.as_ref().ok())
60787                        {
60788                            sleep(d).await;
60789                            continue;
60790                        }
60791
60792                        dlg.finished(false);
60793
60794                        return Err(match error {
60795                            Ok(value) => common::Error::BadRequest(value),
60796                            _ => common::Error::Failure(response),
60797                        });
60798                    }
60799                    let response = {
60800                        let bytes = common::to_bytes(body).await.unwrap_or_default();
60801                        let encoded = common::to_string(&bytes);
60802                        match serde_json::from_str(&encoded) {
60803                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
60804                            Err(error) => {
60805                                dlg.response_json_decode_error(&encoded, &error);
60806                                return Err(common::Error::JsonDecodeError(
60807                                    encoded.to_string(),
60808                                    error,
60809                                ));
60810                            }
60811                        }
60812                    };
60813
60814                    dlg.finished(true);
60815                    return Ok(response);
60816                }
60817            }
60818        }
60819    }
60820
60821    /// User profile ID associated with this request.
60822    ///
60823    /// Sets the *profile id* path property to the given value.
60824    ///
60825    /// Even though the property as already been set when instantiating this call,
60826    /// we provide this method for API completeness.
60827    pub fn profile_id(mut self, new_value: i64) -> PlacementStrategyListCall<'a, C> {
60828        self._profile_id = new_value;
60829        self
60830    }
60831    /// Order of sorted results.
60832    ///
60833    /// Sets the *sort order* query property to the given value.
60834    pub fn sort_order(mut self, new_value: &str) -> PlacementStrategyListCall<'a, C> {
60835        self._sort_order = Some(new_value.to_string());
60836        self
60837    }
60838    /// Field by which to sort the list.
60839    ///
60840    /// Sets the *sort field* query property to the given value.
60841    pub fn sort_field(mut self, new_value: &str) -> PlacementStrategyListCall<'a, C> {
60842        self._sort_field = Some(new_value.to_string());
60843        self
60844    }
60845    /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "placementstrategy*2015" will return objects with names like "placementstrategy June 2015", "placementstrategy April 2015", or simply "placementstrategy 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "placementstrategy" will match objects with name "my placementstrategy", "placementstrategy 2015", or simply "placementstrategy".
60846    ///
60847    /// Sets the *search string* query property to the given value.
60848    pub fn search_string(mut self, new_value: &str) -> PlacementStrategyListCall<'a, C> {
60849        self._search_string = Some(new_value.to_string());
60850        self
60851    }
60852    /// Value of the nextPageToken from the previous result page.
60853    ///
60854    /// Sets the *page token* query property to the given value.
60855    pub fn page_token(mut self, new_value: &str) -> PlacementStrategyListCall<'a, C> {
60856        self._page_token = Some(new_value.to_string());
60857        self
60858    }
60859    /// Maximum number of results to return.
60860    ///
60861    /// Sets the *max results* query property to the given value.
60862    pub fn max_results(mut self, new_value: i32) -> PlacementStrategyListCall<'a, C> {
60863        self._max_results = Some(new_value);
60864        self
60865    }
60866    /// Select only placement strategies with these IDs.
60867    ///
60868    /// Append the given value to the *ids* query property.
60869    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
60870    pub fn add_ids(mut self, new_value: i64) -> PlacementStrategyListCall<'a, C> {
60871        self._ids.push(new_value);
60872        self
60873    }
60874    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
60875    /// while executing the actual API request.
60876    ///
60877    /// ````text
60878    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
60879    /// ````
60880    ///
60881    /// Sets the *delegate* property to the given value.
60882    pub fn delegate(
60883        mut self,
60884        new_value: &'a mut dyn common::Delegate,
60885    ) -> PlacementStrategyListCall<'a, C> {
60886        self._delegate = Some(new_value);
60887        self
60888    }
60889
60890    /// Set any additional parameter of the query string used in the request.
60891    /// It should be used to set parameters which are not yet available through their own
60892    /// setters.
60893    ///
60894    /// Please note that this method must not be used to set any of the known parameters
60895    /// which have their own setter method. If done anyway, the request will fail.
60896    ///
60897    /// # Additional Parameters
60898    ///
60899    /// * *$.xgafv* (query-string) - V1 error format.
60900    /// * *access_token* (query-string) - OAuth access token.
60901    /// * *alt* (query-string) - Data format for response.
60902    /// * *callback* (query-string) - JSONP
60903    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
60904    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
60905    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
60906    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
60907    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
60908    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
60909    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
60910    pub fn param<T>(mut self, name: T, value: T) -> PlacementStrategyListCall<'a, C>
60911    where
60912        T: AsRef<str>,
60913    {
60914        self._additional_params
60915            .insert(name.as_ref().to_string(), value.as_ref().to_string());
60916        self
60917    }
60918
60919    /// Identifies the authorization scope for the method you are building.
60920    ///
60921    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
60922    /// [`Scope::Dfatrafficking`].
60923    ///
60924    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
60925    /// tokens for more than one scope.
60926    ///
60927    /// Usually there is more than one suitable scope to authorize an operation, some of which may
60928    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
60929    /// sufficient, a read-write scope will do as well.
60930    pub fn add_scope<St>(mut self, scope: St) -> PlacementStrategyListCall<'a, C>
60931    where
60932        St: AsRef<str>,
60933    {
60934        self._scopes.insert(String::from(scope.as_ref()));
60935        self
60936    }
60937    /// Identifies the authorization scope(s) for the method you are building.
60938    ///
60939    /// See [`Self::add_scope()`] for details.
60940    pub fn add_scopes<I, St>(mut self, scopes: I) -> PlacementStrategyListCall<'a, C>
60941    where
60942        I: IntoIterator<Item = St>,
60943        St: AsRef<str>,
60944    {
60945        self._scopes
60946            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
60947        self
60948    }
60949
60950    /// Removes all scopes, and no default scope will be used either.
60951    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
60952    /// for details).
60953    pub fn clear_scopes(mut self) -> PlacementStrategyListCall<'a, C> {
60954        self._scopes.clear();
60955        self
60956    }
60957}
60958
60959/// Updates an existing placement strategy. This method supports patch semantics.
60960///
60961/// A builder for the *patch* method supported by a *placementStrategy* resource.
60962/// It is not used directly, but through a [`PlacementStrategyMethods`] instance.
60963///
60964/// # Example
60965///
60966/// Instantiate a resource method builder
60967///
60968/// ```test_harness,no_run
60969/// # extern crate hyper;
60970/// # extern crate hyper_rustls;
60971/// # extern crate google_dfareporting3d3 as dfareporting3d3;
60972/// use dfareporting3d3::api::PlacementStrategy;
60973/// # async fn dox() {
60974/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
60975///
60976/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
60977/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
60978/// #     secret,
60979/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
60980/// # ).build().await.unwrap();
60981///
60982/// # let client = hyper_util::client::legacy::Client::builder(
60983/// #     hyper_util::rt::TokioExecutor::new()
60984/// # )
60985/// # .build(
60986/// #     hyper_rustls::HttpsConnectorBuilder::new()
60987/// #         .with_native_roots()
60988/// #         .unwrap()
60989/// #         .https_or_http()
60990/// #         .enable_http1()
60991/// #         .build()
60992/// # );
60993/// # let mut hub = Dfareporting::new(client, auth);
60994/// // As the method needs a request, you would usually fill it with the desired information
60995/// // into the respective structure. Some of the parts shown here might not be applicable !
60996/// // Values shown here are possibly random and not representative !
60997/// let mut req = PlacementStrategy::default();
60998///
60999/// // You can configure optional parameters by calling the respective setters at will, and
61000/// // execute the final call using `doit()`.
61001/// // Values shown here are possibly random and not representative !
61002/// let result = hub.placement_strategies().patch(req, -71, -1)
61003///              .doit().await;
61004/// # }
61005/// ```
61006pub struct PlacementStrategyPatchCall<'a, C>
61007where
61008    C: 'a,
61009{
61010    hub: &'a Dfareporting<C>,
61011    _request: PlacementStrategy,
61012    _profile_id: i64,
61013    _id: i64,
61014    _delegate: Option<&'a mut dyn common::Delegate>,
61015    _additional_params: HashMap<String, String>,
61016    _scopes: BTreeSet<String>,
61017}
61018
61019impl<'a, C> common::CallBuilder for PlacementStrategyPatchCall<'a, C> {}
61020
61021impl<'a, C> PlacementStrategyPatchCall<'a, C>
61022where
61023    C: common::Connector,
61024{
61025    /// Perform the operation you have build so far.
61026    pub async fn doit(mut self) -> common::Result<(common::Response, PlacementStrategy)> {
61027        use std::borrow::Cow;
61028        use std::io::{Read, Seek};
61029
61030        use common::{url::Params, ToParts};
61031        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
61032
61033        let mut dd = common::DefaultDelegate;
61034        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
61035        dlg.begin(common::MethodInfo {
61036            id: "dfareporting.placementStrategies.patch",
61037            http_method: hyper::Method::PATCH,
61038        });
61039
61040        for &field in ["alt", "profileId", "id"].iter() {
61041            if self._additional_params.contains_key(field) {
61042                dlg.finished(false);
61043                return Err(common::Error::FieldClash(field));
61044            }
61045        }
61046
61047        let mut params = Params::with_capacity(5 + self._additional_params.len());
61048        params.push("profileId", self._profile_id.to_string());
61049        params.push("id", self._id.to_string());
61050
61051        params.extend(self._additional_params.iter());
61052
61053        params.push("alt", "json");
61054        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/placementStrategies";
61055        if self._scopes.is_empty() {
61056            self._scopes
61057                .insert(Scope::Dfatrafficking.as_ref().to_string());
61058        }
61059
61060        #[allow(clippy::single_element_loop)]
61061        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
61062            url = params.uri_replacement(url, param_name, find_this, false);
61063        }
61064        {
61065            let to_remove = ["profileId"];
61066            params.remove_params(&to_remove);
61067        }
61068
61069        let url = params.parse_with_url(&url);
61070
61071        let mut json_mime_type = mime::APPLICATION_JSON;
61072        let mut request_value_reader = {
61073            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
61074            common::remove_json_null_values(&mut value);
61075            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
61076            serde_json::to_writer(&mut dst, &value).unwrap();
61077            dst
61078        };
61079        let request_size = request_value_reader
61080            .seek(std::io::SeekFrom::End(0))
61081            .unwrap();
61082        request_value_reader
61083            .seek(std::io::SeekFrom::Start(0))
61084            .unwrap();
61085
61086        loop {
61087            let token = match self
61088                .hub
61089                .auth
61090                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
61091                .await
61092            {
61093                Ok(token) => token,
61094                Err(e) => match dlg.token(e) {
61095                    Ok(token) => token,
61096                    Err(e) => {
61097                        dlg.finished(false);
61098                        return Err(common::Error::MissingToken(e));
61099                    }
61100                },
61101            };
61102            request_value_reader
61103                .seek(std::io::SeekFrom::Start(0))
61104                .unwrap();
61105            let mut req_result = {
61106                let client = &self.hub.client;
61107                dlg.pre_request();
61108                let mut req_builder = hyper::Request::builder()
61109                    .method(hyper::Method::PATCH)
61110                    .uri(url.as_str())
61111                    .header(USER_AGENT, self.hub._user_agent.clone());
61112
61113                if let Some(token) = token.as_ref() {
61114                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
61115                }
61116
61117                let request = req_builder
61118                    .header(CONTENT_TYPE, json_mime_type.to_string())
61119                    .header(CONTENT_LENGTH, request_size as u64)
61120                    .body(common::to_body(
61121                        request_value_reader.get_ref().clone().into(),
61122                    ));
61123
61124                client.request(request.unwrap()).await
61125            };
61126
61127            match req_result {
61128                Err(err) => {
61129                    if let common::Retry::After(d) = dlg.http_error(&err) {
61130                        sleep(d).await;
61131                        continue;
61132                    }
61133                    dlg.finished(false);
61134                    return Err(common::Error::HttpError(err));
61135                }
61136                Ok(res) => {
61137                    let (mut parts, body) = res.into_parts();
61138                    let mut body = common::Body::new(body);
61139                    if !parts.status.is_success() {
61140                        let bytes = common::to_bytes(body).await.unwrap_or_default();
61141                        let error = serde_json::from_str(&common::to_string(&bytes));
61142                        let response = common::to_response(parts, bytes.into());
61143
61144                        if let common::Retry::After(d) =
61145                            dlg.http_failure(&response, error.as_ref().ok())
61146                        {
61147                            sleep(d).await;
61148                            continue;
61149                        }
61150
61151                        dlg.finished(false);
61152
61153                        return Err(match error {
61154                            Ok(value) => common::Error::BadRequest(value),
61155                            _ => common::Error::Failure(response),
61156                        });
61157                    }
61158                    let response = {
61159                        let bytes = common::to_bytes(body).await.unwrap_or_default();
61160                        let encoded = common::to_string(&bytes);
61161                        match serde_json::from_str(&encoded) {
61162                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
61163                            Err(error) => {
61164                                dlg.response_json_decode_error(&encoded, &error);
61165                                return Err(common::Error::JsonDecodeError(
61166                                    encoded.to_string(),
61167                                    error,
61168                                ));
61169                            }
61170                        }
61171                    };
61172
61173                    dlg.finished(true);
61174                    return Ok(response);
61175                }
61176            }
61177        }
61178    }
61179
61180    ///
61181    /// Sets the *request* property to the given value.
61182    ///
61183    /// Even though the property as already been set when instantiating this call,
61184    /// we provide this method for API completeness.
61185    pub fn request(mut self, new_value: PlacementStrategy) -> PlacementStrategyPatchCall<'a, C> {
61186        self._request = new_value;
61187        self
61188    }
61189    /// User profile ID associated with this request.
61190    ///
61191    /// Sets the *profile id* path property to the given value.
61192    ///
61193    /// Even though the property as already been set when instantiating this call,
61194    /// we provide this method for API completeness.
61195    pub fn profile_id(mut self, new_value: i64) -> PlacementStrategyPatchCall<'a, C> {
61196        self._profile_id = new_value;
61197        self
61198    }
61199    /// PlacementStrategy ID.
61200    ///
61201    /// Sets the *id* query property to the given value.
61202    ///
61203    /// Even though the property as already been set when instantiating this call,
61204    /// we provide this method for API completeness.
61205    pub fn id(mut self, new_value: i64) -> PlacementStrategyPatchCall<'a, C> {
61206        self._id = new_value;
61207        self
61208    }
61209    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
61210    /// while executing the actual API request.
61211    ///
61212    /// ````text
61213    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
61214    /// ````
61215    ///
61216    /// Sets the *delegate* property to the given value.
61217    pub fn delegate(
61218        mut self,
61219        new_value: &'a mut dyn common::Delegate,
61220    ) -> PlacementStrategyPatchCall<'a, C> {
61221        self._delegate = Some(new_value);
61222        self
61223    }
61224
61225    /// Set any additional parameter of the query string used in the request.
61226    /// It should be used to set parameters which are not yet available through their own
61227    /// setters.
61228    ///
61229    /// Please note that this method must not be used to set any of the known parameters
61230    /// which have their own setter method. If done anyway, the request will fail.
61231    ///
61232    /// # Additional Parameters
61233    ///
61234    /// * *$.xgafv* (query-string) - V1 error format.
61235    /// * *access_token* (query-string) - OAuth access token.
61236    /// * *alt* (query-string) - Data format for response.
61237    /// * *callback* (query-string) - JSONP
61238    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
61239    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
61240    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
61241    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
61242    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
61243    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
61244    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
61245    pub fn param<T>(mut self, name: T, value: T) -> PlacementStrategyPatchCall<'a, C>
61246    where
61247        T: AsRef<str>,
61248    {
61249        self._additional_params
61250            .insert(name.as_ref().to_string(), value.as_ref().to_string());
61251        self
61252    }
61253
61254    /// Identifies the authorization scope for the method you are building.
61255    ///
61256    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
61257    /// [`Scope::Dfatrafficking`].
61258    ///
61259    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
61260    /// tokens for more than one scope.
61261    ///
61262    /// Usually there is more than one suitable scope to authorize an operation, some of which may
61263    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
61264    /// sufficient, a read-write scope will do as well.
61265    pub fn add_scope<St>(mut self, scope: St) -> PlacementStrategyPatchCall<'a, C>
61266    where
61267        St: AsRef<str>,
61268    {
61269        self._scopes.insert(String::from(scope.as_ref()));
61270        self
61271    }
61272    /// Identifies the authorization scope(s) for the method you are building.
61273    ///
61274    /// See [`Self::add_scope()`] for details.
61275    pub fn add_scopes<I, St>(mut self, scopes: I) -> PlacementStrategyPatchCall<'a, C>
61276    where
61277        I: IntoIterator<Item = St>,
61278        St: AsRef<str>,
61279    {
61280        self._scopes
61281            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
61282        self
61283    }
61284
61285    /// Removes all scopes, and no default scope will be used either.
61286    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
61287    /// for details).
61288    pub fn clear_scopes(mut self) -> PlacementStrategyPatchCall<'a, C> {
61289        self._scopes.clear();
61290        self
61291    }
61292}
61293
61294/// Updates an existing placement strategy.
61295///
61296/// A builder for the *update* method supported by a *placementStrategy* resource.
61297/// It is not used directly, but through a [`PlacementStrategyMethods`] instance.
61298///
61299/// # Example
61300///
61301/// Instantiate a resource method builder
61302///
61303/// ```test_harness,no_run
61304/// # extern crate hyper;
61305/// # extern crate hyper_rustls;
61306/// # extern crate google_dfareporting3d3 as dfareporting3d3;
61307/// use dfareporting3d3::api::PlacementStrategy;
61308/// # async fn dox() {
61309/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
61310///
61311/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
61312/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
61313/// #     secret,
61314/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
61315/// # ).build().await.unwrap();
61316///
61317/// # let client = hyper_util::client::legacy::Client::builder(
61318/// #     hyper_util::rt::TokioExecutor::new()
61319/// # )
61320/// # .build(
61321/// #     hyper_rustls::HttpsConnectorBuilder::new()
61322/// #         .with_native_roots()
61323/// #         .unwrap()
61324/// #         .https_or_http()
61325/// #         .enable_http1()
61326/// #         .build()
61327/// # );
61328/// # let mut hub = Dfareporting::new(client, auth);
61329/// // As the method needs a request, you would usually fill it with the desired information
61330/// // into the respective structure. Some of the parts shown here might not be applicable !
61331/// // Values shown here are possibly random and not representative !
61332/// let mut req = PlacementStrategy::default();
61333///
61334/// // You can configure optional parameters by calling the respective setters at will, and
61335/// // execute the final call using `doit()`.
61336/// // Values shown here are possibly random and not representative !
61337/// let result = hub.placement_strategies().update(req, -56)
61338///              .doit().await;
61339/// # }
61340/// ```
61341pub struct PlacementStrategyUpdateCall<'a, C>
61342where
61343    C: 'a,
61344{
61345    hub: &'a Dfareporting<C>,
61346    _request: PlacementStrategy,
61347    _profile_id: i64,
61348    _delegate: Option<&'a mut dyn common::Delegate>,
61349    _additional_params: HashMap<String, String>,
61350    _scopes: BTreeSet<String>,
61351}
61352
61353impl<'a, C> common::CallBuilder for PlacementStrategyUpdateCall<'a, C> {}
61354
61355impl<'a, C> PlacementStrategyUpdateCall<'a, C>
61356where
61357    C: common::Connector,
61358{
61359    /// Perform the operation you have build so far.
61360    pub async fn doit(mut self) -> common::Result<(common::Response, PlacementStrategy)> {
61361        use std::borrow::Cow;
61362        use std::io::{Read, Seek};
61363
61364        use common::{url::Params, ToParts};
61365        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
61366
61367        let mut dd = common::DefaultDelegate;
61368        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
61369        dlg.begin(common::MethodInfo {
61370            id: "dfareporting.placementStrategies.update",
61371            http_method: hyper::Method::PUT,
61372        });
61373
61374        for &field in ["alt", "profileId"].iter() {
61375            if self._additional_params.contains_key(field) {
61376                dlg.finished(false);
61377                return Err(common::Error::FieldClash(field));
61378            }
61379        }
61380
61381        let mut params = Params::with_capacity(4 + self._additional_params.len());
61382        params.push("profileId", self._profile_id.to_string());
61383
61384        params.extend(self._additional_params.iter());
61385
61386        params.push("alt", "json");
61387        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/placementStrategies";
61388        if self._scopes.is_empty() {
61389            self._scopes
61390                .insert(Scope::Dfatrafficking.as_ref().to_string());
61391        }
61392
61393        #[allow(clippy::single_element_loop)]
61394        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
61395            url = params.uri_replacement(url, param_name, find_this, false);
61396        }
61397        {
61398            let to_remove = ["profileId"];
61399            params.remove_params(&to_remove);
61400        }
61401
61402        let url = params.parse_with_url(&url);
61403
61404        let mut json_mime_type = mime::APPLICATION_JSON;
61405        let mut request_value_reader = {
61406            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
61407            common::remove_json_null_values(&mut value);
61408            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
61409            serde_json::to_writer(&mut dst, &value).unwrap();
61410            dst
61411        };
61412        let request_size = request_value_reader
61413            .seek(std::io::SeekFrom::End(0))
61414            .unwrap();
61415        request_value_reader
61416            .seek(std::io::SeekFrom::Start(0))
61417            .unwrap();
61418
61419        loop {
61420            let token = match self
61421                .hub
61422                .auth
61423                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
61424                .await
61425            {
61426                Ok(token) => token,
61427                Err(e) => match dlg.token(e) {
61428                    Ok(token) => token,
61429                    Err(e) => {
61430                        dlg.finished(false);
61431                        return Err(common::Error::MissingToken(e));
61432                    }
61433                },
61434            };
61435            request_value_reader
61436                .seek(std::io::SeekFrom::Start(0))
61437                .unwrap();
61438            let mut req_result = {
61439                let client = &self.hub.client;
61440                dlg.pre_request();
61441                let mut req_builder = hyper::Request::builder()
61442                    .method(hyper::Method::PUT)
61443                    .uri(url.as_str())
61444                    .header(USER_AGENT, self.hub._user_agent.clone());
61445
61446                if let Some(token) = token.as_ref() {
61447                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
61448                }
61449
61450                let request = req_builder
61451                    .header(CONTENT_TYPE, json_mime_type.to_string())
61452                    .header(CONTENT_LENGTH, request_size as u64)
61453                    .body(common::to_body(
61454                        request_value_reader.get_ref().clone().into(),
61455                    ));
61456
61457                client.request(request.unwrap()).await
61458            };
61459
61460            match req_result {
61461                Err(err) => {
61462                    if let common::Retry::After(d) = dlg.http_error(&err) {
61463                        sleep(d).await;
61464                        continue;
61465                    }
61466                    dlg.finished(false);
61467                    return Err(common::Error::HttpError(err));
61468                }
61469                Ok(res) => {
61470                    let (mut parts, body) = res.into_parts();
61471                    let mut body = common::Body::new(body);
61472                    if !parts.status.is_success() {
61473                        let bytes = common::to_bytes(body).await.unwrap_or_default();
61474                        let error = serde_json::from_str(&common::to_string(&bytes));
61475                        let response = common::to_response(parts, bytes.into());
61476
61477                        if let common::Retry::After(d) =
61478                            dlg.http_failure(&response, error.as_ref().ok())
61479                        {
61480                            sleep(d).await;
61481                            continue;
61482                        }
61483
61484                        dlg.finished(false);
61485
61486                        return Err(match error {
61487                            Ok(value) => common::Error::BadRequest(value),
61488                            _ => common::Error::Failure(response),
61489                        });
61490                    }
61491                    let response = {
61492                        let bytes = common::to_bytes(body).await.unwrap_or_default();
61493                        let encoded = common::to_string(&bytes);
61494                        match serde_json::from_str(&encoded) {
61495                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
61496                            Err(error) => {
61497                                dlg.response_json_decode_error(&encoded, &error);
61498                                return Err(common::Error::JsonDecodeError(
61499                                    encoded.to_string(),
61500                                    error,
61501                                ));
61502                            }
61503                        }
61504                    };
61505
61506                    dlg.finished(true);
61507                    return Ok(response);
61508                }
61509            }
61510        }
61511    }
61512
61513    ///
61514    /// Sets the *request* property to the given value.
61515    ///
61516    /// Even though the property as already been set when instantiating this call,
61517    /// we provide this method for API completeness.
61518    pub fn request(mut self, new_value: PlacementStrategy) -> PlacementStrategyUpdateCall<'a, C> {
61519        self._request = new_value;
61520        self
61521    }
61522    /// User profile ID associated with this request.
61523    ///
61524    /// Sets the *profile id* path property to the given value.
61525    ///
61526    /// Even though the property as already been set when instantiating this call,
61527    /// we provide this method for API completeness.
61528    pub fn profile_id(mut self, new_value: i64) -> PlacementStrategyUpdateCall<'a, C> {
61529        self._profile_id = new_value;
61530        self
61531    }
61532    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
61533    /// while executing the actual API request.
61534    ///
61535    /// ````text
61536    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
61537    /// ````
61538    ///
61539    /// Sets the *delegate* property to the given value.
61540    pub fn delegate(
61541        mut self,
61542        new_value: &'a mut dyn common::Delegate,
61543    ) -> PlacementStrategyUpdateCall<'a, C> {
61544        self._delegate = Some(new_value);
61545        self
61546    }
61547
61548    /// Set any additional parameter of the query string used in the request.
61549    /// It should be used to set parameters which are not yet available through their own
61550    /// setters.
61551    ///
61552    /// Please note that this method must not be used to set any of the known parameters
61553    /// which have their own setter method. If done anyway, the request will fail.
61554    ///
61555    /// # Additional Parameters
61556    ///
61557    /// * *$.xgafv* (query-string) - V1 error format.
61558    /// * *access_token* (query-string) - OAuth access token.
61559    /// * *alt* (query-string) - Data format for response.
61560    /// * *callback* (query-string) - JSONP
61561    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
61562    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
61563    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
61564    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
61565    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
61566    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
61567    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
61568    pub fn param<T>(mut self, name: T, value: T) -> PlacementStrategyUpdateCall<'a, C>
61569    where
61570        T: AsRef<str>,
61571    {
61572        self._additional_params
61573            .insert(name.as_ref().to_string(), value.as_ref().to_string());
61574        self
61575    }
61576
61577    /// Identifies the authorization scope for the method you are building.
61578    ///
61579    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
61580    /// [`Scope::Dfatrafficking`].
61581    ///
61582    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
61583    /// tokens for more than one scope.
61584    ///
61585    /// Usually there is more than one suitable scope to authorize an operation, some of which may
61586    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
61587    /// sufficient, a read-write scope will do as well.
61588    pub fn add_scope<St>(mut self, scope: St) -> PlacementStrategyUpdateCall<'a, C>
61589    where
61590        St: AsRef<str>,
61591    {
61592        self._scopes.insert(String::from(scope.as_ref()));
61593        self
61594    }
61595    /// Identifies the authorization scope(s) for the method you are building.
61596    ///
61597    /// See [`Self::add_scope()`] for details.
61598    pub fn add_scopes<I, St>(mut self, scopes: I) -> PlacementStrategyUpdateCall<'a, C>
61599    where
61600        I: IntoIterator<Item = St>,
61601        St: AsRef<str>,
61602    {
61603        self._scopes
61604            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
61605        self
61606    }
61607
61608    /// Removes all scopes, and no default scope will be used either.
61609    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
61610    /// for details).
61611    pub fn clear_scopes(mut self) -> PlacementStrategyUpdateCall<'a, C> {
61612        self._scopes.clear();
61613        self
61614    }
61615}
61616
61617/// Generates tags for a placement.
61618///
61619/// A builder for the *generatetags* method supported by a *placement* resource.
61620/// It is not used directly, but through a [`PlacementMethods`] instance.
61621///
61622/// # Example
61623///
61624/// Instantiate a resource method builder
61625///
61626/// ```test_harness,no_run
61627/// # extern crate hyper;
61628/// # extern crate hyper_rustls;
61629/// # extern crate google_dfareporting3d3 as dfareporting3d3;
61630/// # async fn dox() {
61631/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
61632///
61633/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
61634/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
61635/// #     secret,
61636/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
61637/// # ).build().await.unwrap();
61638///
61639/// # let client = hyper_util::client::legacy::Client::builder(
61640/// #     hyper_util::rt::TokioExecutor::new()
61641/// # )
61642/// # .build(
61643/// #     hyper_rustls::HttpsConnectorBuilder::new()
61644/// #         .with_native_roots()
61645/// #         .unwrap()
61646/// #         .https_or_http()
61647/// #         .enable_http1()
61648/// #         .build()
61649/// # );
61650/// # let mut hub = Dfareporting::new(client, auth);
61651/// // You can configure optional parameters by calling the respective setters at will, and
61652/// // execute the final call using `doit()`.
61653/// // Values shown here are possibly random and not representative !
61654/// let result = hub.placements().generatetags(-86)
61655///              .add_tag_formats("gubergren")
61656///              .add_placement_ids(-76)
61657///              .campaign_id(-17)
61658///              .doit().await;
61659/// # }
61660/// ```
61661pub struct PlacementGeneratetagCall<'a, C>
61662where
61663    C: 'a,
61664{
61665    hub: &'a Dfareporting<C>,
61666    _profile_id: i64,
61667    _tag_formats: Vec<String>,
61668    _placement_ids: Vec<i64>,
61669    _campaign_id: Option<i64>,
61670    _delegate: Option<&'a mut dyn common::Delegate>,
61671    _additional_params: HashMap<String, String>,
61672    _scopes: BTreeSet<String>,
61673}
61674
61675impl<'a, C> common::CallBuilder for PlacementGeneratetagCall<'a, C> {}
61676
61677impl<'a, C> PlacementGeneratetagCall<'a, C>
61678where
61679    C: common::Connector,
61680{
61681    /// Perform the operation you have build so far.
61682    pub async fn doit(
61683        mut self,
61684    ) -> common::Result<(common::Response, PlacementsGenerateTagsResponse)> {
61685        use std::borrow::Cow;
61686        use std::io::{Read, Seek};
61687
61688        use common::{url::Params, ToParts};
61689        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
61690
61691        let mut dd = common::DefaultDelegate;
61692        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
61693        dlg.begin(common::MethodInfo {
61694            id: "dfareporting.placements.generatetags",
61695            http_method: hyper::Method::POST,
61696        });
61697
61698        for &field in [
61699            "alt",
61700            "profileId",
61701            "tagFormats",
61702            "placementIds",
61703            "campaignId",
61704        ]
61705        .iter()
61706        {
61707            if self._additional_params.contains_key(field) {
61708                dlg.finished(false);
61709                return Err(common::Error::FieldClash(field));
61710            }
61711        }
61712
61713        let mut params = Params::with_capacity(6 + self._additional_params.len());
61714        params.push("profileId", self._profile_id.to_string());
61715        if !self._tag_formats.is_empty() {
61716            for f in self._tag_formats.iter() {
61717                params.push("tagFormats", f);
61718            }
61719        }
61720        if !self._placement_ids.is_empty() {
61721            for f in self._placement_ids.iter() {
61722                params.push("placementIds", f.to_string());
61723            }
61724        }
61725        if let Some(value) = self._campaign_id.as_ref() {
61726            params.push("campaignId", value.to_string());
61727        }
61728
61729        params.extend(self._additional_params.iter());
61730
61731        params.push("alt", "json");
61732        let mut url =
61733            self.hub._base_url.clone() + "userprofiles/{profileId}/placements/generatetags";
61734        if self._scopes.is_empty() {
61735            self._scopes
61736                .insert(Scope::Dfatrafficking.as_ref().to_string());
61737        }
61738
61739        #[allow(clippy::single_element_loop)]
61740        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
61741            url = params.uri_replacement(url, param_name, find_this, false);
61742        }
61743        {
61744            let to_remove = ["profileId"];
61745            params.remove_params(&to_remove);
61746        }
61747
61748        let url = params.parse_with_url(&url);
61749
61750        loop {
61751            let token = match self
61752                .hub
61753                .auth
61754                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
61755                .await
61756            {
61757                Ok(token) => token,
61758                Err(e) => match dlg.token(e) {
61759                    Ok(token) => token,
61760                    Err(e) => {
61761                        dlg.finished(false);
61762                        return Err(common::Error::MissingToken(e));
61763                    }
61764                },
61765            };
61766            let mut req_result = {
61767                let client = &self.hub.client;
61768                dlg.pre_request();
61769                let mut req_builder = hyper::Request::builder()
61770                    .method(hyper::Method::POST)
61771                    .uri(url.as_str())
61772                    .header(USER_AGENT, self.hub._user_agent.clone());
61773
61774                if let Some(token) = token.as_ref() {
61775                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
61776                }
61777
61778                let request = req_builder
61779                    .header(CONTENT_LENGTH, 0_u64)
61780                    .body(common::to_body::<String>(None));
61781
61782                client.request(request.unwrap()).await
61783            };
61784
61785            match req_result {
61786                Err(err) => {
61787                    if let common::Retry::After(d) = dlg.http_error(&err) {
61788                        sleep(d).await;
61789                        continue;
61790                    }
61791                    dlg.finished(false);
61792                    return Err(common::Error::HttpError(err));
61793                }
61794                Ok(res) => {
61795                    let (mut parts, body) = res.into_parts();
61796                    let mut body = common::Body::new(body);
61797                    if !parts.status.is_success() {
61798                        let bytes = common::to_bytes(body).await.unwrap_or_default();
61799                        let error = serde_json::from_str(&common::to_string(&bytes));
61800                        let response = common::to_response(parts, bytes.into());
61801
61802                        if let common::Retry::After(d) =
61803                            dlg.http_failure(&response, error.as_ref().ok())
61804                        {
61805                            sleep(d).await;
61806                            continue;
61807                        }
61808
61809                        dlg.finished(false);
61810
61811                        return Err(match error {
61812                            Ok(value) => common::Error::BadRequest(value),
61813                            _ => common::Error::Failure(response),
61814                        });
61815                    }
61816                    let response = {
61817                        let bytes = common::to_bytes(body).await.unwrap_or_default();
61818                        let encoded = common::to_string(&bytes);
61819                        match serde_json::from_str(&encoded) {
61820                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
61821                            Err(error) => {
61822                                dlg.response_json_decode_error(&encoded, &error);
61823                                return Err(common::Error::JsonDecodeError(
61824                                    encoded.to_string(),
61825                                    error,
61826                                ));
61827                            }
61828                        }
61829                    };
61830
61831                    dlg.finished(true);
61832                    return Ok(response);
61833                }
61834            }
61835        }
61836    }
61837
61838    /// User profile ID associated with this request.
61839    ///
61840    /// Sets the *profile id* path property to the given value.
61841    ///
61842    /// Even though the property as already been set when instantiating this call,
61843    /// we provide this method for API completeness.
61844    pub fn profile_id(mut self, new_value: i64) -> PlacementGeneratetagCall<'a, C> {
61845        self._profile_id = new_value;
61846        self
61847    }
61848    /// Tag formats to generate for these placements. *Note:* PLACEMENT_TAG_STANDARD can only be generated for 1x1 placements.
61849    ///
61850    /// Append the given value to the *tag formats* query property.
61851    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
61852    pub fn add_tag_formats(mut self, new_value: &str) -> PlacementGeneratetagCall<'a, C> {
61853        self._tag_formats.push(new_value.to_string());
61854        self
61855    }
61856    /// Generate tags for these placements.
61857    ///
61858    /// Append the given value to the *placement ids* query property.
61859    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
61860    pub fn add_placement_ids(mut self, new_value: i64) -> PlacementGeneratetagCall<'a, C> {
61861        self._placement_ids.push(new_value);
61862        self
61863    }
61864    /// Generate placements belonging to this campaign. This is a required field.
61865    ///
61866    /// Sets the *campaign id* query property to the given value.
61867    pub fn campaign_id(mut self, new_value: i64) -> PlacementGeneratetagCall<'a, C> {
61868        self._campaign_id = Some(new_value);
61869        self
61870    }
61871    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
61872    /// while executing the actual API request.
61873    ///
61874    /// ````text
61875    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
61876    /// ````
61877    ///
61878    /// Sets the *delegate* property to the given value.
61879    pub fn delegate(
61880        mut self,
61881        new_value: &'a mut dyn common::Delegate,
61882    ) -> PlacementGeneratetagCall<'a, C> {
61883        self._delegate = Some(new_value);
61884        self
61885    }
61886
61887    /// Set any additional parameter of the query string used in the request.
61888    /// It should be used to set parameters which are not yet available through their own
61889    /// setters.
61890    ///
61891    /// Please note that this method must not be used to set any of the known parameters
61892    /// which have their own setter method. If done anyway, the request will fail.
61893    ///
61894    /// # Additional Parameters
61895    ///
61896    /// * *$.xgafv* (query-string) - V1 error format.
61897    /// * *access_token* (query-string) - OAuth access token.
61898    /// * *alt* (query-string) - Data format for response.
61899    /// * *callback* (query-string) - JSONP
61900    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
61901    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
61902    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
61903    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
61904    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
61905    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
61906    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
61907    pub fn param<T>(mut self, name: T, value: T) -> PlacementGeneratetagCall<'a, C>
61908    where
61909        T: AsRef<str>,
61910    {
61911        self._additional_params
61912            .insert(name.as_ref().to_string(), value.as_ref().to_string());
61913        self
61914    }
61915
61916    /// Identifies the authorization scope for the method you are building.
61917    ///
61918    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
61919    /// [`Scope::Dfatrafficking`].
61920    ///
61921    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
61922    /// tokens for more than one scope.
61923    ///
61924    /// Usually there is more than one suitable scope to authorize an operation, some of which may
61925    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
61926    /// sufficient, a read-write scope will do as well.
61927    pub fn add_scope<St>(mut self, scope: St) -> PlacementGeneratetagCall<'a, C>
61928    where
61929        St: AsRef<str>,
61930    {
61931        self._scopes.insert(String::from(scope.as_ref()));
61932        self
61933    }
61934    /// Identifies the authorization scope(s) for the method you are building.
61935    ///
61936    /// See [`Self::add_scope()`] for details.
61937    pub fn add_scopes<I, St>(mut self, scopes: I) -> PlacementGeneratetagCall<'a, C>
61938    where
61939        I: IntoIterator<Item = St>,
61940        St: AsRef<str>,
61941    {
61942        self._scopes
61943            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
61944        self
61945    }
61946
61947    /// Removes all scopes, and no default scope will be used either.
61948    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
61949    /// for details).
61950    pub fn clear_scopes(mut self) -> PlacementGeneratetagCall<'a, C> {
61951        self._scopes.clear();
61952        self
61953    }
61954}
61955
61956/// Gets one placement by ID.
61957///
61958/// A builder for the *get* method supported by a *placement* resource.
61959/// It is not used directly, but through a [`PlacementMethods`] instance.
61960///
61961/// # Example
61962///
61963/// Instantiate a resource method builder
61964///
61965/// ```test_harness,no_run
61966/// # extern crate hyper;
61967/// # extern crate hyper_rustls;
61968/// # extern crate google_dfareporting3d3 as dfareporting3d3;
61969/// # async fn dox() {
61970/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
61971///
61972/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
61973/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
61974/// #     secret,
61975/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
61976/// # ).build().await.unwrap();
61977///
61978/// # let client = hyper_util::client::legacy::Client::builder(
61979/// #     hyper_util::rt::TokioExecutor::new()
61980/// # )
61981/// # .build(
61982/// #     hyper_rustls::HttpsConnectorBuilder::new()
61983/// #         .with_native_roots()
61984/// #         .unwrap()
61985/// #         .https_or_http()
61986/// #         .enable_http1()
61987/// #         .build()
61988/// # );
61989/// # let mut hub = Dfareporting::new(client, auth);
61990/// // You can configure optional parameters by calling the respective setters at will, and
61991/// // execute the final call using `doit()`.
61992/// // Values shown here are possibly random and not representative !
61993/// let result = hub.placements().get(-93, -8)
61994///              .doit().await;
61995/// # }
61996/// ```
61997pub struct PlacementGetCall<'a, C>
61998where
61999    C: 'a,
62000{
62001    hub: &'a Dfareporting<C>,
62002    _profile_id: i64,
62003    _id: i64,
62004    _delegate: Option<&'a mut dyn common::Delegate>,
62005    _additional_params: HashMap<String, String>,
62006    _scopes: BTreeSet<String>,
62007}
62008
62009impl<'a, C> common::CallBuilder for PlacementGetCall<'a, C> {}
62010
62011impl<'a, C> PlacementGetCall<'a, C>
62012where
62013    C: common::Connector,
62014{
62015    /// Perform the operation you have build so far.
62016    pub async fn doit(mut self) -> common::Result<(common::Response, Placement)> {
62017        use std::borrow::Cow;
62018        use std::io::{Read, Seek};
62019
62020        use common::{url::Params, ToParts};
62021        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
62022
62023        let mut dd = common::DefaultDelegate;
62024        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
62025        dlg.begin(common::MethodInfo {
62026            id: "dfareporting.placements.get",
62027            http_method: hyper::Method::GET,
62028        });
62029
62030        for &field in ["alt", "profileId", "id"].iter() {
62031            if self._additional_params.contains_key(field) {
62032                dlg.finished(false);
62033                return Err(common::Error::FieldClash(field));
62034            }
62035        }
62036
62037        let mut params = Params::with_capacity(4 + self._additional_params.len());
62038        params.push("profileId", self._profile_id.to_string());
62039        params.push("id", self._id.to_string());
62040
62041        params.extend(self._additional_params.iter());
62042
62043        params.push("alt", "json");
62044        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/placements/{id}";
62045        if self._scopes.is_empty() {
62046            self._scopes
62047                .insert(Scope::Dfatrafficking.as_ref().to_string());
62048        }
62049
62050        #[allow(clippy::single_element_loop)]
62051        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
62052            url = params.uri_replacement(url, param_name, find_this, false);
62053        }
62054        {
62055            let to_remove = ["id", "profileId"];
62056            params.remove_params(&to_remove);
62057        }
62058
62059        let url = params.parse_with_url(&url);
62060
62061        loop {
62062            let token = match self
62063                .hub
62064                .auth
62065                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
62066                .await
62067            {
62068                Ok(token) => token,
62069                Err(e) => match dlg.token(e) {
62070                    Ok(token) => token,
62071                    Err(e) => {
62072                        dlg.finished(false);
62073                        return Err(common::Error::MissingToken(e));
62074                    }
62075                },
62076            };
62077            let mut req_result = {
62078                let client = &self.hub.client;
62079                dlg.pre_request();
62080                let mut req_builder = hyper::Request::builder()
62081                    .method(hyper::Method::GET)
62082                    .uri(url.as_str())
62083                    .header(USER_AGENT, self.hub._user_agent.clone());
62084
62085                if let Some(token) = token.as_ref() {
62086                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
62087                }
62088
62089                let request = req_builder
62090                    .header(CONTENT_LENGTH, 0_u64)
62091                    .body(common::to_body::<String>(None));
62092
62093                client.request(request.unwrap()).await
62094            };
62095
62096            match req_result {
62097                Err(err) => {
62098                    if let common::Retry::After(d) = dlg.http_error(&err) {
62099                        sleep(d).await;
62100                        continue;
62101                    }
62102                    dlg.finished(false);
62103                    return Err(common::Error::HttpError(err));
62104                }
62105                Ok(res) => {
62106                    let (mut parts, body) = res.into_parts();
62107                    let mut body = common::Body::new(body);
62108                    if !parts.status.is_success() {
62109                        let bytes = common::to_bytes(body).await.unwrap_or_default();
62110                        let error = serde_json::from_str(&common::to_string(&bytes));
62111                        let response = common::to_response(parts, bytes.into());
62112
62113                        if let common::Retry::After(d) =
62114                            dlg.http_failure(&response, error.as_ref().ok())
62115                        {
62116                            sleep(d).await;
62117                            continue;
62118                        }
62119
62120                        dlg.finished(false);
62121
62122                        return Err(match error {
62123                            Ok(value) => common::Error::BadRequest(value),
62124                            _ => common::Error::Failure(response),
62125                        });
62126                    }
62127                    let response = {
62128                        let bytes = common::to_bytes(body).await.unwrap_or_default();
62129                        let encoded = common::to_string(&bytes);
62130                        match serde_json::from_str(&encoded) {
62131                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
62132                            Err(error) => {
62133                                dlg.response_json_decode_error(&encoded, &error);
62134                                return Err(common::Error::JsonDecodeError(
62135                                    encoded.to_string(),
62136                                    error,
62137                                ));
62138                            }
62139                        }
62140                    };
62141
62142                    dlg.finished(true);
62143                    return Ok(response);
62144                }
62145            }
62146        }
62147    }
62148
62149    /// User profile ID associated with this request.
62150    ///
62151    /// Sets the *profile id* path property to the given value.
62152    ///
62153    /// Even though the property as already been set when instantiating this call,
62154    /// we provide this method for API completeness.
62155    pub fn profile_id(mut self, new_value: i64) -> PlacementGetCall<'a, C> {
62156        self._profile_id = new_value;
62157        self
62158    }
62159    /// Placement ID.
62160    ///
62161    /// Sets the *id* path property to the given value.
62162    ///
62163    /// Even though the property as already been set when instantiating this call,
62164    /// we provide this method for API completeness.
62165    pub fn id(mut self, new_value: i64) -> PlacementGetCall<'a, C> {
62166        self._id = new_value;
62167        self
62168    }
62169    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
62170    /// while executing the actual API request.
62171    ///
62172    /// ````text
62173    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
62174    /// ````
62175    ///
62176    /// Sets the *delegate* property to the given value.
62177    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> PlacementGetCall<'a, C> {
62178        self._delegate = Some(new_value);
62179        self
62180    }
62181
62182    /// Set any additional parameter of the query string used in the request.
62183    /// It should be used to set parameters which are not yet available through their own
62184    /// setters.
62185    ///
62186    /// Please note that this method must not be used to set any of the known parameters
62187    /// which have their own setter method. If done anyway, the request will fail.
62188    ///
62189    /// # Additional Parameters
62190    ///
62191    /// * *$.xgafv* (query-string) - V1 error format.
62192    /// * *access_token* (query-string) - OAuth access token.
62193    /// * *alt* (query-string) - Data format for response.
62194    /// * *callback* (query-string) - JSONP
62195    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
62196    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
62197    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
62198    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
62199    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
62200    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
62201    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
62202    pub fn param<T>(mut self, name: T, value: T) -> PlacementGetCall<'a, C>
62203    where
62204        T: AsRef<str>,
62205    {
62206        self._additional_params
62207            .insert(name.as_ref().to_string(), value.as_ref().to_string());
62208        self
62209    }
62210
62211    /// Identifies the authorization scope for the method you are building.
62212    ///
62213    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
62214    /// [`Scope::Dfatrafficking`].
62215    ///
62216    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
62217    /// tokens for more than one scope.
62218    ///
62219    /// Usually there is more than one suitable scope to authorize an operation, some of which may
62220    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
62221    /// sufficient, a read-write scope will do as well.
62222    pub fn add_scope<St>(mut self, scope: St) -> PlacementGetCall<'a, C>
62223    where
62224        St: AsRef<str>,
62225    {
62226        self._scopes.insert(String::from(scope.as_ref()));
62227        self
62228    }
62229    /// Identifies the authorization scope(s) for the method you are building.
62230    ///
62231    /// See [`Self::add_scope()`] for details.
62232    pub fn add_scopes<I, St>(mut self, scopes: I) -> PlacementGetCall<'a, C>
62233    where
62234        I: IntoIterator<Item = St>,
62235        St: AsRef<str>,
62236    {
62237        self._scopes
62238            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
62239        self
62240    }
62241
62242    /// Removes all scopes, and no default scope will be used either.
62243    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
62244    /// for details).
62245    pub fn clear_scopes(mut self) -> PlacementGetCall<'a, C> {
62246        self._scopes.clear();
62247        self
62248    }
62249}
62250
62251/// Inserts a new placement.
62252///
62253/// A builder for the *insert* method supported by a *placement* resource.
62254/// It is not used directly, but through a [`PlacementMethods`] instance.
62255///
62256/// # Example
62257///
62258/// Instantiate a resource method builder
62259///
62260/// ```test_harness,no_run
62261/// # extern crate hyper;
62262/// # extern crate hyper_rustls;
62263/// # extern crate google_dfareporting3d3 as dfareporting3d3;
62264/// use dfareporting3d3::api::Placement;
62265/// # async fn dox() {
62266/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
62267///
62268/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
62269/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
62270/// #     secret,
62271/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
62272/// # ).build().await.unwrap();
62273///
62274/// # let client = hyper_util::client::legacy::Client::builder(
62275/// #     hyper_util::rt::TokioExecutor::new()
62276/// # )
62277/// # .build(
62278/// #     hyper_rustls::HttpsConnectorBuilder::new()
62279/// #         .with_native_roots()
62280/// #         .unwrap()
62281/// #         .https_or_http()
62282/// #         .enable_http1()
62283/// #         .build()
62284/// # );
62285/// # let mut hub = Dfareporting::new(client, auth);
62286/// // As the method needs a request, you would usually fill it with the desired information
62287/// // into the respective structure. Some of the parts shown here might not be applicable !
62288/// // Values shown here are possibly random and not representative !
62289/// let mut req = Placement::default();
62290///
62291/// // You can configure optional parameters by calling the respective setters at will, and
62292/// // execute the final call using `doit()`.
62293/// // Values shown here are possibly random and not representative !
62294/// let result = hub.placements().insert(req, -36)
62295///              .doit().await;
62296/// # }
62297/// ```
62298pub struct PlacementInsertCall<'a, C>
62299where
62300    C: 'a,
62301{
62302    hub: &'a Dfareporting<C>,
62303    _request: Placement,
62304    _profile_id: i64,
62305    _delegate: Option<&'a mut dyn common::Delegate>,
62306    _additional_params: HashMap<String, String>,
62307    _scopes: BTreeSet<String>,
62308}
62309
62310impl<'a, C> common::CallBuilder for PlacementInsertCall<'a, C> {}
62311
62312impl<'a, C> PlacementInsertCall<'a, C>
62313where
62314    C: common::Connector,
62315{
62316    /// Perform the operation you have build so far.
62317    pub async fn doit(mut self) -> common::Result<(common::Response, Placement)> {
62318        use std::borrow::Cow;
62319        use std::io::{Read, Seek};
62320
62321        use common::{url::Params, ToParts};
62322        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
62323
62324        let mut dd = common::DefaultDelegate;
62325        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
62326        dlg.begin(common::MethodInfo {
62327            id: "dfareporting.placements.insert",
62328            http_method: hyper::Method::POST,
62329        });
62330
62331        for &field in ["alt", "profileId"].iter() {
62332            if self._additional_params.contains_key(field) {
62333                dlg.finished(false);
62334                return Err(common::Error::FieldClash(field));
62335            }
62336        }
62337
62338        let mut params = Params::with_capacity(4 + self._additional_params.len());
62339        params.push("profileId", self._profile_id.to_string());
62340
62341        params.extend(self._additional_params.iter());
62342
62343        params.push("alt", "json");
62344        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/placements";
62345        if self._scopes.is_empty() {
62346            self._scopes
62347                .insert(Scope::Dfatrafficking.as_ref().to_string());
62348        }
62349
62350        #[allow(clippy::single_element_loop)]
62351        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
62352            url = params.uri_replacement(url, param_name, find_this, false);
62353        }
62354        {
62355            let to_remove = ["profileId"];
62356            params.remove_params(&to_remove);
62357        }
62358
62359        let url = params.parse_with_url(&url);
62360
62361        let mut json_mime_type = mime::APPLICATION_JSON;
62362        let mut request_value_reader = {
62363            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
62364            common::remove_json_null_values(&mut value);
62365            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
62366            serde_json::to_writer(&mut dst, &value).unwrap();
62367            dst
62368        };
62369        let request_size = request_value_reader
62370            .seek(std::io::SeekFrom::End(0))
62371            .unwrap();
62372        request_value_reader
62373            .seek(std::io::SeekFrom::Start(0))
62374            .unwrap();
62375
62376        loop {
62377            let token = match self
62378                .hub
62379                .auth
62380                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
62381                .await
62382            {
62383                Ok(token) => token,
62384                Err(e) => match dlg.token(e) {
62385                    Ok(token) => token,
62386                    Err(e) => {
62387                        dlg.finished(false);
62388                        return Err(common::Error::MissingToken(e));
62389                    }
62390                },
62391            };
62392            request_value_reader
62393                .seek(std::io::SeekFrom::Start(0))
62394                .unwrap();
62395            let mut req_result = {
62396                let client = &self.hub.client;
62397                dlg.pre_request();
62398                let mut req_builder = hyper::Request::builder()
62399                    .method(hyper::Method::POST)
62400                    .uri(url.as_str())
62401                    .header(USER_AGENT, self.hub._user_agent.clone());
62402
62403                if let Some(token) = token.as_ref() {
62404                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
62405                }
62406
62407                let request = req_builder
62408                    .header(CONTENT_TYPE, json_mime_type.to_string())
62409                    .header(CONTENT_LENGTH, request_size as u64)
62410                    .body(common::to_body(
62411                        request_value_reader.get_ref().clone().into(),
62412                    ));
62413
62414                client.request(request.unwrap()).await
62415            };
62416
62417            match req_result {
62418                Err(err) => {
62419                    if let common::Retry::After(d) = dlg.http_error(&err) {
62420                        sleep(d).await;
62421                        continue;
62422                    }
62423                    dlg.finished(false);
62424                    return Err(common::Error::HttpError(err));
62425                }
62426                Ok(res) => {
62427                    let (mut parts, body) = res.into_parts();
62428                    let mut body = common::Body::new(body);
62429                    if !parts.status.is_success() {
62430                        let bytes = common::to_bytes(body).await.unwrap_or_default();
62431                        let error = serde_json::from_str(&common::to_string(&bytes));
62432                        let response = common::to_response(parts, bytes.into());
62433
62434                        if let common::Retry::After(d) =
62435                            dlg.http_failure(&response, error.as_ref().ok())
62436                        {
62437                            sleep(d).await;
62438                            continue;
62439                        }
62440
62441                        dlg.finished(false);
62442
62443                        return Err(match error {
62444                            Ok(value) => common::Error::BadRequest(value),
62445                            _ => common::Error::Failure(response),
62446                        });
62447                    }
62448                    let response = {
62449                        let bytes = common::to_bytes(body).await.unwrap_or_default();
62450                        let encoded = common::to_string(&bytes);
62451                        match serde_json::from_str(&encoded) {
62452                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
62453                            Err(error) => {
62454                                dlg.response_json_decode_error(&encoded, &error);
62455                                return Err(common::Error::JsonDecodeError(
62456                                    encoded.to_string(),
62457                                    error,
62458                                ));
62459                            }
62460                        }
62461                    };
62462
62463                    dlg.finished(true);
62464                    return Ok(response);
62465                }
62466            }
62467        }
62468    }
62469
62470    ///
62471    /// Sets the *request* property to the given value.
62472    ///
62473    /// Even though the property as already been set when instantiating this call,
62474    /// we provide this method for API completeness.
62475    pub fn request(mut self, new_value: Placement) -> PlacementInsertCall<'a, C> {
62476        self._request = new_value;
62477        self
62478    }
62479    /// User profile ID associated with this request.
62480    ///
62481    /// Sets the *profile id* path property to the given value.
62482    ///
62483    /// Even though the property as already been set when instantiating this call,
62484    /// we provide this method for API completeness.
62485    pub fn profile_id(mut self, new_value: i64) -> PlacementInsertCall<'a, C> {
62486        self._profile_id = new_value;
62487        self
62488    }
62489    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
62490    /// while executing the actual API request.
62491    ///
62492    /// ````text
62493    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
62494    /// ````
62495    ///
62496    /// Sets the *delegate* property to the given value.
62497    pub fn delegate(
62498        mut self,
62499        new_value: &'a mut dyn common::Delegate,
62500    ) -> PlacementInsertCall<'a, C> {
62501        self._delegate = Some(new_value);
62502        self
62503    }
62504
62505    /// Set any additional parameter of the query string used in the request.
62506    /// It should be used to set parameters which are not yet available through their own
62507    /// setters.
62508    ///
62509    /// Please note that this method must not be used to set any of the known parameters
62510    /// which have their own setter method. If done anyway, the request will fail.
62511    ///
62512    /// # Additional Parameters
62513    ///
62514    /// * *$.xgafv* (query-string) - V1 error format.
62515    /// * *access_token* (query-string) - OAuth access token.
62516    /// * *alt* (query-string) - Data format for response.
62517    /// * *callback* (query-string) - JSONP
62518    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
62519    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
62520    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
62521    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
62522    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
62523    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
62524    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
62525    pub fn param<T>(mut self, name: T, value: T) -> PlacementInsertCall<'a, C>
62526    where
62527        T: AsRef<str>,
62528    {
62529        self._additional_params
62530            .insert(name.as_ref().to_string(), value.as_ref().to_string());
62531        self
62532    }
62533
62534    /// Identifies the authorization scope for the method you are building.
62535    ///
62536    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
62537    /// [`Scope::Dfatrafficking`].
62538    ///
62539    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
62540    /// tokens for more than one scope.
62541    ///
62542    /// Usually there is more than one suitable scope to authorize an operation, some of which may
62543    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
62544    /// sufficient, a read-write scope will do as well.
62545    pub fn add_scope<St>(mut self, scope: St) -> PlacementInsertCall<'a, C>
62546    where
62547        St: AsRef<str>,
62548    {
62549        self._scopes.insert(String::from(scope.as_ref()));
62550        self
62551    }
62552    /// Identifies the authorization scope(s) for the method you are building.
62553    ///
62554    /// See [`Self::add_scope()`] for details.
62555    pub fn add_scopes<I, St>(mut self, scopes: I) -> PlacementInsertCall<'a, C>
62556    where
62557        I: IntoIterator<Item = St>,
62558        St: AsRef<str>,
62559    {
62560        self._scopes
62561            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
62562        self
62563    }
62564
62565    /// Removes all scopes, and no default scope will be used either.
62566    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
62567    /// for details).
62568    pub fn clear_scopes(mut self) -> PlacementInsertCall<'a, C> {
62569        self._scopes.clear();
62570        self
62571    }
62572}
62573
62574/// Retrieves a list of placements, possibly filtered. This method supports paging.
62575///
62576/// A builder for the *list* method supported by a *placement* resource.
62577/// It is not used directly, but through a [`PlacementMethods`] instance.
62578///
62579/// # Example
62580///
62581/// Instantiate a resource method builder
62582///
62583/// ```test_harness,no_run
62584/// # extern crate hyper;
62585/// # extern crate hyper_rustls;
62586/// # extern crate google_dfareporting3d3 as dfareporting3d3;
62587/// # async fn dox() {
62588/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
62589///
62590/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
62591/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
62592/// #     secret,
62593/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
62594/// # ).build().await.unwrap();
62595///
62596/// # let client = hyper_util::client::legacy::Client::builder(
62597/// #     hyper_util::rt::TokioExecutor::new()
62598/// # )
62599/// # .build(
62600/// #     hyper_rustls::HttpsConnectorBuilder::new()
62601/// #         .with_native_roots()
62602/// #         .unwrap()
62603/// #         .https_or_http()
62604/// #         .enable_http1()
62605/// #         .build()
62606/// # );
62607/// # let mut hub = Dfareporting::new(client, auth);
62608/// // You can configure optional parameters by calling the respective setters at will, and
62609/// // execute the final call using `doit()`.
62610/// // Values shown here are possibly random and not representative !
62611/// let result = hub.placements().list(-47)
62612///              .sort_order("et")
62613///              .sort_field("dolore")
62614///              .add_size_ids(-28)
62615///              .add_site_ids(-53)
62616///              .search_string("sanctus")
62617///              .add_pricing_types("ipsum")
62618///              .add_placement_strategy_ids(-90)
62619///              .payment_source("vero")
62620///              .page_token("voluptua.")
62621///              .min_start_date("sea")
62622///              .min_end_date("ipsum")
62623///              .max_start_date("sea")
62624///              .max_results(-74)
62625///              .max_end_date("gubergren")
62626///              .add_ids(-34)
62627///              .add_group_ids(-17)
62628///              .add_directory_site_ids(-94)
62629///              .add_content_category_ids(-9)
62630///              .add_compatibilities("duo")
62631///              .add_campaign_ids(-89)
62632///              .archived(true)
62633///              .add_advertiser_ids(-30)
62634///              .doit().await;
62635/// # }
62636/// ```
62637pub struct PlacementListCall<'a, C>
62638where
62639    C: 'a,
62640{
62641    hub: &'a Dfareporting<C>,
62642    _profile_id: i64,
62643    _sort_order: Option<String>,
62644    _sort_field: Option<String>,
62645    _size_ids: Vec<i64>,
62646    _site_ids: Vec<i64>,
62647    _search_string: Option<String>,
62648    _pricing_types: Vec<String>,
62649    _placement_strategy_ids: Vec<i64>,
62650    _payment_source: Option<String>,
62651    _page_token: Option<String>,
62652    _min_start_date: Option<String>,
62653    _min_end_date: Option<String>,
62654    _max_start_date: Option<String>,
62655    _max_results: Option<i32>,
62656    _max_end_date: Option<String>,
62657    _ids: Vec<i64>,
62658    _group_ids: Vec<i64>,
62659    _directory_site_ids: Vec<i64>,
62660    _content_category_ids: Vec<i64>,
62661    _compatibilities: Vec<String>,
62662    _campaign_ids: Vec<i64>,
62663    _archived: Option<bool>,
62664    _advertiser_ids: Vec<i64>,
62665    _delegate: Option<&'a mut dyn common::Delegate>,
62666    _additional_params: HashMap<String, String>,
62667    _scopes: BTreeSet<String>,
62668}
62669
62670impl<'a, C> common::CallBuilder for PlacementListCall<'a, C> {}
62671
62672impl<'a, C> PlacementListCall<'a, C>
62673where
62674    C: common::Connector,
62675{
62676    /// Perform the operation you have build so far.
62677    pub async fn doit(mut self) -> common::Result<(common::Response, PlacementsListResponse)> {
62678        use std::borrow::Cow;
62679        use std::io::{Read, Seek};
62680
62681        use common::{url::Params, ToParts};
62682        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
62683
62684        let mut dd = common::DefaultDelegate;
62685        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
62686        dlg.begin(common::MethodInfo {
62687            id: "dfareporting.placements.list",
62688            http_method: hyper::Method::GET,
62689        });
62690
62691        for &field in [
62692            "alt",
62693            "profileId",
62694            "sortOrder",
62695            "sortField",
62696            "sizeIds",
62697            "siteIds",
62698            "searchString",
62699            "pricingTypes",
62700            "placementStrategyIds",
62701            "paymentSource",
62702            "pageToken",
62703            "minStartDate",
62704            "minEndDate",
62705            "maxStartDate",
62706            "maxResults",
62707            "maxEndDate",
62708            "ids",
62709            "groupIds",
62710            "directorySiteIds",
62711            "contentCategoryIds",
62712            "compatibilities",
62713            "campaignIds",
62714            "archived",
62715            "advertiserIds",
62716        ]
62717        .iter()
62718        {
62719            if self._additional_params.contains_key(field) {
62720                dlg.finished(false);
62721                return Err(common::Error::FieldClash(field));
62722            }
62723        }
62724
62725        let mut params = Params::with_capacity(25 + self._additional_params.len());
62726        params.push("profileId", self._profile_id.to_string());
62727        if let Some(value) = self._sort_order.as_ref() {
62728            params.push("sortOrder", value);
62729        }
62730        if let Some(value) = self._sort_field.as_ref() {
62731            params.push("sortField", value);
62732        }
62733        if !self._size_ids.is_empty() {
62734            for f in self._size_ids.iter() {
62735                params.push("sizeIds", f.to_string());
62736            }
62737        }
62738        if !self._site_ids.is_empty() {
62739            for f in self._site_ids.iter() {
62740                params.push("siteIds", f.to_string());
62741            }
62742        }
62743        if let Some(value) = self._search_string.as_ref() {
62744            params.push("searchString", value);
62745        }
62746        if !self._pricing_types.is_empty() {
62747            for f in self._pricing_types.iter() {
62748                params.push("pricingTypes", f);
62749            }
62750        }
62751        if !self._placement_strategy_ids.is_empty() {
62752            for f in self._placement_strategy_ids.iter() {
62753                params.push("placementStrategyIds", f.to_string());
62754            }
62755        }
62756        if let Some(value) = self._payment_source.as_ref() {
62757            params.push("paymentSource", value);
62758        }
62759        if let Some(value) = self._page_token.as_ref() {
62760            params.push("pageToken", value);
62761        }
62762        if let Some(value) = self._min_start_date.as_ref() {
62763            params.push("minStartDate", value);
62764        }
62765        if let Some(value) = self._min_end_date.as_ref() {
62766            params.push("minEndDate", value);
62767        }
62768        if let Some(value) = self._max_start_date.as_ref() {
62769            params.push("maxStartDate", value);
62770        }
62771        if let Some(value) = self._max_results.as_ref() {
62772            params.push("maxResults", value.to_string());
62773        }
62774        if let Some(value) = self._max_end_date.as_ref() {
62775            params.push("maxEndDate", value);
62776        }
62777        if !self._ids.is_empty() {
62778            for f in self._ids.iter() {
62779                params.push("ids", f.to_string());
62780            }
62781        }
62782        if !self._group_ids.is_empty() {
62783            for f in self._group_ids.iter() {
62784                params.push("groupIds", f.to_string());
62785            }
62786        }
62787        if !self._directory_site_ids.is_empty() {
62788            for f in self._directory_site_ids.iter() {
62789                params.push("directorySiteIds", f.to_string());
62790            }
62791        }
62792        if !self._content_category_ids.is_empty() {
62793            for f in self._content_category_ids.iter() {
62794                params.push("contentCategoryIds", f.to_string());
62795            }
62796        }
62797        if !self._compatibilities.is_empty() {
62798            for f in self._compatibilities.iter() {
62799                params.push("compatibilities", f);
62800            }
62801        }
62802        if !self._campaign_ids.is_empty() {
62803            for f in self._campaign_ids.iter() {
62804                params.push("campaignIds", f.to_string());
62805            }
62806        }
62807        if let Some(value) = self._archived.as_ref() {
62808            params.push("archived", value.to_string());
62809        }
62810        if !self._advertiser_ids.is_empty() {
62811            for f in self._advertiser_ids.iter() {
62812                params.push("advertiserIds", f.to_string());
62813            }
62814        }
62815
62816        params.extend(self._additional_params.iter());
62817
62818        params.push("alt", "json");
62819        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/placements";
62820        if self._scopes.is_empty() {
62821            self._scopes
62822                .insert(Scope::Dfatrafficking.as_ref().to_string());
62823        }
62824
62825        #[allow(clippy::single_element_loop)]
62826        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
62827            url = params.uri_replacement(url, param_name, find_this, false);
62828        }
62829        {
62830            let to_remove = ["profileId"];
62831            params.remove_params(&to_remove);
62832        }
62833
62834        let url = params.parse_with_url(&url);
62835
62836        loop {
62837            let token = match self
62838                .hub
62839                .auth
62840                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
62841                .await
62842            {
62843                Ok(token) => token,
62844                Err(e) => match dlg.token(e) {
62845                    Ok(token) => token,
62846                    Err(e) => {
62847                        dlg.finished(false);
62848                        return Err(common::Error::MissingToken(e));
62849                    }
62850                },
62851            };
62852            let mut req_result = {
62853                let client = &self.hub.client;
62854                dlg.pre_request();
62855                let mut req_builder = hyper::Request::builder()
62856                    .method(hyper::Method::GET)
62857                    .uri(url.as_str())
62858                    .header(USER_AGENT, self.hub._user_agent.clone());
62859
62860                if let Some(token) = token.as_ref() {
62861                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
62862                }
62863
62864                let request = req_builder
62865                    .header(CONTENT_LENGTH, 0_u64)
62866                    .body(common::to_body::<String>(None));
62867
62868                client.request(request.unwrap()).await
62869            };
62870
62871            match req_result {
62872                Err(err) => {
62873                    if let common::Retry::After(d) = dlg.http_error(&err) {
62874                        sleep(d).await;
62875                        continue;
62876                    }
62877                    dlg.finished(false);
62878                    return Err(common::Error::HttpError(err));
62879                }
62880                Ok(res) => {
62881                    let (mut parts, body) = res.into_parts();
62882                    let mut body = common::Body::new(body);
62883                    if !parts.status.is_success() {
62884                        let bytes = common::to_bytes(body).await.unwrap_or_default();
62885                        let error = serde_json::from_str(&common::to_string(&bytes));
62886                        let response = common::to_response(parts, bytes.into());
62887
62888                        if let common::Retry::After(d) =
62889                            dlg.http_failure(&response, error.as_ref().ok())
62890                        {
62891                            sleep(d).await;
62892                            continue;
62893                        }
62894
62895                        dlg.finished(false);
62896
62897                        return Err(match error {
62898                            Ok(value) => common::Error::BadRequest(value),
62899                            _ => common::Error::Failure(response),
62900                        });
62901                    }
62902                    let response = {
62903                        let bytes = common::to_bytes(body).await.unwrap_or_default();
62904                        let encoded = common::to_string(&bytes);
62905                        match serde_json::from_str(&encoded) {
62906                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
62907                            Err(error) => {
62908                                dlg.response_json_decode_error(&encoded, &error);
62909                                return Err(common::Error::JsonDecodeError(
62910                                    encoded.to_string(),
62911                                    error,
62912                                ));
62913                            }
62914                        }
62915                    };
62916
62917                    dlg.finished(true);
62918                    return Ok(response);
62919                }
62920            }
62921        }
62922    }
62923
62924    /// User profile ID associated with this request.
62925    ///
62926    /// Sets the *profile id* path property to the given value.
62927    ///
62928    /// Even though the property as already been set when instantiating this call,
62929    /// we provide this method for API completeness.
62930    pub fn profile_id(mut self, new_value: i64) -> PlacementListCall<'a, C> {
62931        self._profile_id = new_value;
62932        self
62933    }
62934    /// Order of sorted results.
62935    ///
62936    /// Sets the *sort order* query property to the given value.
62937    pub fn sort_order(mut self, new_value: &str) -> PlacementListCall<'a, C> {
62938        self._sort_order = Some(new_value.to_string());
62939        self
62940    }
62941    /// Field by which to sort the list.
62942    ///
62943    /// Sets the *sort field* query property to the given value.
62944    pub fn sort_field(mut self, new_value: &str) -> PlacementListCall<'a, C> {
62945        self._sort_field = Some(new_value.to_string());
62946        self
62947    }
62948    /// Select only placements that are associated with these sizes.
62949    ///
62950    /// Append the given value to the *size ids* query property.
62951    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
62952    pub fn add_size_ids(mut self, new_value: i64) -> PlacementListCall<'a, C> {
62953        self._size_ids.push(new_value);
62954        self
62955    }
62956    /// Select only placements that are associated with these sites.
62957    ///
62958    /// Append the given value to the *site ids* query property.
62959    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
62960    pub fn add_site_ids(mut self, new_value: i64) -> PlacementListCall<'a, C> {
62961        self._site_ids.push(new_value);
62962        self
62963    }
62964    /// Allows searching for placements by name or ID. Wildcards (*) are allowed. For example, "placement*2015" will return placements with names like "placement June 2015", "placement May 2015", or simply "placements 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "placement" will match placements with name "my placement", "placement 2015", or simply "placement" .
62965    ///
62966    /// Sets the *search string* query property to the given value.
62967    pub fn search_string(mut self, new_value: &str) -> PlacementListCall<'a, C> {
62968        self._search_string = Some(new_value.to_string());
62969        self
62970    }
62971    /// Select only placements with these pricing types.
62972    ///
62973    /// Append the given value to the *pricing types* query property.
62974    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
62975    pub fn add_pricing_types(mut self, new_value: &str) -> PlacementListCall<'a, C> {
62976        self._pricing_types.push(new_value.to_string());
62977        self
62978    }
62979    /// Select only placements that are associated with these placement strategies.
62980    ///
62981    /// Append the given value to the *placement strategy ids* query property.
62982    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
62983    pub fn add_placement_strategy_ids(mut self, new_value: i64) -> PlacementListCall<'a, C> {
62984        self._placement_strategy_ids.push(new_value);
62985        self
62986    }
62987    /// Select only placements with this payment source.
62988    ///
62989    /// Sets the *payment source* query property to the given value.
62990    pub fn payment_source(mut self, new_value: &str) -> PlacementListCall<'a, C> {
62991        self._payment_source = Some(new_value.to_string());
62992        self
62993    }
62994    /// Value of the nextPageToken from the previous result page.
62995    ///
62996    /// Sets the *page token* query property to the given value.
62997    pub fn page_token(mut self, new_value: &str) -> PlacementListCall<'a, C> {
62998        self._page_token = Some(new_value.to_string());
62999        self
63000    }
63001    /// Select only placements or placement groups whose start date is on or after the specified minStartDate. The date should be formatted as "yyyy-MM-dd".
63002    ///
63003    /// Sets the *min start date* query property to the given value.
63004    pub fn min_start_date(mut self, new_value: &str) -> PlacementListCall<'a, C> {
63005        self._min_start_date = Some(new_value.to_string());
63006        self
63007    }
63008    /// Select only placements or placement groups whose end date is on or after the specified minEndDate. The date should be formatted as "yyyy-MM-dd".
63009    ///
63010    /// Sets the *min end date* query property to the given value.
63011    pub fn min_end_date(mut self, new_value: &str) -> PlacementListCall<'a, C> {
63012        self._min_end_date = Some(new_value.to_string());
63013        self
63014    }
63015    /// Select only placements or placement groups whose start date is on or before the specified maxStartDate. The date should be formatted as "yyyy-MM-dd".
63016    ///
63017    /// Sets the *max start date* query property to the given value.
63018    pub fn max_start_date(mut self, new_value: &str) -> PlacementListCall<'a, C> {
63019        self._max_start_date = Some(new_value.to_string());
63020        self
63021    }
63022    /// Maximum number of results to return.
63023    ///
63024    /// Sets the *max results* query property to the given value.
63025    pub fn max_results(mut self, new_value: i32) -> PlacementListCall<'a, C> {
63026        self._max_results = Some(new_value);
63027        self
63028    }
63029    /// Select only placements or placement groups whose end date is on or before the specified maxEndDate. The date should be formatted as "yyyy-MM-dd".
63030    ///
63031    /// Sets the *max end date* query property to the given value.
63032    pub fn max_end_date(mut self, new_value: &str) -> PlacementListCall<'a, C> {
63033        self._max_end_date = Some(new_value.to_string());
63034        self
63035    }
63036    /// Select only placements with these IDs.
63037    ///
63038    /// Append the given value to the *ids* query property.
63039    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
63040    pub fn add_ids(mut self, new_value: i64) -> PlacementListCall<'a, C> {
63041        self._ids.push(new_value);
63042        self
63043    }
63044    /// Select only placements that belong to these placement groups.
63045    ///
63046    /// Append the given value to the *group ids* query property.
63047    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
63048    pub fn add_group_ids(mut self, new_value: i64) -> PlacementListCall<'a, C> {
63049        self._group_ids.push(new_value);
63050        self
63051    }
63052    /// Select only placements that are associated with these directory sites.
63053    ///
63054    /// Append the given value to the *directory site ids* query property.
63055    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
63056    pub fn add_directory_site_ids(mut self, new_value: i64) -> PlacementListCall<'a, C> {
63057        self._directory_site_ids.push(new_value);
63058        self
63059    }
63060    /// Select only placements that are associated with these content categories.
63061    ///
63062    /// Append the given value to the *content category ids* query property.
63063    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
63064    pub fn add_content_category_ids(mut self, new_value: i64) -> PlacementListCall<'a, C> {
63065        self._content_category_ids.push(new_value);
63066        self
63067    }
63068    /// Select only placements that are associated with these compatibilities. DISPLAY and DISPLAY_INTERSTITIAL refer to rendering either on desktop or on mobile devices for regular or interstitial ads respectively. APP and APP_INTERSTITIAL are for rendering in mobile apps. IN_STREAM_VIDEO refers to rendering in in-stream video ads developed with the VAST standard.
63069    ///
63070    /// Append the given value to the *compatibilities* query property.
63071    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
63072    pub fn add_compatibilities(mut self, new_value: &str) -> PlacementListCall<'a, C> {
63073        self._compatibilities.push(new_value.to_string());
63074        self
63075    }
63076    /// Select only placements that belong to these campaigns.
63077    ///
63078    /// Append the given value to the *campaign ids* query property.
63079    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
63080    pub fn add_campaign_ids(mut self, new_value: i64) -> PlacementListCall<'a, C> {
63081        self._campaign_ids.push(new_value);
63082        self
63083    }
63084    /// Select only archived placements. Don't set this field to select both archived and non-archived placements.
63085    ///
63086    /// Sets the *archived* query property to the given value.
63087    pub fn archived(mut self, new_value: bool) -> PlacementListCall<'a, C> {
63088        self._archived = Some(new_value);
63089        self
63090    }
63091    /// Select only placements that belong to these advertisers.
63092    ///
63093    /// Append the given value to the *advertiser ids* query property.
63094    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
63095    pub fn add_advertiser_ids(mut self, new_value: i64) -> PlacementListCall<'a, C> {
63096        self._advertiser_ids.push(new_value);
63097        self
63098    }
63099    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
63100    /// while executing the actual API request.
63101    ///
63102    /// ````text
63103    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
63104    /// ````
63105    ///
63106    /// Sets the *delegate* property to the given value.
63107    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> PlacementListCall<'a, C> {
63108        self._delegate = Some(new_value);
63109        self
63110    }
63111
63112    /// Set any additional parameter of the query string used in the request.
63113    /// It should be used to set parameters which are not yet available through their own
63114    /// setters.
63115    ///
63116    /// Please note that this method must not be used to set any of the known parameters
63117    /// which have their own setter method. If done anyway, the request will fail.
63118    ///
63119    /// # Additional Parameters
63120    ///
63121    /// * *$.xgafv* (query-string) - V1 error format.
63122    /// * *access_token* (query-string) - OAuth access token.
63123    /// * *alt* (query-string) - Data format for response.
63124    /// * *callback* (query-string) - JSONP
63125    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
63126    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
63127    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
63128    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
63129    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
63130    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
63131    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
63132    pub fn param<T>(mut self, name: T, value: T) -> PlacementListCall<'a, C>
63133    where
63134        T: AsRef<str>,
63135    {
63136        self._additional_params
63137            .insert(name.as_ref().to_string(), value.as_ref().to_string());
63138        self
63139    }
63140
63141    /// Identifies the authorization scope for the method you are building.
63142    ///
63143    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
63144    /// [`Scope::Dfatrafficking`].
63145    ///
63146    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
63147    /// tokens for more than one scope.
63148    ///
63149    /// Usually there is more than one suitable scope to authorize an operation, some of which may
63150    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
63151    /// sufficient, a read-write scope will do as well.
63152    pub fn add_scope<St>(mut self, scope: St) -> PlacementListCall<'a, C>
63153    where
63154        St: AsRef<str>,
63155    {
63156        self._scopes.insert(String::from(scope.as_ref()));
63157        self
63158    }
63159    /// Identifies the authorization scope(s) for the method you are building.
63160    ///
63161    /// See [`Self::add_scope()`] for details.
63162    pub fn add_scopes<I, St>(mut self, scopes: I) -> PlacementListCall<'a, C>
63163    where
63164        I: IntoIterator<Item = St>,
63165        St: AsRef<str>,
63166    {
63167        self._scopes
63168            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
63169        self
63170    }
63171
63172    /// Removes all scopes, and no default scope will be used either.
63173    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
63174    /// for details).
63175    pub fn clear_scopes(mut self) -> PlacementListCall<'a, C> {
63176        self._scopes.clear();
63177        self
63178    }
63179}
63180
63181/// Updates an existing placement. This method supports patch semantics.
63182///
63183/// A builder for the *patch* method supported by a *placement* resource.
63184/// It is not used directly, but through a [`PlacementMethods`] instance.
63185///
63186/// # Example
63187///
63188/// Instantiate a resource method builder
63189///
63190/// ```test_harness,no_run
63191/// # extern crate hyper;
63192/// # extern crate hyper_rustls;
63193/// # extern crate google_dfareporting3d3 as dfareporting3d3;
63194/// use dfareporting3d3::api::Placement;
63195/// # async fn dox() {
63196/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
63197///
63198/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
63199/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
63200/// #     secret,
63201/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
63202/// # ).build().await.unwrap();
63203///
63204/// # let client = hyper_util::client::legacy::Client::builder(
63205/// #     hyper_util::rt::TokioExecutor::new()
63206/// # )
63207/// # .build(
63208/// #     hyper_rustls::HttpsConnectorBuilder::new()
63209/// #         .with_native_roots()
63210/// #         .unwrap()
63211/// #         .https_or_http()
63212/// #         .enable_http1()
63213/// #         .build()
63214/// # );
63215/// # let mut hub = Dfareporting::new(client, auth);
63216/// // As the method needs a request, you would usually fill it with the desired information
63217/// // into the respective structure. Some of the parts shown here might not be applicable !
63218/// // Values shown here are possibly random and not representative !
63219/// let mut req = Placement::default();
63220///
63221/// // You can configure optional parameters by calling the respective setters at will, and
63222/// // execute the final call using `doit()`.
63223/// // Values shown here are possibly random and not representative !
63224/// let result = hub.placements().patch(req, -61, -65)
63225///              .doit().await;
63226/// # }
63227/// ```
63228pub struct PlacementPatchCall<'a, C>
63229where
63230    C: 'a,
63231{
63232    hub: &'a Dfareporting<C>,
63233    _request: Placement,
63234    _profile_id: i64,
63235    _id: i64,
63236    _delegate: Option<&'a mut dyn common::Delegate>,
63237    _additional_params: HashMap<String, String>,
63238    _scopes: BTreeSet<String>,
63239}
63240
63241impl<'a, C> common::CallBuilder for PlacementPatchCall<'a, C> {}
63242
63243impl<'a, C> PlacementPatchCall<'a, C>
63244where
63245    C: common::Connector,
63246{
63247    /// Perform the operation you have build so far.
63248    pub async fn doit(mut self) -> common::Result<(common::Response, Placement)> {
63249        use std::borrow::Cow;
63250        use std::io::{Read, Seek};
63251
63252        use common::{url::Params, ToParts};
63253        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
63254
63255        let mut dd = common::DefaultDelegate;
63256        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
63257        dlg.begin(common::MethodInfo {
63258            id: "dfareporting.placements.patch",
63259            http_method: hyper::Method::PATCH,
63260        });
63261
63262        for &field in ["alt", "profileId", "id"].iter() {
63263            if self._additional_params.contains_key(field) {
63264                dlg.finished(false);
63265                return Err(common::Error::FieldClash(field));
63266            }
63267        }
63268
63269        let mut params = Params::with_capacity(5 + self._additional_params.len());
63270        params.push("profileId", self._profile_id.to_string());
63271        params.push("id", self._id.to_string());
63272
63273        params.extend(self._additional_params.iter());
63274
63275        params.push("alt", "json");
63276        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/placements";
63277        if self._scopes.is_empty() {
63278            self._scopes
63279                .insert(Scope::Dfatrafficking.as_ref().to_string());
63280        }
63281
63282        #[allow(clippy::single_element_loop)]
63283        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
63284            url = params.uri_replacement(url, param_name, find_this, false);
63285        }
63286        {
63287            let to_remove = ["profileId"];
63288            params.remove_params(&to_remove);
63289        }
63290
63291        let url = params.parse_with_url(&url);
63292
63293        let mut json_mime_type = mime::APPLICATION_JSON;
63294        let mut request_value_reader = {
63295            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
63296            common::remove_json_null_values(&mut value);
63297            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
63298            serde_json::to_writer(&mut dst, &value).unwrap();
63299            dst
63300        };
63301        let request_size = request_value_reader
63302            .seek(std::io::SeekFrom::End(0))
63303            .unwrap();
63304        request_value_reader
63305            .seek(std::io::SeekFrom::Start(0))
63306            .unwrap();
63307
63308        loop {
63309            let token = match self
63310                .hub
63311                .auth
63312                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
63313                .await
63314            {
63315                Ok(token) => token,
63316                Err(e) => match dlg.token(e) {
63317                    Ok(token) => token,
63318                    Err(e) => {
63319                        dlg.finished(false);
63320                        return Err(common::Error::MissingToken(e));
63321                    }
63322                },
63323            };
63324            request_value_reader
63325                .seek(std::io::SeekFrom::Start(0))
63326                .unwrap();
63327            let mut req_result = {
63328                let client = &self.hub.client;
63329                dlg.pre_request();
63330                let mut req_builder = hyper::Request::builder()
63331                    .method(hyper::Method::PATCH)
63332                    .uri(url.as_str())
63333                    .header(USER_AGENT, self.hub._user_agent.clone());
63334
63335                if let Some(token) = token.as_ref() {
63336                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
63337                }
63338
63339                let request = req_builder
63340                    .header(CONTENT_TYPE, json_mime_type.to_string())
63341                    .header(CONTENT_LENGTH, request_size as u64)
63342                    .body(common::to_body(
63343                        request_value_reader.get_ref().clone().into(),
63344                    ));
63345
63346                client.request(request.unwrap()).await
63347            };
63348
63349            match req_result {
63350                Err(err) => {
63351                    if let common::Retry::After(d) = dlg.http_error(&err) {
63352                        sleep(d).await;
63353                        continue;
63354                    }
63355                    dlg.finished(false);
63356                    return Err(common::Error::HttpError(err));
63357                }
63358                Ok(res) => {
63359                    let (mut parts, body) = res.into_parts();
63360                    let mut body = common::Body::new(body);
63361                    if !parts.status.is_success() {
63362                        let bytes = common::to_bytes(body).await.unwrap_or_default();
63363                        let error = serde_json::from_str(&common::to_string(&bytes));
63364                        let response = common::to_response(parts, bytes.into());
63365
63366                        if let common::Retry::After(d) =
63367                            dlg.http_failure(&response, error.as_ref().ok())
63368                        {
63369                            sleep(d).await;
63370                            continue;
63371                        }
63372
63373                        dlg.finished(false);
63374
63375                        return Err(match error {
63376                            Ok(value) => common::Error::BadRequest(value),
63377                            _ => common::Error::Failure(response),
63378                        });
63379                    }
63380                    let response = {
63381                        let bytes = common::to_bytes(body).await.unwrap_or_default();
63382                        let encoded = common::to_string(&bytes);
63383                        match serde_json::from_str(&encoded) {
63384                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
63385                            Err(error) => {
63386                                dlg.response_json_decode_error(&encoded, &error);
63387                                return Err(common::Error::JsonDecodeError(
63388                                    encoded.to_string(),
63389                                    error,
63390                                ));
63391                            }
63392                        }
63393                    };
63394
63395                    dlg.finished(true);
63396                    return Ok(response);
63397                }
63398            }
63399        }
63400    }
63401
63402    ///
63403    /// Sets the *request* property to the given value.
63404    ///
63405    /// Even though the property as already been set when instantiating this call,
63406    /// we provide this method for API completeness.
63407    pub fn request(mut self, new_value: Placement) -> PlacementPatchCall<'a, C> {
63408        self._request = new_value;
63409        self
63410    }
63411    /// User profile ID associated with this request.
63412    ///
63413    /// Sets the *profile id* path property to the given value.
63414    ///
63415    /// Even though the property as already been set when instantiating this call,
63416    /// we provide this method for API completeness.
63417    pub fn profile_id(mut self, new_value: i64) -> PlacementPatchCall<'a, C> {
63418        self._profile_id = new_value;
63419        self
63420    }
63421    /// Placement ID.
63422    ///
63423    /// Sets the *id* query property to the given value.
63424    ///
63425    /// Even though the property as already been set when instantiating this call,
63426    /// we provide this method for API completeness.
63427    pub fn id(mut self, new_value: i64) -> PlacementPatchCall<'a, C> {
63428        self._id = new_value;
63429        self
63430    }
63431    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
63432    /// while executing the actual API request.
63433    ///
63434    /// ````text
63435    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
63436    /// ````
63437    ///
63438    /// Sets the *delegate* property to the given value.
63439    pub fn delegate(
63440        mut self,
63441        new_value: &'a mut dyn common::Delegate,
63442    ) -> PlacementPatchCall<'a, C> {
63443        self._delegate = Some(new_value);
63444        self
63445    }
63446
63447    /// Set any additional parameter of the query string used in the request.
63448    /// It should be used to set parameters which are not yet available through their own
63449    /// setters.
63450    ///
63451    /// Please note that this method must not be used to set any of the known parameters
63452    /// which have their own setter method. If done anyway, the request will fail.
63453    ///
63454    /// # Additional Parameters
63455    ///
63456    /// * *$.xgafv* (query-string) - V1 error format.
63457    /// * *access_token* (query-string) - OAuth access token.
63458    /// * *alt* (query-string) - Data format for response.
63459    /// * *callback* (query-string) - JSONP
63460    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
63461    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
63462    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
63463    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
63464    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
63465    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
63466    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
63467    pub fn param<T>(mut self, name: T, value: T) -> PlacementPatchCall<'a, C>
63468    where
63469        T: AsRef<str>,
63470    {
63471        self._additional_params
63472            .insert(name.as_ref().to_string(), value.as_ref().to_string());
63473        self
63474    }
63475
63476    /// Identifies the authorization scope for the method you are building.
63477    ///
63478    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
63479    /// [`Scope::Dfatrafficking`].
63480    ///
63481    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
63482    /// tokens for more than one scope.
63483    ///
63484    /// Usually there is more than one suitable scope to authorize an operation, some of which may
63485    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
63486    /// sufficient, a read-write scope will do as well.
63487    pub fn add_scope<St>(mut self, scope: St) -> PlacementPatchCall<'a, C>
63488    where
63489        St: AsRef<str>,
63490    {
63491        self._scopes.insert(String::from(scope.as_ref()));
63492        self
63493    }
63494    /// Identifies the authorization scope(s) for the method you are building.
63495    ///
63496    /// See [`Self::add_scope()`] for details.
63497    pub fn add_scopes<I, St>(mut self, scopes: I) -> PlacementPatchCall<'a, C>
63498    where
63499        I: IntoIterator<Item = St>,
63500        St: AsRef<str>,
63501    {
63502        self._scopes
63503            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
63504        self
63505    }
63506
63507    /// Removes all scopes, and no default scope will be used either.
63508    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
63509    /// for details).
63510    pub fn clear_scopes(mut self) -> PlacementPatchCall<'a, C> {
63511        self._scopes.clear();
63512        self
63513    }
63514}
63515
63516/// Updates an existing placement.
63517///
63518/// A builder for the *update* method supported by a *placement* resource.
63519/// It is not used directly, but through a [`PlacementMethods`] instance.
63520///
63521/// # Example
63522///
63523/// Instantiate a resource method builder
63524///
63525/// ```test_harness,no_run
63526/// # extern crate hyper;
63527/// # extern crate hyper_rustls;
63528/// # extern crate google_dfareporting3d3 as dfareporting3d3;
63529/// use dfareporting3d3::api::Placement;
63530/// # async fn dox() {
63531/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
63532///
63533/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
63534/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
63535/// #     secret,
63536/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
63537/// # ).build().await.unwrap();
63538///
63539/// # let client = hyper_util::client::legacy::Client::builder(
63540/// #     hyper_util::rt::TokioExecutor::new()
63541/// # )
63542/// # .build(
63543/// #     hyper_rustls::HttpsConnectorBuilder::new()
63544/// #         .with_native_roots()
63545/// #         .unwrap()
63546/// #         .https_or_http()
63547/// #         .enable_http1()
63548/// #         .build()
63549/// # );
63550/// # let mut hub = Dfareporting::new(client, auth);
63551/// // As the method needs a request, you would usually fill it with the desired information
63552/// // into the respective structure. Some of the parts shown here might not be applicable !
63553/// // Values shown here are possibly random and not representative !
63554/// let mut req = Placement::default();
63555///
63556/// // You can configure optional parameters by calling the respective setters at will, and
63557/// // execute the final call using `doit()`.
63558/// // Values shown here are possibly random and not representative !
63559/// let result = hub.placements().update(req, -60)
63560///              .doit().await;
63561/// # }
63562/// ```
63563pub struct PlacementUpdateCall<'a, C>
63564where
63565    C: 'a,
63566{
63567    hub: &'a Dfareporting<C>,
63568    _request: Placement,
63569    _profile_id: i64,
63570    _delegate: Option<&'a mut dyn common::Delegate>,
63571    _additional_params: HashMap<String, String>,
63572    _scopes: BTreeSet<String>,
63573}
63574
63575impl<'a, C> common::CallBuilder for PlacementUpdateCall<'a, C> {}
63576
63577impl<'a, C> PlacementUpdateCall<'a, C>
63578where
63579    C: common::Connector,
63580{
63581    /// Perform the operation you have build so far.
63582    pub async fn doit(mut self) -> common::Result<(common::Response, Placement)> {
63583        use std::borrow::Cow;
63584        use std::io::{Read, Seek};
63585
63586        use common::{url::Params, ToParts};
63587        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
63588
63589        let mut dd = common::DefaultDelegate;
63590        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
63591        dlg.begin(common::MethodInfo {
63592            id: "dfareporting.placements.update",
63593            http_method: hyper::Method::PUT,
63594        });
63595
63596        for &field in ["alt", "profileId"].iter() {
63597            if self._additional_params.contains_key(field) {
63598                dlg.finished(false);
63599                return Err(common::Error::FieldClash(field));
63600            }
63601        }
63602
63603        let mut params = Params::with_capacity(4 + self._additional_params.len());
63604        params.push("profileId", self._profile_id.to_string());
63605
63606        params.extend(self._additional_params.iter());
63607
63608        params.push("alt", "json");
63609        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/placements";
63610        if self._scopes.is_empty() {
63611            self._scopes
63612                .insert(Scope::Dfatrafficking.as_ref().to_string());
63613        }
63614
63615        #[allow(clippy::single_element_loop)]
63616        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
63617            url = params.uri_replacement(url, param_name, find_this, false);
63618        }
63619        {
63620            let to_remove = ["profileId"];
63621            params.remove_params(&to_remove);
63622        }
63623
63624        let url = params.parse_with_url(&url);
63625
63626        let mut json_mime_type = mime::APPLICATION_JSON;
63627        let mut request_value_reader = {
63628            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
63629            common::remove_json_null_values(&mut value);
63630            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
63631            serde_json::to_writer(&mut dst, &value).unwrap();
63632            dst
63633        };
63634        let request_size = request_value_reader
63635            .seek(std::io::SeekFrom::End(0))
63636            .unwrap();
63637        request_value_reader
63638            .seek(std::io::SeekFrom::Start(0))
63639            .unwrap();
63640
63641        loop {
63642            let token = match self
63643                .hub
63644                .auth
63645                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
63646                .await
63647            {
63648                Ok(token) => token,
63649                Err(e) => match dlg.token(e) {
63650                    Ok(token) => token,
63651                    Err(e) => {
63652                        dlg.finished(false);
63653                        return Err(common::Error::MissingToken(e));
63654                    }
63655                },
63656            };
63657            request_value_reader
63658                .seek(std::io::SeekFrom::Start(0))
63659                .unwrap();
63660            let mut req_result = {
63661                let client = &self.hub.client;
63662                dlg.pre_request();
63663                let mut req_builder = hyper::Request::builder()
63664                    .method(hyper::Method::PUT)
63665                    .uri(url.as_str())
63666                    .header(USER_AGENT, self.hub._user_agent.clone());
63667
63668                if let Some(token) = token.as_ref() {
63669                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
63670                }
63671
63672                let request = req_builder
63673                    .header(CONTENT_TYPE, json_mime_type.to_string())
63674                    .header(CONTENT_LENGTH, request_size as u64)
63675                    .body(common::to_body(
63676                        request_value_reader.get_ref().clone().into(),
63677                    ));
63678
63679                client.request(request.unwrap()).await
63680            };
63681
63682            match req_result {
63683                Err(err) => {
63684                    if let common::Retry::After(d) = dlg.http_error(&err) {
63685                        sleep(d).await;
63686                        continue;
63687                    }
63688                    dlg.finished(false);
63689                    return Err(common::Error::HttpError(err));
63690                }
63691                Ok(res) => {
63692                    let (mut parts, body) = res.into_parts();
63693                    let mut body = common::Body::new(body);
63694                    if !parts.status.is_success() {
63695                        let bytes = common::to_bytes(body).await.unwrap_or_default();
63696                        let error = serde_json::from_str(&common::to_string(&bytes));
63697                        let response = common::to_response(parts, bytes.into());
63698
63699                        if let common::Retry::After(d) =
63700                            dlg.http_failure(&response, error.as_ref().ok())
63701                        {
63702                            sleep(d).await;
63703                            continue;
63704                        }
63705
63706                        dlg.finished(false);
63707
63708                        return Err(match error {
63709                            Ok(value) => common::Error::BadRequest(value),
63710                            _ => common::Error::Failure(response),
63711                        });
63712                    }
63713                    let response = {
63714                        let bytes = common::to_bytes(body).await.unwrap_or_default();
63715                        let encoded = common::to_string(&bytes);
63716                        match serde_json::from_str(&encoded) {
63717                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
63718                            Err(error) => {
63719                                dlg.response_json_decode_error(&encoded, &error);
63720                                return Err(common::Error::JsonDecodeError(
63721                                    encoded.to_string(),
63722                                    error,
63723                                ));
63724                            }
63725                        }
63726                    };
63727
63728                    dlg.finished(true);
63729                    return Ok(response);
63730                }
63731            }
63732        }
63733    }
63734
63735    ///
63736    /// Sets the *request* property to the given value.
63737    ///
63738    /// Even though the property as already been set when instantiating this call,
63739    /// we provide this method for API completeness.
63740    pub fn request(mut self, new_value: Placement) -> PlacementUpdateCall<'a, C> {
63741        self._request = new_value;
63742        self
63743    }
63744    /// User profile ID associated with this request.
63745    ///
63746    /// Sets the *profile id* path property to the given value.
63747    ///
63748    /// Even though the property as already been set when instantiating this call,
63749    /// we provide this method for API completeness.
63750    pub fn profile_id(mut self, new_value: i64) -> PlacementUpdateCall<'a, C> {
63751        self._profile_id = new_value;
63752        self
63753    }
63754    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
63755    /// while executing the actual API request.
63756    ///
63757    /// ````text
63758    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
63759    /// ````
63760    ///
63761    /// Sets the *delegate* property to the given value.
63762    pub fn delegate(
63763        mut self,
63764        new_value: &'a mut dyn common::Delegate,
63765    ) -> PlacementUpdateCall<'a, C> {
63766        self._delegate = Some(new_value);
63767        self
63768    }
63769
63770    /// Set any additional parameter of the query string used in the request.
63771    /// It should be used to set parameters which are not yet available through their own
63772    /// setters.
63773    ///
63774    /// Please note that this method must not be used to set any of the known parameters
63775    /// which have their own setter method. If done anyway, the request will fail.
63776    ///
63777    /// # Additional Parameters
63778    ///
63779    /// * *$.xgafv* (query-string) - V1 error format.
63780    /// * *access_token* (query-string) - OAuth access token.
63781    /// * *alt* (query-string) - Data format for response.
63782    /// * *callback* (query-string) - JSONP
63783    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
63784    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
63785    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
63786    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
63787    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
63788    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
63789    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
63790    pub fn param<T>(mut self, name: T, value: T) -> PlacementUpdateCall<'a, C>
63791    where
63792        T: AsRef<str>,
63793    {
63794        self._additional_params
63795            .insert(name.as_ref().to_string(), value.as_ref().to_string());
63796        self
63797    }
63798
63799    /// Identifies the authorization scope for the method you are building.
63800    ///
63801    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
63802    /// [`Scope::Dfatrafficking`].
63803    ///
63804    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
63805    /// tokens for more than one scope.
63806    ///
63807    /// Usually there is more than one suitable scope to authorize an operation, some of which may
63808    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
63809    /// sufficient, a read-write scope will do as well.
63810    pub fn add_scope<St>(mut self, scope: St) -> PlacementUpdateCall<'a, C>
63811    where
63812        St: AsRef<str>,
63813    {
63814        self._scopes.insert(String::from(scope.as_ref()));
63815        self
63816    }
63817    /// Identifies the authorization scope(s) for the method you are building.
63818    ///
63819    /// See [`Self::add_scope()`] for details.
63820    pub fn add_scopes<I, St>(mut self, scopes: I) -> PlacementUpdateCall<'a, C>
63821    where
63822        I: IntoIterator<Item = St>,
63823        St: AsRef<str>,
63824    {
63825        self._scopes
63826            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
63827        self
63828    }
63829
63830    /// Removes all scopes, and no default scope will be used either.
63831    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
63832    /// for details).
63833    pub fn clear_scopes(mut self) -> PlacementUpdateCall<'a, C> {
63834        self._scopes.clear();
63835        self
63836    }
63837}
63838
63839/// Gets one platform type by ID.
63840///
63841/// A builder for the *get* method supported by a *platformType* resource.
63842/// It is not used directly, but through a [`PlatformTypeMethods`] instance.
63843///
63844/// # Example
63845///
63846/// Instantiate a resource method builder
63847///
63848/// ```test_harness,no_run
63849/// # extern crate hyper;
63850/// # extern crate hyper_rustls;
63851/// # extern crate google_dfareporting3d3 as dfareporting3d3;
63852/// # async fn dox() {
63853/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
63854///
63855/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
63856/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
63857/// #     secret,
63858/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
63859/// # ).build().await.unwrap();
63860///
63861/// # let client = hyper_util::client::legacy::Client::builder(
63862/// #     hyper_util::rt::TokioExecutor::new()
63863/// # )
63864/// # .build(
63865/// #     hyper_rustls::HttpsConnectorBuilder::new()
63866/// #         .with_native_roots()
63867/// #         .unwrap()
63868/// #         .https_or_http()
63869/// #         .enable_http1()
63870/// #         .build()
63871/// # );
63872/// # let mut hub = Dfareporting::new(client, auth);
63873/// // You can configure optional parameters by calling the respective setters at will, and
63874/// // execute the final call using `doit()`.
63875/// // Values shown here are possibly random and not representative !
63876/// let result = hub.platform_types().get(-64, -96)
63877///              .doit().await;
63878/// # }
63879/// ```
63880pub struct PlatformTypeGetCall<'a, C>
63881where
63882    C: 'a,
63883{
63884    hub: &'a Dfareporting<C>,
63885    _profile_id: i64,
63886    _id: i64,
63887    _delegate: Option<&'a mut dyn common::Delegate>,
63888    _additional_params: HashMap<String, String>,
63889    _scopes: BTreeSet<String>,
63890}
63891
63892impl<'a, C> common::CallBuilder for PlatformTypeGetCall<'a, C> {}
63893
63894impl<'a, C> PlatformTypeGetCall<'a, C>
63895where
63896    C: common::Connector,
63897{
63898    /// Perform the operation you have build so far.
63899    pub async fn doit(mut self) -> common::Result<(common::Response, PlatformType)> {
63900        use std::borrow::Cow;
63901        use std::io::{Read, Seek};
63902
63903        use common::{url::Params, ToParts};
63904        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
63905
63906        let mut dd = common::DefaultDelegate;
63907        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
63908        dlg.begin(common::MethodInfo {
63909            id: "dfareporting.platformTypes.get",
63910            http_method: hyper::Method::GET,
63911        });
63912
63913        for &field in ["alt", "profileId", "id"].iter() {
63914            if self._additional_params.contains_key(field) {
63915                dlg.finished(false);
63916                return Err(common::Error::FieldClash(field));
63917            }
63918        }
63919
63920        let mut params = Params::with_capacity(4 + self._additional_params.len());
63921        params.push("profileId", self._profile_id.to_string());
63922        params.push("id", self._id.to_string());
63923
63924        params.extend(self._additional_params.iter());
63925
63926        params.push("alt", "json");
63927        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/platformTypes/{id}";
63928        if self._scopes.is_empty() {
63929            self._scopes
63930                .insert(Scope::Dfatrafficking.as_ref().to_string());
63931        }
63932
63933        #[allow(clippy::single_element_loop)]
63934        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
63935            url = params.uri_replacement(url, param_name, find_this, false);
63936        }
63937        {
63938            let to_remove = ["id", "profileId"];
63939            params.remove_params(&to_remove);
63940        }
63941
63942        let url = params.parse_with_url(&url);
63943
63944        loop {
63945            let token = match self
63946                .hub
63947                .auth
63948                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
63949                .await
63950            {
63951                Ok(token) => token,
63952                Err(e) => match dlg.token(e) {
63953                    Ok(token) => token,
63954                    Err(e) => {
63955                        dlg.finished(false);
63956                        return Err(common::Error::MissingToken(e));
63957                    }
63958                },
63959            };
63960            let mut req_result = {
63961                let client = &self.hub.client;
63962                dlg.pre_request();
63963                let mut req_builder = hyper::Request::builder()
63964                    .method(hyper::Method::GET)
63965                    .uri(url.as_str())
63966                    .header(USER_AGENT, self.hub._user_agent.clone());
63967
63968                if let Some(token) = token.as_ref() {
63969                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
63970                }
63971
63972                let request = req_builder
63973                    .header(CONTENT_LENGTH, 0_u64)
63974                    .body(common::to_body::<String>(None));
63975
63976                client.request(request.unwrap()).await
63977            };
63978
63979            match req_result {
63980                Err(err) => {
63981                    if let common::Retry::After(d) = dlg.http_error(&err) {
63982                        sleep(d).await;
63983                        continue;
63984                    }
63985                    dlg.finished(false);
63986                    return Err(common::Error::HttpError(err));
63987                }
63988                Ok(res) => {
63989                    let (mut parts, body) = res.into_parts();
63990                    let mut body = common::Body::new(body);
63991                    if !parts.status.is_success() {
63992                        let bytes = common::to_bytes(body).await.unwrap_or_default();
63993                        let error = serde_json::from_str(&common::to_string(&bytes));
63994                        let response = common::to_response(parts, bytes.into());
63995
63996                        if let common::Retry::After(d) =
63997                            dlg.http_failure(&response, error.as_ref().ok())
63998                        {
63999                            sleep(d).await;
64000                            continue;
64001                        }
64002
64003                        dlg.finished(false);
64004
64005                        return Err(match error {
64006                            Ok(value) => common::Error::BadRequest(value),
64007                            _ => common::Error::Failure(response),
64008                        });
64009                    }
64010                    let response = {
64011                        let bytes = common::to_bytes(body).await.unwrap_or_default();
64012                        let encoded = common::to_string(&bytes);
64013                        match serde_json::from_str(&encoded) {
64014                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
64015                            Err(error) => {
64016                                dlg.response_json_decode_error(&encoded, &error);
64017                                return Err(common::Error::JsonDecodeError(
64018                                    encoded.to_string(),
64019                                    error,
64020                                ));
64021                            }
64022                        }
64023                    };
64024
64025                    dlg.finished(true);
64026                    return Ok(response);
64027                }
64028            }
64029        }
64030    }
64031
64032    /// User profile ID associated with this request.
64033    ///
64034    /// Sets the *profile id* path property to the given value.
64035    ///
64036    /// Even though the property as already been set when instantiating this call,
64037    /// we provide this method for API completeness.
64038    pub fn profile_id(mut self, new_value: i64) -> PlatformTypeGetCall<'a, C> {
64039        self._profile_id = new_value;
64040        self
64041    }
64042    /// Platform type ID.
64043    ///
64044    /// Sets the *id* path property to the given value.
64045    ///
64046    /// Even though the property as already been set when instantiating this call,
64047    /// we provide this method for API completeness.
64048    pub fn id(mut self, new_value: i64) -> PlatformTypeGetCall<'a, C> {
64049        self._id = new_value;
64050        self
64051    }
64052    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
64053    /// while executing the actual API request.
64054    ///
64055    /// ````text
64056    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
64057    /// ````
64058    ///
64059    /// Sets the *delegate* property to the given value.
64060    pub fn delegate(
64061        mut self,
64062        new_value: &'a mut dyn common::Delegate,
64063    ) -> PlatformTypeGetCall<'a, C> {
64064        self._delegate = Some(new_value);
64065        self
64066    }
64067
64068    /// Set any additional parameter of the query string used in the request.
64069    /// It should be used to set parameters which are not yet available through their own
64070    /// setters.
64071    ///
64072    /// Please note that this method must not be used to set any of the known parameters
64073    /// which have their own setter method. If done anyway, the request will fail.
64074    ///
64075    /// # Additional Parameters
64076    ///
64077    /// * *$.xgafv* (query-string) - V1 error format.
64078    /// * *access_token* (query-string) - OAuth access token.
64079    /// * *alt* (query-string) - Data format for response.
64080    /// * *callback* (query-string) - JSONP
64081    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
64082    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
64083    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
64084    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
64085    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
64086    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
64087    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
64088    pub fn param<T>(mut self, name: T, value: T) -> PlatformTypeGetCall<'a, C>
64089    where
64090        T: AsRef<str>,
64091    {
64092        self._additional_params
64093            .insert(name.as_ref().to_string(), value.as_ref().to_string());
64094        self
64095    }
64096
64097    /// Identifies the authorization scope for the method you are building.
64098    ///
64099    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
64100    /// [`Scope::Dfatrafficking`].
64101    ///
64102    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
64103    /// tokens for more than one scope.
64104    ///
64105    /// Usually there is more than one suitable scope to authorize an operation, some of which may
64106    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
64107    /// sufficient, a read-write scope will do as well.
64108    pub fn add_scope<St>(mut self, scope: St) -> PlatformTypeGetCall<'a, C>
64109    where
64110        St: AsRef<str>,
64111    {
64112        self._scopes.insert(String::from(scope.as_ref()));
64113        self
64114    }
64115    /// Identifies the authorization scope(s) for the method you are building.
64116    ///
64117    /// See [`Self::add_scope()`] for details.
64118    pub fn add_scopes<I, St>(mut self, scopes: I) -> PlatformTypeGetCall<'a, C>
64119    where
64120        I: IntoIterator<Item = St>,
64121        St: AsRef<str>,
64122    {
64123        self._scopes
64124            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
64125        self
64126    }
64127
64128    /// Removes all scopes, and no default scope will be used either.
64129    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
64130    /// for details).
64131    pub fn clear_scopes(mut self) -> PlatformTypeGetCall<'a, C> {
64132        self._scopes.clear();
64133        self
64134    }
64135}
64136
64137/// Retrieves a list of platform types.
64138///
64139/// A builder for the *list* method supported by a *platformType* resource.
64140/// It is not used directly, but through a [`PlatformTypeMethods`] instance.
64141///
64142/// # Example
64143///
64144/// Instantiate a resource method builder
64145///
64146/// ```test_harness,no_run
64147/// # extern crate hyper;
64148/// # extern crate hyper_rustls;
64149/// # extern crate google_dfareporting3d3 as dfareporting3d3;
64150/// # async fn dox() {
64151/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
64152///
64153/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
64154/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
64155/// #     secret,
64156/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
64157/// # ).build().await.unwrap();
64158///
64159/// # let client = hyper_util::client::legacy::Client::builder(
64160/// #     hyper_util::rt::TokioExecutor::new()
64161/// # )
64162/// # .build(
64163/// #     hyper_rustls::HttpsConnectorBuilder::new()
64164/// #         .with_native_roots()
64165/// #         .unwrap()
64166/// #         .https_or_http()
64167/// #         .enable_http1()
64168/// #         .build()
64169/// # );
64170/// # let mut hub = Dfareporting::new(client, auth);
64171/// // You can configure optional parameters by calling the respective setters at will, and
64172/// // execute the final call using `doit()`.
64173/// // Values shown here are possibly random and not representative !
64174/// let result = hub.platform_types().list(-69)
64175///              .doit().await;
64176/// # }
64177/// ```
64178pub struct PlatformTypeListCall<'a, C>
64179where
64180    C: 'a,
64181{
64182    hub: &'a Dfareporting<C>,
64183    _profile_id: i64,
64184    _delegate: Option<&'a mut dyn common::Delegate>,
64185    _additional_params: HashMap<String, String>,
64186    _scopes: BTreeSet<String>,
64187}
64188
64189impl<'a, C> common::CallBuilder for PlatformTypeListCall<'a, C> {}
64190
64191impl<'a, C> PlatformTypeListCall<'a, C>
64192where
64193    C: common::Connector,
64194{
64195    /// Perform the operation you have build so far.
64196    pub async fn doit(mut self) -> common::Result<(common::Response, PlatformTypesListResponse)> {
64197        use std::borrow::Cow;
64198        use std::io::{Read, Seek};
64199
64200        use common::{url::Params, ToParts};
64201        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
64202
64203        let mut dd = common::DefaultDelegate;
64204        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
64205        dlg.begin(common::MethodInfo {
64206            id: "dfareporting.platformTypes.list",
64207            http_method: hyper::Method::GET,
64208        });
64209
64210        for &field in ["alt", "profileId"].iter() {
64211            if self._additional_params.contains_key(field) {
64212                dlg.finished(false);
64213                return Err(common::Error::FieldClash(field));
64214            }
64215        }
64216
64217        let mut params = Params::with_capacity(3 + self._additional_params.len());
64218        params.push("profileId", self._profile_id.to_string());
64219
64220        params.extend(self._additional_params.iter());
64221
64222        params.push("alt", "json");
64223        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/platformTypes";
64224        if self._scopes.is_empty() {
64225            self._scopes
64226                .insert(Scope::Dfatrafficking.as_ref().to_string());
64227        }
64228
64229        #[allow(clippy::single_element_loop)]
64230        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
64231            url = params.uri_replacement(url, param_name, find_this, false);
64232        }
64233        {
64234            let to_remove = ["profileId"];
64235            params.remove_params(&to_remove);
64236        }
64237
64238        let url = params.parse_with_url(&url);
64239
64240        loop {
64241            let token = match self
64242                .hub
64243                .auth
64244                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
64245                .await
64246            {
64247                Ok(token) => token,
64248                Err(e) => match dlg.token(e) {
64249                    Ok(token) => token,
64250                    Err(e) => {
64251                        dlg.finished(false);
64252                        return Err(common::Error::MissingToken(e));
64253                    }
64254                },
64255            };
64256            let mut req_result = {
64257                let client = &self.hub.client;
64258                dlg.pre_request();
64259                let mut req_builder = hyper::Request::builder()
64260                    .method(hyper::Method::GET)
64261                    .uri(url.as_str())
64262                    .header(USER_AGENT, self.hub._user_agent.clone());
64263
64264                if let Some(token) = token.as_ref() {
64265                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
64266                }
64267
64268                let request = req_builder
64269                    .header(CONTENT_LENGTH, 0_u64)
64270                    .body(common::to_body::<String>(None));
64271
64272                client.request(request.unwrap()).await
64273            };
64274
64275            match req_result {
64276                Err(err) => {
64277                    if let common::Retry::After(d) = dlg.http_error(&err) {
64278                        sleep(d).await;
64279                        continue;
64280                    }
64281                    dlg.finished(false);
64282                    return Err(common::Error::HttpError(err));
64283                }
64284                Ok(res) => {
64285                    let (mut parts, body) = res.into_parts();
64286                    let mut body = common::Body::new(body);
64287                    if !parts.status.is_success() {
64288                        let bytes = common::to_bytes(body).await.unwrap_or_default();
64289                        let error = serde_json::from_str(&common::to_string(&bytes));
64290                        let response = common::to_response(parts, bytes.into());
64291
64292                        if let common::Retry::After(d) =
64293                            dlg.http_failure(&response, error.as_ref().ok())
64294                        {
64295                            sleep(d).await;
64296                            continue;
64297                        }
64298
64299                        dlg.finished(false);
64300
64301                        return Err(match error {
64302                            Ok(value) => common::Error::BadRequest(value),
64303                            _ => common::Error::Failure(response),
64304                        });
64305                    }
64306                    let response = {
64307                        let bytes = common::to_bytes(body).await.unwrap_or_default();
64308                        let encoded = common::to_string(&bytes);
64309                        match serde_json::from_str(&encoded) {
64310                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
64311                            Err(error) => {
64312                                dlg.response_json_decode_error(&encoded, &error);
64313                                return Err(common::Error::JsonDecodeError(
64314                                    encoded.to_string(),
64315                                    error,
64316                                ));
64317                            }
64318                        }
64319                    };
64320
64321                    dlg.finished(true);
64322                    return Ok(response);
64323                }
64324            }
64325        }
64326    }
64327
64328    /// User profile ID associated with this request.
64329    ///
64330    /// Sets the *profile id* path property to the given value.
64331    ///
64332    /// Even though the property as already been set when instantiating this call,
64333    /// we provide this method for API completeness.
64334    pub fn profile_id(mut self, new_value: i64) -> PlatformTypeListCall<'a, C> {
64335        self._profile_id = new_value;
64336        self
64337    }
64338    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
64339    /// while executing the actual API request.
64340    ///
64341    /// ````text
64342    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
64343    /// ````
64344    ///
64345    /// Sets the *delegate* property to the given value.
64346    pub fn delegate(
64347        mut self,
64348        new_value: &'a mut dyn common::Delegate,
64349    ) -> PlatformTypeListCall<'a, C> {
64350        self._delegate = Some(new_value);
64351        self
64352    }
64353
64354    /// Set any additional parameter of the query string used in the request.
64355    /// It should be used to set parameters which are not yet available through their own
64356    /// setters.
64357    ///
64358    /// Please note that this method must not be used to set any of the known parameters
64359    /// which have their own setter method. If done anyway, the request will fail.
64360    ///
64361    /// # Additional Parameters
64362    ///
64363    /// * *$.xgafv* (query-string) - V1 error format.
64364    /// * *access_token* (query-string) - OAuth access token.
64365    /// * *alt* (query-string) - Data format for response.
64366    /// * *callback* (query-string) - JSONP
64367    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
64368    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
64369    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
64370    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
64371    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
64372    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
64373    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
64374    pub fn param<T>(mut self, name: T, value: T) -> PlatformTypeListCall<'a, C>
64375    where
64376        T: AsRef<str>,
64377    {
64378        self._additional_params
64379            .insert(name.as_ref().to_string(), value.as_ref().to_string());
64380        self
64381    }
64382
64383    /// Identifies the authorization scope for the method you are building.
64384    ///
64385    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
64386    /// [`Scope::Dfatrafficking`].
64387    ///
64388    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
64389    /// tokens for more than one scope.
64390    ///
64391    /// Usually there is more than one suitable scope to authorize an operation, some of which may
64392    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
64393    /// sufficient, a read-write scope will do as well.
64394    pub fn add_scope<St>(mut self, scope: St) -> PlatformTypeListCall<'a, C>
64395    where
64396        St: AsRef<str>,
64397    {
64398        self._scopes.insert(String::from(scope.as_ref()));
64399        self
64400    }
64401    /// Identifies the authorization scope(s) for the method you are building.
64402    ///
64403    /// See [`Self::add_scope()`] for details.
64404    pub fn add_scopes<I, St>(mut self, scopes: I) -> PlatformTypeListCall<'a, C>
64405    where
64406        I: IntoIterator<Item = St>,
64407        St: AsRef<str>,
64408    {
64409        self._scopes
64410            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
64411        self
64412    }
64413
64414    /// Removes all scopes, and no default scope will be used either.
64415    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
64416    /// for details).
64417    pub fn clear_scopes(mut self) -> PlatformTypeListCall<'a, C> {
64418        self._scopes.clear();
64419        self
64420    }
64421}
64422
64423/// Gets one postal code by ID.
64424///
64425/// A builder for the *get* method supported by a *postalCode* resource.
64426/// It is not used directly, but through a [`PostalCodeMethods`] instance.
64427///
64428/// # Example
64429///
64430/// Instantiate a resource method builder
64431///
64432/// ```test_harness,no_run
64433/// # extern crate hyper;
64434/// # extern crate hyper_rustls;
64435/// # extern crate google_dfareporting3d3 as dfareporting3d3;
64436/// # async fn dox() {
64437/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
64438///
64439/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
64440/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
64441/// #     secret,
64442/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
64443/// # ).build().await.unwrap();
64444///
64445/// # let client = hyper_util::client::legacy::Client::builder(
64446/// #     hyper_util::rt::TokioExecutor::new()
64447/// # )
64448/// # .build(
64449/// #     hyper_rustls::HttpsConnectorBuilder::new()
64450/// #         .with_native_roots()
64451/// #         .unwrap()
64452/// #         .https_or_http()
64453/// #         .enable_http1()
64454/// #         .build()
64455/// # );
64456/// # let mut hub = Dfareporting::new(client, auth);
64457/// // You can configure optional parameters by calling the respective setters at will, and
64458/// // execute the final call using `doit()`.
64459/// // Values shown here are possibly random and not representative !
64460/// let result = hub.postal_codes().get(-48, "code")
64461///              .doit().await;
64462/// # }
64463/// ```
64464pub struct PostalCodeGetCall<'a, C>
64465where
64466    C: 'a,
64467{
64468    hub: &'a Dfareporting<C>,
64469    _profile_id: i64,
64470    _code: String,
64471    _delegate: Option<&'a mut dyn common::Delegate>,
64472    _additional_params: HashMap<String, String>,
64473    _scopes: BTreeSet<String>,
64474}
64475
64476impl<'a, C> common::CallBuilder for PostalCodeGetCall<'a, C> {}
64477
64478impl<'a, C> PostalCodeGetCall<'a, C>
64479where
64480    C: common::Connector,
64481{
64482    /// Perform the operation you have build so far.
64483    pub async fn doit(mut self) -> common::Result<(common::Response, PostalCode)> {
64484        use std::borrow::Cow;
64485        use std::io::{Read, Seek};
64486
64487        use common::{url::Params, ToParts};
64488        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
64489
64490        let mut dd = common::DefaultDelegate;
64491        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
64492        dlg.begin(common::MethodInfo {
64493            id: "dfareporting.postalCodes.get",
64494            http_method: hyper::Method::GET,
64495        });
64496
64497        for &field in ["alt", "profileId", "code"].iter() {
64498            if self._additional_params.contains_key(field) {
64499                dlg.finished(false);
64500                return Err(common::Error::FieldClash(field));
64501            }
64502        }
64503
64504        let mut params = Params::with_capacity(4 + self._additional_params.len());
64505        params.push("profileId", self._profile_id.to_string());
64506        params.push("code", self._code);
64507
64508        params.extend(self._additional_params.iter());
64509
64510        params.push("alt", "json");
64511        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/postalCodes/{code}";
64512        if self._scopes.is_empty() {
64513            self._scopes
64514                .insert(Scope::Dfatrafficking.as_ref().to_string());
64515        }
64516
64517        #[allow(clippy::single_element_loop)]
64518        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{code}", "code")].iter() {
64519            url = params.uri_replacement(url, param_name, find_this, false);
64520        }
64521        {
64522            let to_remove = ["code", "profileId"];
64523            params.remove_params(&to_remove);
64524        }
64525
64526        let url = params.parse_with_url(&url);
64527
64528        loop {
64529            let token = match self
64530                .hub
64531                .auth
64532                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
64533                .await
64534            {
64535                Ok(token) => token,
64536                Err(e) => match dlg.token(e) {
64537                    Ok(token) => token,
64538                    Err(e) => {
64539                        dlg.finished(false);
64540                        return Err(common::Error::MissingToken(e));
64541                    }
64542                },
64543            };
64544            let mut req_result = {
64545                let client = &self.hub.client;
64546                dlg.pre_request();
64547                let mut req_builder = hyper::Request::builder()
64548                    .method(hyper::Method::GET)
64549                    .uri(url.as_str())
64550                    .header(USER_AGENT, self.hub._user_agent.clone());
64551
64552                if let Some(token) = token.as_ref() {
64553                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
64554                }
64555
64556                let request = req_builder
64557                    .header(CONTENT_LENGTH, 0_u64)
64558                    .body(common::to_body::<String>(None));
64559
64560                client.request(request.unwrap()).await
64561            };
64562
64563            match req_result {
64564                Err(err) => {
64565                    if let common::Retry::After(d) = dlg.http_error(&err) {
64566                        sleep(d).await;
64567                        continue;
64568                    }
64569                    dlg.finished(false);
64570                    return Err(common::Error::HttpError(err));
64571                }
64572                Ok(res) => {
64573                    let (mut parts, body) = res.into_parts();
64574                    let mut body = common::Body::new(body);
64575                    if !parts.status.is_success() {
64576                        let bytes = common::to_bytes(body).await.unwrap_or_default();
64577                        let error = serde_json::from_str(&common::to_string(&bytes));
64578                        let response = common::to_response(parts, bytes.into());
64579
64580                        if let common::Retry::After(d) =
64581                            dlg.http_failure(&response, error.as_ref().ok())
64582                        {
64583                            sleep(d).await;
64584                            continue;
64585                        }
64586
64587                        dlg.finished(false);
64588
64589                        return Err(match error {
64590                            Ok(value) => common::Error::BadRequest(value),
64591                            _ => common::Error::Failure(response),
64592                        });
64593                    }
64594                    let response = {
64595                        let bytes = common::to_bytes(body).await.unwrap_or_default();
64596                        let encoded = common::to_string(&bytes);
64597                        match serde_json::from_str(&encoded) {
64598                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
64599                            Err(error) => {
64600                                dlg.response_json_decode_error(&encoded, &error);
64601                                return Err(common::Error::JsonDecodeError(
64602                                    encoded.to_string(),
64603                                    error,
64604                                ));
64605                            }
64606                        }
64607                    };
64608
64609                    dlg.finished(true);
64610                    return Ok(response);
64611                }
64612            }
64613        }
64614    }
64615
64616    /// User profile ID associated with this request.
64617    ///
64618    /// Sets the *profile id* path property to the given value.
64619    ///
64620    /// Even though the property as already been set when instantiating this call,
64621    /// we provide this method for API completeness.
64622    pub fn profile_id(mut self, new_value: i64) -> PostalCodeGetCall<'a, C> {
64623        self._profile_id = new_value;
64624        self
64625    }
64626    /// Postal code ID.
64627    ///
64628    /// Sets the *code* path property to the given value.
64629    ///
64630    /// Even though the property as already been set when instantiating this call,
64631    /// we provide this method for API completeness.
64632    pub fn code(mut self, new_value: &str) -> PostalCodeGetCall<'a, C> {
64633        self._code = new_value.to_string();
64634        self
64635    }
64636    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
64637    /// while executing the actual API request.
64638    ///
64639    /// ````text
64640    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
64641    /// ````
64642    ///
64643    /// Sets the *delegate* property to the given value.
64644    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> PostalCodeGetCall<'a, C> {
64645        self._delegate = Some(new_value);
64646        self
64647    }
64648
64649    /// Set any additional parameter of the query string used in the request.
64650    /// It should be used to set parameters which are not yet available through their own
64651    /// setters.
64652    ///
64653    /// Please note that this method must not be used to set any of the known parameters
64654    /// which have their own setter method. If done anyway, the request will fail.
64655    ///
64656    /// # Additional Parameters
64657    ///
64658    /// * *$.xgafv* (query-string) - V1 error format.
64659    /// * *access_token* (query-string) - OAuth access token.
64660    /// * *alt* (query-string) - Data format for response.
64661    /// * *callback* (query-string) - JSONP
64662    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
64663    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
64664    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
64665    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
64666    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
64667    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
64668    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
64669    pub fn param<T>(mut self, name: T, value: T) -> PostalCodeGetCall<'a, C>
64670    where
64671        T: AsRef<str>,
64672    {
64673        self._additional_params
64674            .insert(name.as_ref().to_string(), value.as_ref().to_string());
64675        self
64676    }
64677
64678    /// Identifies the authorization scope for the method you are building.
64679    ///
64680    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
64681    /// [`Scope::Dfatrafficking`].
64682    ///
64683    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
64684    /// tokens for more than one scope.
64685    ///
64686    /// Usually there is more than one suitable scope to authorize an operation, some of which may
64687    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
64688    /// sufficient, a read-write scope will do as well.
64689    pub fn add_scope<St>(mut self, scope: St) -> PostalCodeGetCall<'a, C>
64690    where
64691        St: AsRef<str>,
64692    {
64693        self._scopes.insert(String::from(scope.as_ref()));
64694        self
64695    }
64696    /// Identifies the authorization scope(s) for the method you are building.
64697    ///
64698    /// See [`Self::add_scope()`] for details.
64699    pub fn add_scopes<I, St>(mut self, scopes: I) -> PostalCodeGetCall<'a, C>
64700    where
64701        I: IntoIterator<Item = St>,
64702        St: AsRef<str>,
64703    {
64704        self._scopes
64705            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
64706        self
64707    }
64708
64709    /// Removes all scopes, and no default scope will be used either.
64710    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
64711    /// for details).
64712    pub fn clear_scopes(mut self) -> PostalCodeGetCall<'a, C> {
64713        self._scopes.clear();
64714        self
64715    }
64716}
64717
64718/// Retrieves a list of postal codes.
64719///
64720/// A builder for the *list* method supported by a *postalCode* resource.
64721/// It is not used directly, but through a [`PostalCodeMethods`] instance.
64722///
64723/// # Example
64724///
64725/// Instantiate a resource method builder
64726///
64727/// ```test_harness,no_run
64728/// # extern crate hyper;
64729/// # extern crate hyper_rustls;
64730/// # extern crate google_dfareporting3d3 as dfareporting3d3;
64731/// # async fn dox() {
64732/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
64733///
64734/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
64735/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
64736/// #     secret,
64737/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
64738/// # ).build().await.unwrap();
64739///
64740/// # let client = hyper_util::client::legacy::Client::builder(
64741/// #     hyper_util::rt::TokioExecutor::new()
64742/// # )
64743/// # .build(
64744/// #     hyper_rustls::HttpsConnectorBuilder::new()
64745/// #         .with_native_roots()
64746/// #         .unwrap()
64747/// #         .https_or_http()
64748/// #         .enable_http1()
64749/// #         .build()
64750/// # );
64751/// # let mut hub = Dfareporting::new(client, auth);
64752/// // You can configure optional parameters by calling the respective setters at will, and
64753/// // execute the final call using `doit()`.
64754/// // Values shown here are possibly random and not representative !
64755/// let result = hub.postal_codes().list(-58)
64756///              .doit().await;
64757/// # }
64758/// ```
64759pub struct PostalCodeListCall<'a, C>
64760where
64761    C: 'a,
64762{
64763    hub: &'a Dfareporting<C>,
64764    _profile_id: i64,
64765    _delegate: Option<&'a mut dyn common::Delegate>,
64766    _additional_params: HashMap<String, String>,
64767    _scopes: BTreeSet<String>,
64768}
64769
64770impl<'a, C> common::CallBuilder for PostalCodeListCall<'a, C> {}
64771
64772impl<'a, C> PostalCodeListCall<'a, C>
64773where
64774    C: common::Connector,
64775{
64776    /// Perform the operation you have build so far.
64777    pub async fn doit(mut self) -> common::Result<(common::Response, PostalCodesListResponse)> {
64778        use std::borrow::Cow;
64779        use std::io::{Read, Seek};
64780
64781        use common::{url::Params, ToParts};
64782        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
64783
64784        let mut dd = common::DefaultDelegate;
64785        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
64786        dlg.begin(common::MethodInfo {
64787            id: "dfareporting.postalCodes.list",
64788            http_method: hyper::Method::GET,
64789        });
64790
64791        for &field in ["alt", "profileId"].iter() {
64792            if self._additional_params.contains_key(field) {
64793                dlg.finished(false);
64794                return Err(common::Error::FieldClash(field));
64795            }
64796        }
64797
64798        let mut params = Params::with_capacity(3 + self._additional_params.len());
64799        params.push("profileId", self._profile_id.to_string());
64800
64801        params.extend(self._additional_params.iter());
64802
64803        params.push("alt", "json");
64804        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/postalCodes";
64805        if self._scopes.is_empty() {
64806            self._scopes
64807                .insert(Scope::Dfatrafficking.as_ref().to_string());
64808        }
64809
64810        #[allow(clippy::single_element_loop)]
64811        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
64812            url = params.uri_replacement(url, param_name, find_this, false);
64813        }
64814        {
64815            let to_remove = ["profileId"];
64816            params.remove_params(&to_remove);
64817        }
64818
64819        let url = params.parse_with_url(&url);
64820
64821        loop {
64822            let token = match self
64823                .hub
64824                .auth
64825                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
64826                .await
64827            {
64828                Ok(token) => token,
64829                Err(e) => match dlg.token(e) {
64830                    Ok(token) => token,
64831                    Err(e) => {
64832                        dlg.finished(false);
64833                        return Err(common::Error::MissingToken(e));
64834                    }
64835                },
64836            };
64837            let mut req_result = {
64838                let client = &self.hub.client;
64839                dlg.pre_request();
64840                let mut req_builder = hyper::Request::builder()
64841                    .method(hyper::Method::GET)
64842                    .uri(url.as_str())
64843                    .header(USER_AGENT, self.hub._user_agent.clone());
64844
64845                if let Some(token) = token.as_ref() {
64846                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
64847                }
64848
64849                let request = req_builder
64850                    .header(CONTENT_LENGTH, 0_u64)
64851                    .body(common::to_body::<String>(None));
64852
64853                client.request(request.unwrap()).await
64854            };
64855
64856            match req_result {
64857                Err(err) => {
64858                    if let common::Retry::After(d) = dlg.http_error(&err) {
64859                        sleep(d).await;
64860                        continue;
64861                    }
64862                    dlg.finished(false);
64863                    return Err(common::Error::HttpError(err));
64864                }
64865                Ok(res) => {
64866                    let (mut parts, body) = res.into_parts();
64867                    let mut body = common::Body::new(body);
64868                    if !parts.status.is_success() {
64869                        let bytes = common::to_bytes(body).await.unwrap_or_default();
64870                        let error = serde_json::from_str(&common::to_string(&bytes));
64871                        let response = common::to_response(parts, bytes.into());
64872
64873                        if let common::Retry::After(d) =
64874                            dlg.http_failure(&response, error.as_ref().ok())
64875                        {
64876                            sleep(d).await;
64877                            continue;
64878                        }
64879
64880                        dlg.finished(false);
64881
64882                        return Err(match error {
64883                            Ok(value) => common::Error::BadRequest(value),
64884                            _ => common::Error::Failure(response),
64885                        });
64886                    }
64887                    let response = {
64888                        let bytes = common::to_bytes(body).await.unwrap_or_default();
64889                        let encoded = common::to_string(&bytes);
64890                        match serde_json::from_str(&encoded) {
64891                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
64892                            Err(error) => {
64893                                dlg.response_json_decode_error(&encoded, &error);
64894                                return Err(common::Error::JsonDecodeError(
64895                                    encoded.to_string(),
64896                                    error,
64897                                ));
64898                            }
64899                        }
64900                    };
64901
64902                    dlg.finished(true);
64903                    return Ok(response);
64904                }
64905            }
64906        }
64907    }
64908
64909    /// User profile ID associated with this request.
64910    ///
64911    /// Sets the *profile id* path property to the given value.
64912    ///
64913    /// Even though the property as already been set when instantiating this call,
64914    /// we provide this method for API completeness.
64915    pub fn profile_id(mut self, new_value: i64) -> PostalCodeListCall<'a, C> {
64916        self._profile_id = new_value;
64917        self
64918    }
64919    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
64920    /// while executing the actual API request.
64921    ///
64922    /// ````text
64923    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
64924    /// ````
64925    ///
64926    /// Sets the *delegate* property to the given value.
64927    pub fn delegate(
64928        mut self,
64929        new_value: &'a mut dyn common::Delegate,
64930    ) -> PostalCodeListCall<'a, C> {
64931        self._delegate = Some(new_value);
64932        self
64933    }
64934
64935    /// Set any additional parameter of the query string used in the request.
64936    /// It should be used to set parameters which are not yet available through their own
64937    /// setters.
64938    ///
64939    /// Please note that this method must not be used to set any of the known parameters
64940    /// which have their own setter method. If done anyway, the request will fail.
64941    ///
64942    /// # Additional Parameters
64943    ///
64944    /// * *$.xgafv* (query-string) - V1 error format.
64945    /// * *access_token* (query-string) - OAuth access token.
64946    /// * *alt* (query-string) - Data format for response.
64947    /// * *callback* (query-string) - JSONP
64948    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
64949    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
64950    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
64951    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
64952    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
64953    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
64954    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
64955    pub fn param<T>(mut self, name: T, value: T) -> PostalCodeListCall<'a, C>
64956    where
64957        T: AsRef<str>,
64958    {
64959        self._additional_params
64960            .insert(name.as_ref().to_string(), value.as_ref().to_string());
64961        self
64962    }
64963
64964    /// Identifies the authorization scope for the method you are building.
64965    ///
64966    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
64967    /// [`Scope::Dfatrafficking`].
64968    ///
64969    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
64970    /// tokens for more than one scope.
64971    ///
64972    /// Usually there is more than one suitable scope to authorize an operation, some of which may
64973    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
64974    /// sufficient, a read-write scope will do as well.
64975    pub fn add_scope<St>(mut self, scope: St) -> PostalCodeListCall<'a, C>
64976    where
64977        St: AsRef<str>,
64978    {
64979        self._scopes.insert(String::from(scope.as_ref()));
64980        self
64981    }
64982    /// Identifies the authorization scope(s) for the method you are building.
64983    ///
64984    /// See [`Self::add_scope()`] for details.
64985    pub fn add_scopes<I, St>(mut self, scopes: I) -> PostalCodeListCall<'a, C>
64986    where
64987        I: IntoIterator<Item = St>,
64988        St: AsRef<str>,
64989    {
64990        self._scopes
64991            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
64992        self
64993    }
64994
64995    /// Removes all scopes, and no default scope will be used either.
64996    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
64997    /// for details).
64998    pub fn clear_scopes(mut self) -> PostalCodeListCall<'a, C> {
64999        self._scopes.clear();
65000        self
65001    }
65002}
65003
65004/// Gets one project by ID.
65005///
65006/// A builder for the *get* method supported by a *project* resource.
65007/// It is not used directly, but through a [`ProjectMethods`] instance.
65008///
65009/// # Example
65010///
65011/// Instantiate a resource method builder
65012///
65013/// ```test_harness,no_run
65014/// # extern crate hyper;
65015/// # extern crate hyper_rustls;
65016/// # extern crate google_dfareporting3d3 as dfareporting3d3;
65017/// # async fn dox() {
65018/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
65019///
65020/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
65021/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
65022/// #     secret,
65023/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
65024/// # ).build().await.unwrap();
65025///
65026/// # let client = hyper_util::client::legacy::Client::builder(
65027/// #     hyper_util::rt::TokioExecutor::new()
65028/// # )
65029/// # .build(
65030/// #     hyper_rustls::HttpsConnectorBuilder::new()
65031/// #         .with_native_roots()
65032/// #         .unwrap()
65033/// #         .https_or_http()
65034/// #         .enable_http1()
65035/// #         .build()
65036/// # );
65037/// # let mut hub = Dfareporting::new(client, auth);
65038/// // You can configure optional parameters by calling the respective setters at will, and
65039/// // execute the final call using `doit()`.
65040/// // Values shown here are possibly random and not representative !
65041/// let result = hub.projects().get(-13, -90)
65042///              .doit().await;
65043/// # }
65044/// ```
65045pub struct ProjectGetCall<'a, C>
65046where
65047    C: 'a,
65048{
65049    hub: &'a Dfareporting<C>,
65050    _profile_id: i64,
65051    _id: i64,
65052    _delegate: Option<&'a mut dyn common::Delegate>,
65053    _additional_params: HashMap<String, String>,
65054    _scopes: BTreeSet<String>,
65055}
65056
65057impl<'a, C> common::CallBuilder for ProjectGetCall<'a, C> {}
65058
65059impl<'a, C> ProjectGetCall<'a, C>
65060where
65061    C: common::Connector,
65062{
65063    /// Perform the operation you have build so far.
65064    pub async fn doit(mut self) -> common::Result<(common::Response, Project)> {
65065        use std::borrow::Cow;
65066        use std::io::{Read, Seek};
65067
65068        use common::{url::Params, ToParts};
65069        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
65070
65071        let mut dd = common::DefaultDelegate;
65072        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
65073        dlg.begin(common::MethodInfo {
65074            id: "dfareporting.projects.get",
65075            http_method: hyper::Method::GET,
65076        });
65077
65078        for &field in ["alt", "profileId", "id"].iter() {
65079            if self._additional_params.contains_key(field) {
65080                dlg.finished(false);
65081                return Err(common::Error::FieldClash(field));
65082            }
65083        }
65084
65085        let mut params = Params::with_capacity(4 + self._additional_params.len());
65086        params.push("profileId", self._profile_id.to_string());
65087        params.push("id", self._id.to_string());
65088
65089        params.extend(self._additional_params.iter());
65090
65091        params.push("alt", "json");
65092        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/projects/{id}";
65093        if self._scopes.is_empty() {
65094            self._scopes
65095                .insert(Scope::Dfatrafficking.as_ref().to_string());
65096        }
65097
65098        #[allow(clippy::single_element_loop)]
65099        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
65100            url = params.uri_replacement(url, param_name, find_this, false);
65101        }
65102        {
65103            let to_remove = ["id", "profileId"];
65104            params.remove_params(&to_remove);
65105        }
65106
65107        let url = params.parse_with_url(&url);
65108
65109        loop {
65110            let token = match self
65111                .hub
65112                .auth
65113                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
65114                .await
65115            {
65116                Ok(token) => token,
65117                Err(e) => match dlg.token(e) {
65118                    Ok(token) => token,
65119                    Err(e) => {
65120                        dlg.finished(false);
65121                        return Err(common::Error::MissingToken(e));
65122                    }
65123                },
65124            };
65125            let mut req_result = {
65126                let client = &self.hub.client;
65127                dlg.pre_request();
65128                let mut req_builder = hyper::Request::builder()
65129                    .method(hyper::Method::GET)
65130                    .uri(url.as_str())
65131                    .header(USER_AGENT, self.hub._user_agent.clone());
65132
65133                if let Some(token) = token.as_ref() {
65134                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
65135                }
65136
65137                let request = req_builder
65138                    .header(CONTENT_LENGTH, 0_u64)
65139                    .body(common::to_body::<String>(None));
65140
65141                client.request(request.unwrap()).await
65142            };
65143
65144            match req_result {
65145                Err(err) => {
65146                    if let common::Retry::After(d) = dlg.http_error(&err) {
65147                        sleep(d).await;
65148                        continue;
65149                    }
65150                    dlg.finished(false);
65151                    return Err(common::Error::HttpError(err));
65152                }
65153                Ok(res) => {
65154                    let (mut parts, body) = res.into_parts();
65155                    let mut body = common::Body::new(body);
65156                    if !parts.status.is_success() {
65157                        let bytes = common::to_bytes(body).await.unwrap_or_default();
65158                        let error = serde_json::from_str(&common::to_string(&bytes));
65159                        let response = common::to_response(parts, bytes.into());
65160
65161                        if let common::Retry::After(d) =
65162                            dlg.http_failure(&response, error.as_ref().ok())
65163                        {
65164                            sleep(d).await;
65165                            continue;
65166                        }
65167
65168                        dlg.finished(false);
65169
65170                        return Err(match error {
65171                            Ok(value) => common::Error::BadRequest(value),
65172                            _ => common::Error::Failure(response),
65173                        });
65174                    }
65175                    let response = {
65176                        let bytes = common::to_bytes(body).await.unwrap_or_default();
65177                        let encoded = common::to_string(&bytes);
65178                        match serde_json::from_str(&encoded) {
65179                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
65180                            Err(error) => {
65181                                dlg.response_json_decode_error(&encoded, &error);
65182                                return Err(common::Error::JsonDecodeError(
65183                                    encoded.to_string(),
65184                                    error,
65185                                ));
65186                            }
65187                        }
65188                    };
65189
65190                    dlg.finished(true);
65191                    return Ok(response);
65192                }
65193            }
65194        }
65195    }
65196
65197    /// User profile ID associated with this request.
65198    ///
65199    /// Sets the *profile id* path property to the given value.
65200    ///
65201    /// Even though the property as already been set when instantiating this call,
65202    /// we provide this method for API completeness.
65203    pub fn profile_id(mut self, new_value: i64) -> ProjectGetCall<'a, C> {
65204        self._profile_id = new_value;
65205        self
65206    }
65207    /// Project ID.
65208    ///
65209    /// Sets the *id* path property to the given value.
65210    ///
65211    /// Even though the property as already been set when instantiating this call,
65212    /// we provide this method for API completeness.
65213    pub fn id(mut self, new_value: i64) -> ProjectGetCall<'a, C> {
65214        self._id = new_value;
65215        self
65216    }
65217    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
65218    /// while executing the actual API request.
65219    ///
65220    /// ````text
65221    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
65222    /// ````
65223    ///
65224    /// Sets the *delegate* property to the given value.
65225    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ProjectGetCall<'a, C> {
65226        self._delegate = Some(new_value);
65227        self
65228    }
65229
65230    /// Set any additional parameter of the query string used in the request.
65231    /// It should be used to set parameters which are not yet available through their own
65232    /// setters.
65233    ///
65234    /// Please note that this method must not be used to set any of the known parameters
65235    /// which have their own setter method. If done anyway, the request will fail.
65236    ///
65237    /// # Additional Parameters
65238    ///
65239    /// * *$.xgafv* (query-string) - V1 error format.
65240    /// * *access_token* (query-string) - OAuth access token.
65241    /// * *alt* (query-string) - Data format for response.
65242    /// * *callback* (query-string) - JSONP
65243    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
65244    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
65245    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
65246    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
65247    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
65248    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
65249    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
65250    pub fn param<T>(mut self, name: T, value: T) -> ProjectGetCall<'a, C>
65251    where
65252        T: AsRef<str>,
65253    {
65254        self._additional_params
65255            .insert(name.as_ref().to_string(), value.as_ref().to_string());
65256        self
65257    }
65258
65259    /// Identifies the authorization scope for the method you are building.
65260    ///
65261    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
65262    /// [`Scope::Dfatrafficking`].
65263    ///
65264    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
65265    /// tokens for more than one scope.
65266    ///
65267    /// Usually there is more than one suitable scope to authorize an operation, some of which may
65268    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
65269    /// sufficient, a read-write scope will do as well.
65270    pub fn add_scope<St>(mut self, scope: St) -> ProjectGetCall<'a, C>
65271    where
65272        St: AsRef<str>,
65273    {
65274        self._scopes.insert(String::from(scope.as_ref()));
65275        self
65276    }
65277    /// Identifies the authorization scope(s) for the method you are building.
65278    ///
65279    /// See [`Self::add_scope()`] for details.
65280    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectGetCall<'a, C>
65281    where
65282        I: IntoIterator<Item = St>,
65283        St: AsRef<str>,
65284    {
65285        self._scopes
65286            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
65287        self
65288    }
65289
65290    /// Removes all scopes, and no default scope will be used either.
65291    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
65292    /// for details).
65293    pub fn clear_scopes(mut self) -> ProjectGetCall<'a, C> {
65294        self._scopes.clear();
65295        self
65296    }
65297}
65298
65299/// Retrieves a list of projects, possibly filtered. This method supports paging .
65300///
65301/// A builder for the *list* method supported by a *project* resource.
65302/// It is not used directly, but through a [`ProjectMethods`] instance.
65303///
65304/// # Example
65305///
65306/// Instantiate a resource method builder
65307///
65308/// ```test_harness,no_run
65309/// # extern crate hyper;
65310/// # extern crate hyper_rustls;
65311/// # extern crate google_dfareporting3d3 as dfareporting3d3;
65312/// # async fn dox() {
65313/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
65314///
65315/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
65316/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
65317/// #     secret,
65318/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
65319/// # ).build().await.unwrap();
65320///
65321/// # let client = hyper_util::client::legacy::Client::builder(
65322/// #     hyper_util::rt::TokioExecutor::new()
65323/// # )
65324/// # .build(
65325/// #     hyper_rustls::HttpsConnectorBuilder::new()
65326/// #         .with_native_roots()
65327/// #         .unwrap()
65328/// #         .https_or_http()
65329/// #         .enable_http1()
65330/// #         .build()
65331/// # );
65332/// # let mut hub = Dfareporting::new(client, auth);
65333/// // You can configure optional parameters by calling the respective setters at will, and
65334/// // execute the final call using `doit()`.
65335/// // Values shown here are possibly random and not representative !
65336/// let result = hub.projects().list(-19)
65337///              .sort_order("aliquyam")
65338///              .sort_field("dolor")
65339///              .search_string("vero")
65340///              .page_token("ea")
65341///              .max_results(-33)
65342///              .add_ids(-66)
65343///              .add_advertiser_ids(-97)
65344///              .doit().await;
65345/// # }
65346/// ```
65347pub struct ProjectListCall<'a, C>
65348where
65349    C: 'a,
65350{
65351    hub: &'a Dfareporting<C>,
65352    _profile_id: i64,
65353    _sort_order: Option<String>,
65354    _sort_field: Option<String>,
65355    _search_string: Option<String>,
65356    _page_token: Option<String>,
65357    _max_results: Option<i32>,
65358    _ids: Vec<i64>,
65359    _advertiser_ids: Vec<i64>,
65360    _delegate: Option<&'a mut dyn common::Delegate>,
65361    _additional_params: HashMap<String, String>,
65362    _scopes: BTreeSet<String>,
65363}
65364
65365impl<'a, C> common::CallBuilder for ProjectListCall<'a, C> {}
65366
65367impl<'a, C> ProjectListCall<'a, C>
65368where
65369    C: common::Connector,
65370{
65371    /// Perform the operation you have build so far.
65372    pub async fn doit(mut self) -> common::Result<(common::Response, ProjectsListResponse)> {
65373        use std::borrow::Cow;
65374        use std::io::{Read, Seek};
65375
65376        use common::{url::Params, ToParts};
65377        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
65378
65379        let mut dd = common::DefaultDelegate;
65380        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
65381        dlg.begin(common::MethodInfo {
65382            id: "dfareporting.projects.list",
65383            http_method: hyper::Method::GET,
65384        });
65385
65386        for &field in [
65387            "alt",
65388            "profileId",
65389            "sortOrder",
65390            "sortField",
65391            "searchString",
65392            "pageToken",
65393            "maxResults",
65394            "ids",
65395            "advertiserIds",
65396        ]
65397        .iter()
65398        {
65399            if self._additional_params.contains_key(field) {
65400                dlg.finished(false);
65401                return Err(common::Error::FieldClash(field));
65402            }
65403        }
65404
65405        let mut params = Params::with_capacity(10 + self._additional_params.len());
65406        params.push("profileId", self._profile_id.to_string());
65407        if let Some(value) = self._sort_order.as_ref() {
65408            params.push("sortOrder", value);
65409        }
65410        if let Some(value) = self._sort_field.as_ref() {
65411            params.push("sortField", value);
65412        }
65413        if let Some(value) = self._search_string.as_ref() {
65414            params.push("searchString", value);
65415        }
65416        if let Some(value) = self._page_token.as_ref() {
65417            params.push("pageToken", value);
65418        }
65419        if let Some(value) = self._max_results.as_ref() {
65420            params.push("maxResults", value.to_string());
65421        }
65422        if !self._ids.is_empty() {
65423            for f in self._ids.iter() {
65424                params.push("ids", f.to_string());
65425            }
65426        }
65427        if !self._advertiser_ids.is_empty() {
65428            for f in self._advertiser_ids.iter() {
65429                params.push("advertiserIds", f.to_string());
65430            }
65431        }
65432
65433        params.extend(self._additional_params.iter());
65434
65435        params.push("alt", "json");
65436        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/projects";
65437        if self._scopes.is_empty() {
65438            self._scopes
65439                .insert(Scope::Dfatrafficking.as_ref().to_string());
65440        }
65441
65442        #[allow(clippy::single_element_loop)]
65443        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
65444            url = params.uri_replacement(url, param_name, find_this, false);
65445        }
65446        {
65447            let to_remove = ["profileId"];
65448            params.remove_params(&to_remove);
65449        }
65450
65451        let url = params.parse_with_url(&url);
65452
65453        loop {
65454            let token = match self
65455                .hub
65456                .auth
65457                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
65458                .await
65459            {
65460                Ok(token) => token,
65461                Err(e) => match dlg.token(e) {
65462                    Ok(token) => token,
65463                    Err(e) => {
65464                        dlg.finished(false);
65465                        return Err(common::Error::MissingToken(e));
65466                    }
65467                },
65468            };
65469            let mut req_result = {
65470                let client = &self.hub.client;
65471                dlg.pre_request();
65472                let mut req_builder = hyper::Request::builder()
65473                    .method(hyper::Method::GET)
65474                    .uri(url.as_str())
65475                    .header(USER_AGENT, self.hub._user_agent.clone());
65476
65477                if let Some(token) = token.as_ref() {
65478                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
65479                }
65480
65481                let request = req_builder
65482                    .header(CONTENT_LENGTH, 0_u64)
65483                    .body(common::to_body::<String>(None));
65484
65485                client.request(request.unwrap()).await
65486            };
65487
65488            match req_result {
65489                Err(err) => {
65490                    if let common::Retry::After(d) = dlg.http_error(&err) {
65491                        sleep(d).await;
65492                        continue;
65493                    }
65494                    dlg.finished(false);
65495                    return Err(common::Error::HttpError(err));
65496                }
65497                Ok(res) => {
65498                    let (mut parts, body) = res.into_parts();
65499                    let mut body = common::Body::new(body);
65500                    if !parts.status.is_success() {
65501                        let bytes = common::to_bytes(body).await.unwrap_or_default();
65502                        let error = serde_json::from_str(&common::to_string(&bytes));
65503                        let response = common::to_response(parts, bytes.into());
65504
65505                        if let common::Retry::After(d) =
65506                            dlg.http_failure(&response, error.as_ref().ok())
65507                        {
65508                            sleep(d).await;
65509                            continue;
65510                        }
65511
65512                        dlg.finished(false);
65513
65514                        return Err(match error {
65515                            Ok(value) => common::Error::BadRequest(value),
65516                            _ => common::Error::Failure(response),
65517                        });
65518                    }
65519                    let response = {
65520                        let bytes = common::to_bytes(body).await.unwrap_or_default();
65521                        let encoded = common::to_string(&bytes);
65522                        match serde_json::from_str(&encoded) {
65523                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
65524                            Err(error) => {
65525                                dlg.response_json_decode_error(&encoded, &error);
65526                                return Err(common::Error::JsonDecodeError(
65527                                    encoded.to_string(),
65528                                    error,
65529                                ));
65530                            }
65531                        }
65532                    };
65533
65534                    dlg.finished(true);
65535                    return Ok(response);
65536                }
65537            }
65538        }
65539    }
65540
65541    /// User profile ID associated with this request.
65542    ///
65543    /// Sets the *profile id* path property to the given value.
65544    ///
65545    /// Even though the property as already been set when instantiating this call,
65546    /// we provide this method for API completeness.
65547    pub fn profile_id(mut self, new_value: i64) -> ProjectListCall<'a, C> {
65548        self._profile_id = new_value;
65549        self
65550    }
65551    /// Order of sorted results.
65552    ///
65553    /// Sets the *sort order* query property to the given value.
65554    pub fn sort_order(mut self, new_value: &str) -> ProjectListCall<'a, C> {
65555        self._sort_order = Some(new_value.to_string());
65556        self
65557    }
65558    /// Field by which to sort the list.
65559    ///
65560    /// Sets the *sort field* query property to the given value.
65561    pub fn sort_field(mut self, new_value: &str) -> ProjectListCall<'a, C> {
65562        self._sort_field = Some(new_value.to_string());
65563        self
65564    }
65565    /// Allows searching for projects by name or ID. Wildcards (*) are allowed. For example, "project*2015" will return projects with names like "project June 2015", "project April 2015", or simply "project 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "project" will match projects with name "my project", "project 2015", or simply "project".
65566    ///
65567    /// Sets the *search string* query property to the given value.
65568    pub fn search_string(mut self, new_value: &str) -> ProjectListCall<'a, C> {
65569        self._search_string = Some(new_value.to_string());
65570        self
65571    }
65572    /// Value of the nextPageToken from the previous result page.
65573    ///
65574    /// Sets the *page token* query property to the given value.
65575    pub fn page_token(mut self, new_value: &str) -> ProjectListCall<'a, C> {
65576        self._page_token = Some(new_value.to_string());
65577        self
65578    }
65579    /// Maximum number of results to return.
65580    ///
65581    /// Sets the *max results* query property to the given value.
65582    pub fn max_results(mut self, new_value: i32) -> ProjectListCall<'a, C> {
65583        self._max_results = Some(new_value);
65584        self
65585    }
65586    /// Select only projects with these IDs.
65587    ///
65588    /// Append the given value to the *ids* query property.
65589    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
65590    pub fn add_ids(mut self, new_value: i64) -> ProjectListCall<'a, C> {
65591        self._ids.push(new_value);
65592        self
65593    }
65594    /// Select only projects with these advertiser IDs.
65595    ///
65596    /// Append the given value to the *advertiser ids* query property.
65597    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
65598    pub fn add_advertiser_ids(mut self, new_value: i64) -> ProjectListCall<'a, C> {
65599        self._advertiser_ids.push(new_value);
65600        self
65601    }
65602    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
65603    /// while executing the actual API request.
65604    ///
65605    /// ````text
65606    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
65607    /// ````
65608    ///
65609    /// Sets the *delegate* property to the given value.
65610    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ProjectListCall<'a, C> {
65611        self._delegate = Some(new_value);
65612        self
65613    }
65614
65615    /// Set any additional parameter of the query string used in the request.
65616    /// It should be used to set parameters which are not yet available through their own
65617    /// setters.
65618    ///
65619    /// Please note that this method must not be used to set any of the known parameters
65620    /// which have their own setter method. If done anyway, the request will fail.
65621    ///
65622    /// # Additional Parameters
65623    ///
65624    /// * *$.xgafv* (query-string) - V1 error format.
65625    /// * *access_token* (query-string) - OAuth access token.
65626    /// * *alt* (query-string) - Data format for response.
65627    /// * *callback* (query-string) - JSONP
65628    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
65629    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
65630    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
65631    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
65632    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
65633    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
65634    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
65635    pub fn param<T>(mut self, name: T, value: T) -> ProjectListCall<'a, C>
65636    where
65637        T: AsRef<str>,
65638    {
65639        self._additional_params
65640            .insert(name.as_ref().to_string(), value.as_ref().to_string());
65641        self
65642    }
65643
65644    /// Identifies the authorization scope for the method you are building.
65645    ///
65646    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
65647    /// [`Scope::Dfatrafficking`].
65648    ///
65649    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
65650    /// tokens for more than one scope.
65651    ///
65652    /// Usually there is more than one suitable scope to authorize an operation, some of which may
65653    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
65654    /// sufficient, a read-write scope will do as well.
65655    pub fn add_scope<St>(mut self, scope: St) -> ProjectListCall<'a, C>
65656    where
65657        St: AsRef<str>,
65658    {
65659        self._scopes.insert(String::from(scope.as_ref()));
65660        self
65661    }
65662    /// Identifies the authorization scope(s) for the method you are building.
65663    ///
65664    /// See [`Self::add_scope()`] for details.
65665    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectListCall<'a, C>
65666    where
65667        I: IntoIterator<Item = St>,
65668        St: AsRef<str>,
65669    {
65670        self._scopes
65671            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
65672        self
65673    }
65674
65675    /// Removes all scopes, and no default scope will be used either.
65676    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
65677    /// for details).
65678    pub fn clear_scopes(mut self) -> ProjectListCall<'a, C> {
65679        self._scopes.clear();
65680        self
65681    }
65682}
65683
65684/// Retrieves a list of regions.
65685///
65686/// A builder for the *list* method supported by a *region* resource.
65687/// It is not used directly, but through a [`RegionMethods`] instance.
65688///
65689/// # Example
65690///
65691/// Instantiate a resource method builder
65692///
65693/// ```test_harness,no_run
65694/// # extern crate hyper;
65695/// # extern crate hyper_rustls;
65696/// # extern crate google_dfareporting3d3 as dfareporting3d3;
65697/// # async fn dox() {
65698/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
65699///
65700/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
65701/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
65702/// #     secret,
65703/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
65704/// # ).build().await.unwrap();
65705///
65706/// # let client = hyper_util::client::legacy::Client::builder(
65707/// #     hyper_util::rt::TokioExecutor::new()
65708/// # )
65709/// # .build(
65710/// #     hyper_rustls::HttpsConnectorBuilder::new()
65711/// #         .with_native_roots()
65712/// #         .unwrap()
65713/// #         .https_or_http()
65714/// #         .enable_http1()
65715/// #         .build()
65716/// # );
65717/// # let mut hub = Dfareporting::new(client, auth);
65718/// // You can configure optional parameters by calling the respective setters at will, and
65719/// // execute the final call using `doit()`.
65720/// // Values shown here are possibly random and not representative !
65721/// let result = hub.regions().list(-60)
65722///              .doit().await;
65723/// # }
65724/// ```
65725pub struct RegionListCall<'a, C>
65726where
65727    C: 'a,
65728{
65729    hub: &'a Dfareporting<C>,
65730    _profile_id: i64,
65731    _delegate: Option<&'a mut dyn common::Delegate>,
65732    _additional_params: HashMap<String, String>,
65733    _scopes: BTreeSet<String>,
65734}
65735
65736impl<'a, C> common::CallBuilder for RegionListCall<'a, C> {}
65737
65738impl<'a, C> RegionListCall<'a, C>
65739where
65740    C: common::Connector,
65741{
65742    /// Perform the operation you have build so far.
65743    pub async fn doit(mut self) -> common::Result<(common::Response, RegionsListResponse)> {
65744        use std::borrow::Cow;
65745        use std::io::{Read, Seek};
65746
65747        use common::{url::Params, ToParts};
65748        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
65749
65750        let mut dd = common::DefaultDelegate;
65751        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
65752        dlg.begin(common::MethodInfo {
65753            id: "dfareporting.regions.list",
65754            http_method: hyper::Method::GET,
65755        });
65756
65757        for &field in ["alt", "profileId"].iter() {
65758            if self._additional_params.contains_key(field) {
65759                dlg.finished(false);
65760                return Err(common::Error::FieldClash(field));
65761            }
65762        }
65763
65764        let mut params = Params::with_capacity(3 + self._additional_params.len());
65765        params.push("profileId", self._profile_id.to_string());
65766
65767        params.extend(self._additional_params.iter());
65768
65769        params.push("alt", "json");
65770        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/regions";
65771        if self._scopes.is_empty() {
65772            self._scopes
65773                .insert(Scope::Dfatrafficking.as_ref().to_string());
65774        }
65775
65776        #[allow(clippy::single_element_loop)]
65777        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
65778            url = params.uri_replacement(url, param_name, find_this, false);
65779        }
65780        {
65781            let to_remove = ["profileId"];
65782            params.remove_params(&to_remove);
65783        }
65784
65785        let url = params.parse_with_url(&url);
65786
65787        loop {
65788            let token = match self
65789                .hub
65790                .auth
65791                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
65792                .await
65793            {
65794                Ok(token) => token,
65795                Err(e) => match dlg.token(e) {
65796                    Ok(token) => token,
65797                    Err(e) => {
65798                        dlg.finished(false);
65799                        return Err(common::Error::MissingToken(e));
65800                    }
65801                },
65802            };
65803            let mut req_result = {
65804                let client = &self.hub.client;
65805                dlg.pre_request();
65806                let mut req_builder = hyper::Request::builder()
65807                    .method(hyper::Method::GET)
65808                    .uri(url.as_str())
65809                    .header(USER_AGENT, self.hub._user_agent.clone());
65810
65811                if let Some(token) = token.as_ref() {
65812                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
65813                }
65814
65815                let request = req_builder
65816                    .header(CONTENT_LENGTH, 0_u64)
65817                    .body(common::to_body::<String>(None));
65818
65819                client.request(request.unwrap()).await
65820            };
65821
65822            match req_result {
65823                Err(err) => {
65824                    if let common::Retry::After(d) = dlg.http_error(&err) {
65825                        sleep(d).await;
65826                        continue;
65827                    }
65828                    dlg.finished(false);
65829                    return Err(common::Error::HttpError(err));
65830                }
65831                Ok(res) => {
65832                    let (mut parts, body) = res.into_parts();
65833                    let mut body = common::Body::new(body);
65834                    if !parts.status.is_success() {
65835                        let bytes = common::to_bytes(body).await.unwrap_or_default();
65836                        let error = serde_json::from_str(&common::to_string(&bytes));
65837                        let response = common::to_response(parts, bytes.into());
65838
65839                        if let common::Retry::After(d) =
65840                            dlg.http_failure(&response, error.as_ref().ok())
65841                        {
65842                            sleep(d).await;
65843                            continue;
65844                        }
65845
65846                        dlg.finished(false);
65847
65848                        return Err(match error {
65849                            Ok(value) => common::Error::BadRequest(value),
65850                            _ => common::Error::Failure(response),
65851                        });
65852                    }
65853                    let response = {
65854                        let bytes = common::to_bytes(body).await.unwrap_or_default();
65855                        let encoded = common::to_string(&bytes);
65856                        match serde_json::from_str(&encoded) {
65857                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
65858                            Err(error) => {
65859                                dlg.response_json_decode_error(&encoded, &error);
65860                                return Err(common::Error::JsonDecodeError(
65861                                    encoded.to_string(),
65862                                    error,
65863                                ));
65864                            }
65865                        }
65866                    };
65867
65868                    dlg.finished(true);
65869                    return Ok(response);
65870                }
65871            }
65872        }
65873    }
65874
65875    /// User profile ID associated with this request.
65876    ///
65877    /// Sets the *profile id* path property to the given value.
65878    ///
65879    /// Even though the property as already been set when instantiating this call,
65880    /// we provide this method for API completeness.
65881    pub fn profile_id(mut self, new_value: i64) -> RegionListCall<'a, C> {
65882        self._profile_id = new_value;
65883        self
65884    }
65885    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
65886    /// while executing the actual API request.
65887    ///
65888    /// ````text
65889    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
65890    /// ````
65891    ///
65892    /// Sets the *delegate* property to the given value.
65893    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> RegionListCall<'a, C> {
65894        self._delegate = Some(new_value);
65895        self
65896    }
65897
65898    /// Set any additional parameter of the query string used in the request.
65899    /// It should be used to set parameters which are not yet available through their own
65900    /// setters.
65901    ///
65902    /// Please note that this method must not be used to set any of the known parameters
65903    /// which have their own setter method. If done anyway, the request will fail.
65904    ///
65905    /// # Additional Parameters
65906    ///
65907    /// * *$.xgafv* (query-string) - V1 error format.
65908    /// * *access_token* (query-string) - OAuth access token.
65909    /// * *alt* (query-string) - Data format for response.
65910    /// * *callback* (query-string) - JSONP
65911    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
65912    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
65913    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
65914    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
65915    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
65916    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
65917    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
65918    pub fn param<T>(mut self, name: T, value: T) -> RegionListCall<'a, C>
65919    where
65920        T: AsRef<str>,
65921    {
65922        self._additional_params
65923            .insert(name.as_ref().to_string(), value.as_ref().to_string());
65924        self
65925    }
65926
65927    /// Identifies the authorization scope for the method you are building.
65928    ///
65929    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
65930    /// [`Scope::Dfatrafficking`].
65931    ///
65932    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
65933    /// tokens for more than one scope.
65934    ///
65935    /// Usually there is more than one suitable scope to authorize an operation, some of which may
65936    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
65937    /// sufficient, a read-write scope will do as well.
65938    pub fn add_scope<St>(mut self, scope: St) -> RegionListCall<'a, C>
65939    where
65940        St: AsRef<str>,
65941    {
65942        self._scopes.insert(String::from(scope.as_ref()));
65943        self
65944    }
65945    /// Identifies the authorization scope(s) for the method you are building.
65946    ///
65947    /// See [`Self::add_scope()`] for details.
65948    pub fn add_scopes<I, St>(mut self, scopes: I) -> RegionListCall<'a, C>
65949    where
65950        I: IntoIterator<Item = St>,
65951        St: AsRef<str>,
65952    {
65953        self._scopes
65954            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
65955        self
65956    }
65957
65958    /// Removes all scopes, and no default scope will be used either.
65959    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
65960    /// for details).
65961    pub fn clear_scopes(mut self) -> RegionListCall<'a, C> {
65962        self._scopes.clear();
65963        self
65964    }
65965}
65966
65967/// Gets one remarketing list share by remarketing list ID.
65968///
65969/// A builder for the *get* method supported by a *remarketingListShare* resource.
65970/// It is not used directly, but through a [`RemarketingListShareMethods`] instance.
65971///
65972/// # Example
65973///
65974/// Instantiate a resource method builder
65975///
65976/// ```test_harness,no_run
65977/// # extern crate hyper;
65978/// # extern crate hyper_rustls;
65979/// # extern crate google_dfareporting3d3 as dfareporting3d3;
65980/// # async fn dox() {
65981/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
65982///
65983/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
65984/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
65985/// #     secret,
65986/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
65987/// # ).build().await.unwrap();
65988///
65989/// # let client = hyper_util::client::legacy::Client::builder(
65990/// #     hyper_util::rt::TokioExecutor::new()
65991/// # )
65992/// # .build(
65993/// #     hyper_rustls::HttpsConnectorBuilder::new()
65994/// #         .with_native_roots()
65995/// #         .unwrap()
65996/// #         .https_or_http()
65997/// #         .enable_http1()
65998/// #         .build()
65999/// # );
66000/// # let mut hub = Dfareporting::new(client, auth);
66001/// // You can configure optional parameters by calling the respective setters at will, and
66002/// // execute the final call using `doit()`.
66003/// // Values shown here are possibly random and not representative !
66004/// let result = hub.remarketing_list_shares().get(-95, -84)
66005///              .doit().await;
66006/// # }
66007/// ```
66008pub struct RemarketingListShareGetCall<'a, C>
66009where
66010    C: 'a,
66011{
66012    hub: &'a Dfareporting<C>,
66013    _profile_id: i64,
66014    _remarketing_list_id: i64,
66015    _delegate: Option<&'a mut dyn common::Delegate>,
66016    _additional_params: HashMap<String, String>,
66017    _scopes: BTreeSet<String>,
66018}
66019
66020impl<'a, C> common::CallBuilder for RemarketingListShareGetCall<'a, C> {}
66021
66022impl<'a, C> RemarketingListShareGetCall<'a, C>
66023where
66024    C: common::Connector,
66025{
66026    /// Perform the operation you have build so far.
66027    pub async fn doit(mut self) -> common::Result<(common::Response, RemarketingListShare)> {
66028        use std::borrow::Cow;
66029        use std::io::{Read, Seek};
66030
66031        use common::{url::Params, ToParts};
66032        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
66033
66034        let mut dd = common::DefaultDelegate;
66035        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
66036        dlg.begin(common::MethodInfo {
66037            id: "dfareporting.remarketingListShares.get",
66038            http_method: hyper::Method::GET,
66039        });
66040
66041        for &field in ["alt", "profileId", "remarketingListId"].iter() {
66042            if self._additional_params.contains_key(field) {
66043                dlg.finished(false);
66044                return Err(common::Error::FieldClash(field));
66045            }
66046        }
66047
66048        let mut params = Params::with_capacity(4 + self._additional_params.len());
66049        params.push("profileId", self._profile_id.to_string());
66050        params.push("remarketingListId", self._remarketing_list_id.to_string());
66051
66052        params.extend(self._additional_params.iter());
66053
66054        params.push("alt", "json");
66055        let mut url = self.hub._base_url.clone()
66056            + "userprofiles/{profileId}/remarketingListShares/{remarketingListId}";
66057        if self._scopes.is_empty() {
66058            self._scopes
66059                .insert(Scope::Dfatrafficking.as_ref().to_string());
66060        }
66061
66062        #[allow(clippy::single_element_loop)]
66063        for &(find_this, param_name) in [
66064            ("{profileId}", "profileId"),
66065            ("{remarketingListId}", "remarketingListId"),
66066        ]
66067        .iter()
66068        {
66069            url = params.uri_replacement(url, param_name, find_this, false);
66070        }
66071        {
66072            let to_remove = ["remarketingListId", "profileId"];
66073            params.remove_params(&to_remove);
66074        }
66075
66076        let url = params.parse_with_url(&url);
66077
66078        loop {
66079            let token = match self
66080                .hub
66081                .auth
66082                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
66083                .await
66084            {
66085                Ok(token) => token,
66086                Err(e) => match dlg.token(e) {
66087                    Ok(token) => token,
66088                    Err(e) => {
66089                        dlg.finished(false);
66090                        return Err(common::Error::MissingToken(e));
66091                    }
66092                },
66093            };
66094            let mut req_result = {
66095                let client = &self.hub.client;
66096                dlg.pre_request();
66097                let mut req_builder = hyper::Request::builder()
66098                    .method(hyper::Method::GET)
66099                    .uri(url.as_str())
66100                    .header(USER_AGENT, self.hub._user_agent.clone());
66101
66102                if let Some(token) = token.as_ref() {
66103                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
66104                }
66105
66106                let request = req_builder
66107                    .header(CONTENT_LENGTH, 0_u64)
66108                    .body(common::to_body::<String>(None));
66109
66110                client.request(request.unwrap()).await
66111            };
66112
66113            match req_result {
66114                Err(err) => {
66115                    if let common::Retry::After(d) = dlg.http_error(&err) {
66116                        sleep(d).await;
66117                        continue;
66118                    }
66119                    dlg.finished(false);
66120                    return Err(common::Error::HttpError(err));
66121                }
66122                Ok(res) => {
66123                    let (mut parts, body) = res.into_parts();
66124                    let mut body = common::Body::new(body);
66125                    if !parts.status.is_success() {
66126                        let bytes = common::to_bytes(body).await.unwrap_or_default();
66127                        let error = serde_json::from_str(&common::to_string(&bytes));
66128                        let response = common::to_response(parts, bytes.into());
66129
66130                        if let common::Retry::After(d) =
66131                            dlg.http_failure(&response, error.as_ref().ok())
66132                        {
66133                            sleep(d).await;
66134                            continue;
66135                        }
66136
66137                        dlg.finished(false);
66138
66139                        return Err(match error {
66140                            Ok(value) => common::Error::BadRequest(value),
66141                            _ => common::Error::Failure(response),
66142                        });
66143                    }
66144                    let response = {
66145                        let bytes = common::to_bytes(body).await.unwrap_or_default();
66146                        let encoded = common::to_string(&bytes);
66147                        match serde_json::from_str(&encoded) {
66148                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
66149                            Err(error) => {
66150                                dlg.response_json_decode_error(&encoded, &error);
66151                                return Err(common::Error::JsonDecodeError(
66152                                    encoded.to_string(),
66153                                    error,
66154                                ));
66155                            }
66156                        }
66157                    };
66158
66159                    dlg.finished(true);
66160                    return Ok(response);
66161                }
66162            }
66163        }
66164    }
66165
66166    /// User profile ID associated with this request.
66167    ///
66168    /// Sets the *profile id* path property to the given value.
66169    ///
66170    /// Even though the property as already been set when instantiating this call,
66171    /// we provide this method for API completeness.
66172    pub fn profile_id(mut self, new_value: i64) -> RemarketingListShareGetCall<'a, C> {
66173        self._profile_id = new_value;
66174        self
66175    }
66176    /// Remarketing list ID.
66177    ///
66178    /// Sets the *remarketing list id* path property to the given value.
66179    ///
66180    /// Even though the property as already been set when instantiating this call,
66181    /// we provide this method for API completeness.
66182    pub fn remarketing_list_id(mut self, new_value: i64) -> RemarketingListShareGetCall<'a, C> {
66183        self._remarketing_list_id = new_value;
66184        self
66185    }
66186    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
66187    /// while executing the actual API request.
66188    ///
66189    /// ````text
66190    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
66191    /// ````
66192    ///
66193    /// Sets the *delegate* property to the given value.
66194    pub fn delegate(
66195        mut self,
66196        new_value: &'a mut dyn common::Delegate,
66197    ) -> RemarketingListShareGetCall<'a, C> {
66198        self._delegate = Some(new_value);
66199        self
66200    }
66201
66202    /// Set any additional parameter of the query string used in the request.
66203    /// It should be used to set parameters which are not yet available through their own
66204    /// setters.
66205    ///
66206    /// Please note that this method must not be used to set any of the known parameters
66207    /// which have their own setter method. If done anyway, the request will fail.
66208    ///
66209    /// # Additional Parameters
66210    ///
66211    /// * *$.xgafv* (query-string) - V1 error format.
66212    /// * *access_token* (query-string) - OAuth access token.
66213    /// * *alt* (query-string) - Data format for response.
66214    /// * *callback* (query-string) - JSONP
66215    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
66216    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
66217    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
66218    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
66219    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
66220    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
66221    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
66222    pub fn param<T>(mut self, name: T, value: T) -> RemarketingListShareGetCall<'a, C>
66223    where
66224        T: AsRef<str>,
66225    {
66226        self._additional_params
66227            .insert(name.as_ref().to_string(), value.as_ref().to_string());
66228        self
66229    }
66230
66231    /// Identifies the authorization scope for the method you are building.
66232    ///
66233    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
66234    /// [`Scope::Dfatrafficking`].
66235    ///
66236    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
66237    /// tokens for more than one scope.
66238    ///
66239    /// Usually there is more than one suitable scope to authorize an operation, some of which may
66240    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
66241    /// sufficient, a read-write scope will do as well.
66242    pub fn add_scope<St>(mut self, scope: St) -> RemarketingListShareGetCall<'a, C>
66243    where
66244        St: AsRef<str>,
66245    {
66246        self._scopes.insert(String::from(scope.as_ref()));
66247        self
66248    }
66249    /// Identifies the authorization scope(s) for the method you are building.
66250    ///
66251    /// See [`Self::add_scope()`] for details.
66252    pub fn add_scopes<I, St>(mut self, scopes: I) -> RemarketingListShareGetCall<'a, C>
66253    where
66254        I: IntoIterator<Item = St>,
66255        St: AsRef<str>,
66256    {
66257        self._scopes
66258            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
66259        self
66260    }
66261
66262    /// Removes all scopes, and no default scope will be used either.
66263    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
66264    /// for details).
66265    pub fn clear_scopes(mut self) -> RemarketingListShareGetCall<'a, C> {
66266        self._scopes.clear();
66267        self
66268    }
66269}
66270
66271/// Updates an existing remarketing list share. This method supports patch semantics.
66272///
66273/// A builder for the *patch* method supported by a *remarketingListShare* resource.
66274/// It is not used directly, but through a [`RemarketingListShareMethods`] instance.
66275///
66276/// # Example
66277///
66278/// Instantiate a resource method builder
66279///
66280/// ```test_harness,no_run
66281/// # extern crate hyper;
66282/// # extern crate hyper_rustls;
66283/// # extern crate google_dfareporting3d3 as dfareporting3d3;
66284/// use dfareporting3d3::api::RemarketingListShare;
66285/// # async fn dox() {
66286/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
66287///
66288/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
66289/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
66290/// #     secret,
66291/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
66292/// # ).build().await.unwrap();
66293///
66294/// # let client = hyper_util::client::legacy::Client::builder(
66295/// #     hyper_util::rt::TokioExecutor::new()
66296/// # )
66297/// # .build(
66298/// #     hyper_rustls::HttpsConnectorBuilder::new()
66299/// #         .with_native_roots()
66300/// #         .unwrap()
66301/// #         .https_or_http()
66302/// #         .enable_http1()
66303/// #         .build()
66304/// # );
66305/// # let mut hub = Dfareporting::new(client, auth);
66306/// // As the method needs a request, you would usually fill it with the desired information
66307/// // into the respective structure. Some of the parts shown here might not be applicable !
66308/// // Values shown here are possibly random and not representative !
66309/// let mut req = RemarketingListShare::default();
66310///
66311/// // You can configure optional parameters by calling the respective setters at will, and
66312/// // execute the final call using `doit()`.
66313/// // Values shown here are possibly random and not representative !
66314/// let result = hub.remarketing_list_shares().patch(req, -47, -38)
66315///              .doit().await;
66316/// # }
66317/// ```
66318pub struct RemarketingListSharePatchCall<'a, C>
66319where
66320    C: 'a,
66321{
66322    hub: &'a Dfareporting<C>,
66323    _request: RemarketingListShare,
66324    _profile_id: i64,
66325    _id: i64,
66326    _delegate: Option<&'a mut dyn common::Delegate>,
66327    _additional_params: HashMap<String, String>,
66328    _scopes: BTreeSet<String>,
66329}
66330
66331impl<'a, C> common::CallBuilder for RemarketingListSharePatchCall<'a, C> {}
66332
66333impl<'a, C> RemarketingListSharePatchCall<'a, C>
66334where
66335    C: common::Connector,
66336{
66337    /// Perform the operation you have build so far.
66338    pub async fn doit(mut self) -> common::Result<(common::Response, RemarketingListShare)> {
66339        use std::borrow::Cow;
66340        use std::io::{Read, Seek};
66341
66342        use common::{url::Params, ToParts};
66343        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
66344
66345        let mut dd = common::DefaultDelegate;
66346        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
66347        dlg.begin(common::MethodInfo {
66348            id: "dfareporting.remarketingListShares.patch",
66349            http_method: hyper::Method::PATCH,
66350        });
66351
66352        for &field in ["alt", "profileId", "id"].iter() {
66353            if self._additional_params.contains_key(field) {
66354                dlg.finished(false);
66355                return Err(common::Error::FieldClash(field));
66356            }
66357        }
66358
66359        let mut params = Params::with_capacity(5 + self._additional_params.len());
66360        params.push("profileId", self._profile_id.to_string());
66361        params.push("id", self._id.to_string());
66362
66363        params.extend(self._additional_params.iter());
66364
66365        params.push("alt", "json");
66366        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/remarketingListShares";
66367        if self._scopes.is_empty() {
66368            self._scopes
66369                .insert(Scope::Dfatrafficking.as_ref().to_string());
66370        }
66371
66372        #[allow(clippy::single_element_loop)]
66373        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
66374            url = params.uri_replacement(url, param_name, find_this, false);
66375        }
66376        {
66377            let to_remove = ["profileId"];
66378            params.remove_params(&to_remove);
66379        }
66380
66381        let url = params.parse_with_url(&url);
66382
66383        let mut json_mime_type = mime::APPLICATION_JSON;
66384        let mut request_value_reader = {
66385            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
66386            common::remove_json_null_values(&mut value);
66387            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
66388            serde_json::to_writer(&mut dst, &value).unwrap();
66389            dst
66390        };
66391        let request_size = request_value_reader
66392            .seek(std::io::SeekFrom::End(0))
66393            .unwrap();
66394        request_value_reader
66395            .seek(std::io::SeekFrom::Start(0))
66396            .unwrap();
66397
66398        loop {
66399            let token = match self
66400                .hub
66401                .auth
66402                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
66403                .await
66404            {
66405                Ok(token) => token,
66406                Err(e) => match dlg.token(e) {
66407                    Ok(token) => token,
66408                    Err(e) => {
66409                        dlg.finished(false);
66410                        return Err(common::Error::MissingToken(e));
66411                    }
66412                },
66413            };
66414            request_value_reader
66415                .seek(std::io::SeekFrom::Start(0))
66416                .unwrap();
66417            let mut req_result = {
66418                let client = &self.hub.client;
66419                dlg.pre_request();
66420                let mut req_builder = hyper::Request::builder()
66421                    .method(hyper::Method::PATCH)
66422                    .uri(url.as_str())
66423                    .header(USER_AGENT, self.hub._user_agent.clone());
66424
66425                if let Some(token) = token.as_ref() {
66426                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
66427                }
66428
66429                let request = req_builder
66430                    .header(CONTENT_TYPE, json_mime_type.to_string())
66431                    .header(CONTENT_LENGTH, request_size as u64)
66432                    .body(common::to_body(
66433                        request_value_reader.get_ref().clone().into(),
66434                    ));
66435
66436                client.request(request.unwrap()).await
66437            };
66438
66439            match req_result {
66440                Err(err) => {
66441                    if let common::Retry::After(d) = dlg.http_error(&err) {
66442                        sleep(d).await;
66443                        continue;
66444                    }
66445                    dlg.finished(false);
66446                    return Err(common::Error::HttpError(err));
66447                }
66448                Ok(res) => {
66449                    let (mut parts, body) = res.into_parts();
66450                    let mut body = common::Body::new(body);
66451                    if !parts.status.is_success() {
66452                        let bytes = common::to_bytes(body).await.unwrap_or_default();
66453                        let error = serde_json::from_str(&common::to_string(&bytes));
66454                        let response = common::to_response(parts, bytes.into());
66455
66456                        if let common::Retry::After(d) =
66457                            dlg.http_failure(&response, error.as_ref().ok())
66458                        {
66459                            sleep(d).await;
66460                            continue;
66461                        }
66462
66463                        dlg.finished(false);
66464
66465                        return Err(match error {
66466                            Ok(value) => common::Error::BadRequest(value),
66467                            _ => common::Error::Failure(response),
66468                        });
66469                    }
66470                    let response = {
66471                        let bytes = common::to_bytes(body).await.unwrap_or_default();
66472                        let encoded = common::to_string(&bytes);
66473                        match serde_json::from_str(&encoded) {
66474                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
66475                            Err(error) => {
66476                                dlg.response_json_decode_error(&encoded, &error);
66477                                return Err(common::Error::JsonDecodeError(
66478                                    encoded.to_string(),
66479                                    error,
66480                                ));
66481                            }
66482                        }
66483                    };
66484
66485                    dlg.finished(true);
66486                    return Ok(response);
66487                }
66488            }
66489        }
66490    }
66491
66492    ///
66493    /// Sets the *request* property to the given value.
66494    ///
66495    /// Even though the property as already been set when instantiating this call,
66496    /// we provide this method for API completeness.
66497    pub fn request(
66498        mut self,
66499        new_value: RemarketingListShare,
66500    ) -> RemarketingListSharePatchCall<'a, C> {
66501        self._request = new_value;
66502        self
66503    }
66504    /// User profile ID associated with this request.
66505    ///
66506    /// Sets the *profile id* path property to the given value.
66507    ///
66508    /// Even though the property as already been set when instantiating this call,
66509    /// we provide this method for API completeness.
66510    pub fn profile_id(mut self, new_value: i64) -> RemarketingListSharePatchCall<'a, C> {
66511        self._profile_id = new_value;
66512        self
66513    }
66514    /// RemarketingList ID.
66515    ///
66516    /// Sets the *id* query property to the given value.
66517    ///
66518    /// Even though the property as already been set when instantiating this call,
66519    /// we provide this method for API completeness.
66520    pub fn id(mut self, new_value: i64) -> RemarketingListSharePatchCall<'a, C> {
66521        self._id = new_value;
66522        self
66523    }
66524    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
66525    /// while executing the actual API request.
66526    ///
66527    /// ````text
66528    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
66529    /// ````
66530    ///
66531    /// Sets the *delegate* property to the given value.
66532    pub fn delegate(
66533        mut self,
66534        new_value: &'a mut dyn common::Delegate,
66535    ) -> RemarketingListSharePatchCall<'a, C> {
66536        self._delegate = Some(new_value);
66537        self
66538    }
66539
66540    /// Set any additional parameter of the query string used in the request.
66541    /// It should be used to set parameters which are not yet available through their own
66542    /// setters.
66543    ///
66544    /// Please note that this method must not be used to set any of the known parameters
66545    /// which have their own setter method. If done anyway, the request will fail.
66546    ///
66547    /// # Additional Parameters
66548    ///
66549    /// * *$.xgafv* (query-string) - V1 error format.
66550    /// * *access_token* (query-string) - OAuth access token.
66551    /// * *alt* (query-string) - Data format for response.
66552    /// * *callback* (query-string) - JSONP
66553    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
66554    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
66555    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
66556    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
66557    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
66558    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
66559    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
66560    pub fn param<T>(mut self, name: T, value: T) -> RemarketingListSharePatchCall<'a, C>
66561    where
66562        T: AsRef<str>,
66563    {
66564        self._additional_params
66565            .insert(name.as_ref().to_string(), value.as_ref().to_string());
66566        self
66567    }
66568
66569    /// Identifies the authorization scope for the method you are building.
66570    ///
66571    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
66572    /// [`Scope::Dfatrafficking`].
66573    ///
66574    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
66575    /// tokens for more than one scope.
66576    ///
66577    /// Usually there is more than one suitable scope to authorize an operation, some of which may
66578    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
66579    /// sufficient, a read-write scope will do as well.
66580    pub fn add_scope<St>(mut self, scope: St) -> RemarketingListSharePatchCall<'a, C>
66581    where
66582        St: AsRef<str>,
66583    {
66584        self._scopes.insert(String::from(scope.as_ref()));
66585        self
66586    }
66587    /// Identifies the authorization scope(s) for the method you are building.
66588    ///
66589    /// See [`Self::add_scope()`] for details.
66590    pub fn add_scopes<I, St>(mut self, scopes: I) -> RemarketingListSharePatchCall<'a, C>
66591    where
66592        I: IntoIterator<Item = St>,
66593        St: AsRef<str>,
66594    {
66595        self._scopes
66596            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
66597        self
66598    }
66599
66600    /// Removes all scopes, and no default scope will be used either.
66601    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
66602    /// for details).
66603    pub fn clear_scopes(mut self) -> RemarketingListSharePatchCall<'a, C> {
66604        self._scopes.clear();
66605        self
66606    }
66607}
66608
66609/// Updates an existing remarketing list share.
66610///
66611/// A builder for the *update* method supported by a *remarketingListShare* resource.
66612/// It is not used directly, but through a [`RemarketingListShareMethods`] instance.
66613///
66614/// # Example
66615///
66616/// Instantiate a resource method builder
66617///
66618/// ```test_harness,no_run
66619/// # extern crate hyper;
66620/// # extern crate hyper_rustls;
66621/// # extern crate google_dfareporting3d3 as dfareporting3d3;
66622/// use dfareporting3d3::api::RemarketingListShare;
66623/// # async fn dox() {
66624/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
66625///
66626/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
66627/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
66628/// #     secret,
66629/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
66630/// # ).build().await.unwrap();
66631///
66632/// # let client = hyper_util::client::legacy::Client::builder(
66633/// #     hyper_util::rt::TokioExecutor::new()
66634/// # )
66635/// # .build(
66636/// #     hyper_rustls::HttpsConnectorBuilder::new()
66637/// #         .with_native_roots()
66638/// #         .unwrap()
66639/// #         .https_or_http()
66640/// #         .enable_http1()
66641/// #         .build()
66642/// # );
66643/// # let mut hub = Dfareporting::new(client, auth);
66644/// // As the method needs a request, you would usually fill it with the desired information
66645/// // into the respective structure. Some of the parts shown here might not be applicable !
66646/// // Values shown here are possibly random and not representative !
66647/// let mut req = RemarketingListShare::default();
66648///
66649/// // You can configure optional parameters by calling the respective setters at will, and
66650/// // execute the final call using `doit()`.
66651/// // Values shown here are possibly random and not representative !
66652/// let result = hub.remarketing_list_shares().update(req, -38)
66653///              .doit().await;
66654/// # }
66655/// ```
66656pub struct RemarketingListShareUpdateCall<'a, C>
66657where
66658    C: 'a,
66659{
66660    hub: &'a Dfareporting<C>,
66661    _request: RemarketingListShare,
66662    _profile_id: i64,
66663    _delegate: Option<&'a mut dyn common::Delegate>,
66664    _additional_params: HashMap<String, String>,
66665    _scopes: BTreeSet<String>,
66666}
66667
66668impl<'a, C> common::CallBuilder for RemarketingListShareUpdateCall<'a, C> {}
66669
66670impl<'a, C> RemarketingListShareUpdateCall<'a, C>
66671where
66672    C: common::Connector,
66673{
66674    /// Perform the operation you have build so far.
66675    pub async fn doit(mut self) -> common::Result<(common::Response, RemarketingListShare)> {
66676        use std::borrow::Cow;
66677        use std::io::{Read, Seek};
66678
66679        use common::{url::Params, ToParts};
66680        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
66681
66682        let mut dd = common::DefaultDelegate;
66683        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
66684        dlg.begin(common::MethodInfo {
66685            id: "dfareporting.remarketingListShares.update",
66686            http_method: hyper::Method::PUT,
66687        });
66688
66689        for &field in ["alt", "profileId"].iter() {
66690            if self._additional_params.contains_key(field) {
66691                dlg.finished(false);
66692                return Err(common::Error::FieldClash(field));
66693            }
66694        }
66695
66696        let mut params = Params::with_capacity(4 + self._additional_params.len());
66697        params.push("profileId", self._profile_id.to_string());
66698
66699        params.extend(self._additional_params.iter());
66700
66701        params.push("alt", "json");
66702        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/remarketingListShares";
66703        if self._scopes.is_empty() {
66704            self._scopes
66705                .insert(Scope::Dfatrafficking.as_ref().to_string());
66706        }
66707
66708        #[allow(clippy::single_element_loop)]
66709        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
66710            url = params.uri_replacement(url, param_name, find_this, false);
66711        }
66712        {
66713            let to_remove = ["profileId"];
66714            params.remove_params(&to_remove);
66715        }
66716
66717        let url = params.parse_with_url(&url);
66718
66719        let mut json_mime_type = mime::APPLICATION_JSON;
66720        let mut request_value_reader = {
66721            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
66722            common::remove_json_null_values(&mut value);
66723            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
66724            serde_json::to_writer(&mut dst, &value).unwrap();
66725            dst
66726        };
66727        let request_size = request_value_reader
66728            .seek(std::io::SeekFrom::End(0))
66729            .unwrap();
66730        request_value_reader
66731            .seek(std::io::SeekFrom::Start(0))
66732            .unwrap();
66733
66734        loop {
66735            let token = match self
66736                .hub
66737                .auth
66738                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
66739                .await
66740            {
66741                Ok(token) => token,
66742                Err(e) => match dlg.token(e) {
66743                    Ok(token) => token,
66744                    Err(e) => {
66745                        dlg.finished(false);
66746                        return Err(common::Error::MissingToken(e));
66747                    }
66748                },
66749            };
66750            request_value_reader
66751                .seek(std::io::SeekFrom::Start(0))
66752                .unwrap();
66753            let mut req_result = {
66754                let client = &self.hub.client;
66755                dlg.pre_request();
66756                let mut req_builder = hyper::Request::builder()
66757                    .method(hyper::Method::PUT)
66758                    .uri(url.as_str())
66759                    .header(USER_AGENT, self.hub._user_agent.clone());
66760
66761                if let Some(token) = token.as_ref() {
66762                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
66763                }
66764
66765                let request = req_builder
66766                    .header(CONTENT_TYPE, json_mime_type.to_string())
66767                    .header(CONTENT_LENGTH, request_size as u64)
66768                    .body(common::to_body(
66769                        request_value_reader.get_ref().clone().into(),
66770                    ));
66771
66772                client.request(request.unwrap()).await
66773            };
66774
66775            match req_result {
66776                Err(err) => {
66777                    if let common::Retry::After(d) = dlg.http_error(&err) {
66778                        sleep(d).await;
66779                        continue;
66780                    }
66781                    dlg.finished(false);
66782                    return Err(common::Error::HttpError(err));
66783                }
66784                Ok(res) => {
66785                    let (mut parts, body) = res.into_parts();
66786                    let mut body = common::Body::new(body);
66787                    if !parts.status.is_success() {
66788                        let bytes = common::to_bytes(body).await.unwrap_or_default();
66789                        let error = serde_json::from_str(&common::to_string(&bytes));
66790                        let response = common::to_response(parts, bytes.into());
66791
66792                        if let common::Retry::After(d) =
66793                            dlg.http_failure(&response, error.as_ref().ok())
66794                        {
66795                            sleep(d).await;
66796                            continue;
66797                        }
66798
66799                        dlg.finished(false);
66800
66801                        return Err(match error {
66802                            Ok(value) => common::Error::BadRequest(value),
66803                            _ => common::Error::Failure(response),
66804                        });
66805                    }
66806                    let response = {
66807                        let bytes = common::to_bytes(body).await.unwrap_or_default();
66808                        let encoded = common::to_string(&bytes);
66809                        match serde_json::from_str(&encoded) {
66810                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
66811                            Err(error) => {
66812                                dlg.response_json_decode_error(&encoded, &error);
66813                                return Err(common::Error::JsonDecodeError(
66814                                    encoded.to_string(),
66815                                    error,
66816                                ));
66817                            }
66818                        }
66819                    };
66820
66821                    dlg.finished(true);
66822                    return Ok(response);
66823                }
66824            }
66825        }
66826    }
66827
66828    ///
66829    /// Sets the *request* property to the given value.
66830    ///
66831    /// Even though the property as already been set when instantiating this call,
66832    /// we provide this method for API completeness.
66833    pub fn request(
66834        mut self,
66835        new_value: RemarketingListShare,
66836    ) -> RemarketingListShareUpdateCall<'a, C> {
66837        self._request = new_value;
66838        self
66839    }
66840    /// User profile ID associated with this request.
66841    ///
66842    /// Sets the *profile id* path property to the given value.
66843    ///
66844    /// Even though the property as already been set when instantiating this call,
66845    /// we provide this method for API completeness.
66846    pub fn profile_id(mut self, new_value: i64) -> RemarketingListShareUpdateCall<'a, C> {
66847        self._profile_id = new_value;
66848        self
66849    }
66850    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
66851    /// while executing the actual API request.
66852    ///
66853    /// ````text
66854    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
66855    /// ````
66856    ///
66857    /// Sets the *delegate* property to the given value.
66858    pub fn delegate(
66859        mut self,
66860        new_value: &'a mut dyn common::Delegate,
66861    ) -> RemarketingListShareUpdateCall<'a, C> {
66862        self._delegate = Some(new_value);
66863        self
66864    }
66865
66866    /// Set any additional parameter of the query string used in the request.
66867    /// It should be used to set parameters which are not yet available through their own
66868    /// setters.
66869    ///
66870    /// Please note that this method must not be used to set any of the known parameters
66871    /// which have their own setter method. If done anyway, the request will fail.
66872    ///
66873    /// # Additional Parameters
66874    ///
66875    /// * *$.xgafv* (query-string) - V1 error format.
66876    /// * *access_token* (query-string) - OAuth access token.
66877    /// * *alt* (query-string) - Data format for response.
66878    /// * *callback* (query-string) - JSONP
66879    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
66880    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
66881    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
66882    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
66883    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
66884    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
66885    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
66886    pub fn param<T>(mut self, name: T, value: T) -> RemarketingListShareUpdateCall<'a, C>
66887    where
66888        T: AsRef<str>,
66889    {
66890        self._additional_params
66891            .insert(name.as_ref().to_string(), value.as_ref().to_string());
66892        self
66893    }
66894
66895    /// Identifies the authorization scope for the method you are building.
66896    ///
66897    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
66898    /// [`Scope::Dfatrafficking`].
66899    ///
66900    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
66901    /// tokens for more than one scope.
66902    ///
66903    /// Usually there is more than one suitable scope to authorize an operation, some of which may
66904    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
66905    /// sufficient, a read-write scope will do as well.
66906    pub fn add_scope<St>(mut self, scope: St) -> RemarketingListShareUpdateCall<'a, C>
66907    where
66908        St: AsRef<str>,
66909    {
66910        self._scopes.insert(String::from(scope.as_ref()));
66911        self
66912    }
66913    /// Identifies the authorization scope(s) for the method you are building.
66914    ///
66915    /// See [`Self::add_scope()`] for details.
66916    pub fn add_scopes<I, St>(mut self, scopes: I) -> RemarketingListShareUpdateCall<'a, C>
66917    where
66918        I: IntoIterator<Item = St>,
66919        St: AsRef<str>,
66920    {
66921        self._scopes
66922            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
66923        self
66924    }
66925
66926    /// Removes all scopes, and no default scope will be used either.
66927    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
66928    /// for details).
66929    pub fn clear_scopes(mut self) -> RemarketingListShareUpdateCall<'a, C> {
66930        self._scopes.clear();
66931        self
66932    }
66933}
66934
66935/// Gets one remarketing list by ID.
66936///
66937/// A builder for the *get* method supported by a *remarketingList* resource.
66938/// It is not used directly, but through a [`RemarketingListMethods`] instance.
66939///
66940/// # Example
66941///
66942/// Instantiate a resource method builder
66943///
66944/// ```test_harness,no_run
66945/// # extern crate hyper;
66946/// # extern crate hyper_rustls;
66947/// # extern crate google_dfareporting3d3 as dfareporting3d3;
66948/// # async fn dox() {
66949/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
66950///
66951/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
66952/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
66953/// #     secret,
66954/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
66955/// # ).build().await.unwrap();
66956///
66957/// # let client = hyper_util::client::legacy::Client::builder(
66958/// #     hyper_util::rt::TokioExecutor::new()
66959/// # )
66960/// # .build(
66961/// #     hyper_rustls::HttpsConnectorBuilder::new()
66962/// #         .with_native_roots()
66963/// #         .unwrap()
66964/// #         .https_or_http()
66965/// #         .enable_http1()
66966/// #         .build()
66967/// # );
66968/// # let mut hub = Dfareporting::new(client, auth);
66969/// // You can configure optional parameters by calling the respective setters at will, and
66970/// // execute the final call using `doit()`.
66971/// // Values shown here are possibly random and not representative !
66972/// let result = hub.remarketing_lists().get(-19, -29)
66973///              .doit().await;
66974/// # }
66975/// ```
66976pub struct RemarketingListGetCall<'a, C>
66977where
66978    C: 'a,
66979{
66980    hub: &'a Dfareporting<C>,
66981    _profile_id: i64,
66982    _id: i64,
66983    _delegate: Option<&'a mut dyn common::Delegate>,
66984    _additional_params: HashMap<String, String>,
66985    _scopes: BTreeSet<String>,
66986}
66987
66988impl<'a, C> common::CallBuilder for RemarketingListGetCall<'a, C> {}
66989
66990impl<'a, C> RemarketingListGetCall<'a, C>
66991where
66992    C: common::Connector,
66993{
66994    /// Perform the operation you have build so far.
66995    pub async fn doit(mut self) -> common::Result<(common::Response, RemarketingList)> {
66996        use std::borrow::Cow;
66997        use std::io::{Read, Seek};
66998
66999        use common::{url::Params, ToParts};
67000        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
67001
67002        let mut dd = common::DefaultDelegate;
67003        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
67004        dlg.begin(common::MethodInfo {
67005            id: "dfareporting.remarketingLists.get",
67006            http_method: hyper::Method::GET,
67007        });
67008
67009        for &field in ["alt", "profileId", "id"].iter() {
67010            if self._additional_params.contains_key(field) {
67011                dlg.finished(false);
67012                return Err(common::Error::FieldClash(field));
67013            }
67014        }
67015
67016        let mut params = Params::with_capacity(4 + self._additional_params.len());
67017        params.push("profileId", self._profile_id.to_string());
67018        params.push("id", self._id.to_string());
67019
67020        params.extend(self._additional_params.iter());
67021
67022        params.push("alt", "json");
67023        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/remarketingLists/{id}";
67024        if self._scopes.is_empty() {
67025            self._scopes
67026                .insert(Scope::Dfatrafficking.as_ref().to_string());
67027        }
67028
67029        #[allow(clippy::single_element_loop)]
67030        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
67031            url = params.uri_replacement(url, param_name, find_this, false);
67032        }
67033        {
67034            let to_remove = ["id", "profileId"];
67035            params.remove_params(&to_remove);
67036        }
67037
67038        let url = params.parse_with_url(&url);
67039
67040        loop {
67041            let token = match self
67042                .hub
67043                .auth
67044                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
67045                .await
67046            {
67047                Ok(token) => token,
67048                Err(e) => match dlg.token(e) {
67049                    Ok(token) => token,
67050                    Err(e) => {
67051                        dlg.finished(false);
67052                        return Err(common::Error::MissingToken(e));
67053                    }
67054                },
67055            };
67056            let mut req_result = {
67057                let client = &self.hub.client;
67058                dlg.pre_request();
67059                let mut req_builder = hyper::Request::builder()
67060                    .method(hyper::Method::GET)
67061                    .uri(url.as_str())
67062                    .header(USER_AGENT, self.hub._user_agent.clone());
67063
67064                if let Some(token) = token.as_ref() {
67065                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
67066                }
67067
67068                let request = req_builder
67069                    .header(CONTENT_LENGTH, 0_u64)
67070                    .body(common::to_body::<String>(None));
67071
67072                client.request(request.unwrap()).await
67073            };
67074
67075            match req_result {
67076                Err(err) => {
67077                    if let common::Retry::After(d) = dlg.http_error(&err) {
67078                        sleep(d).await;
67079                        continue;
67080                    }
67081                    dlg.finished(false);
67082                    return Err(common::Error::HttpError(err));
67083                }
67084                Ok(res) => {
67085                    let (mut parts, body) = res.into_parts();
67086                    let mut body = common::Body::new(body);
67087                    if !parts.status.is_success() {
67088                        let bytes = common::to_bytes(body).await.unwrap_or_default();
67089                        let error = serde_json::from_str(&common::to_string(&bytes));
67090                        let response = common::to_response(parts, bytes.into());
67091
67092                        if let common::Retry::After(d) =
67093                            dlg.http_failure(&response, error.as_ref().ok())
67094                        {
67095                            sleep(d).await;
67096                            continue;
67097                        }
67098
67099                        dlg.finished(false);
67100
67101                        return Err(match error {
67102                            Ok(value) => common::Error::BadRequest(value),
67103                            _ => common::Error::Failure(response),
67104                        });
67105                    }
67106                    let response = {
67107                        let bytes = common::to_bytes(body).await.unwrap_or_default();
67108                        let encoded = common::to_string(&bytes);
67109                        match serde_json::from_str(&encoded) {
67110                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
67111                            Err(error) => {
67112                                dlg.response_json_decode_error(&encoded, &error);
67113                                return Err(common::Error::JsonDecodeError(
67114                                    encoded.to_string(),
67115                                    error,
67116                                ));
67117                            }
67118                        }
67119                    };
67120
67121                    dlg.finished(true);
67122                    return Ok(response);
67123                }
67124            }
67125        }
67126    }
67127
67128    /// User profile ID associated with this request.
67129    ///
67130    /// Sets the *profile id* path property to the given value.
67131    ///
67132    /// Even though the property as already been set when instantiating this call,
67133    /// we provide this method for API completeness.
67134    pub fn profile_id(mut self, new_value: i64) -> RemarketingListGetCall<'a, C> {
67135        self._profile_id = new_value;
67136        self
67137    }
67138    /// Remarketing list ID.
67139    ///
67140    /// Sets the *id* path property to the given value.
67141    ///
67142    /// Even though the property as already been set when instantiating this call,
67143    /// we provide this method for API completeness.
67144    pub fn id(mut self, new_value: i64) -> RemarketingListGetCall<'a, C> {
67145        self._id = new_value;
67146        self
67147    }
67148    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
67149    /// while executing the actual API request.
67150    ///
67151    /// ````text
67152    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
67153    /// ````
67154    ///
67155    /// Sets the *delegate* property to the given value.
67156    pub fn delegate(
67157        mut self,
67158        new_value: &'a mut dyn common::Delegate,
67159    ) -> RemarketingListGetCall<'a, C> {
67160        self._delegate = Some(new_value);
67161        self
67162    }
67163
67164    /// Set any additional parameter of the query string used in the request.
67165    /// It should be used to set parameters which are not yet available through their own
67166    /// setters.
67167    ///
67168    /// Please note that this method must not be used to set any of the known parameters
67169    /// which have their own setter method. If done anyway, the request will fail.
67170    ///
67171    /// # Additional Parameters
67172    ///
67173    /// * *$.xgafv* (query-string) - V1 error format.
67174    /// * *access_token* (query-string) - OAuth access token.
67175    /// * *alt* (query-string) - Data format for response.
67176    /// * *callback* (query-string) - JSONP
67177    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
67178    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
67179    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
67180    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
67181    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
67182    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
67183    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
67184    pub fn param<T>(mut self, name: T, value: T) -> RemarketingListGetCall<'a, C>
67185    where
67186        T: AsRef<str>,
67187    {
67188        self._additional_params
67189            .insert(name.as_ref().to_string(), value.as_ref().to_string());
67190        self
67191    }
67192
67193    /// Identifies the authorization scope for the method you are building.
67194    ///
67195    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
67196    /// [`Scope::Dfatrafficking`].
67197    ///
67198    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
67199    /// tokens for more than one scope.
67200    ///
67201    /// Usually there is more than one suitable scope to authorize an operation, some of which may
67202    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
67203    /// sufficient, a read-write scope will do as well.
67204    pub fn add_scope<St>(mut self, scope: St) -> RemarketingListGetCall<'a, C>
67205    where
67206        St: AsRef<str>,
67207    {
67208        self._scopes.insert(String::from(scope.as_ref()));
67209        self
67210    }
67211    /// Identifies the authorization scope(s) for the method you are building.
67212    ///
67213    /// See [`Self::add_scope()`] for details.
67214    pub fn add_scopes<I, St>(mut self, scopes: I) -> RemarketingListGetCall<'a, C>
67215    where
67216        I: IntoIterator<Item = St>,
67217        St: AsRef<str>,
67218    {
67219        self._scopes
67220            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
67221        self
67222    }
67223
67224    /// Removes all scopes, and no default scope will be used either.
67225    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
67226    /// for details).
67227    pub fn clear_scopes(mut self) -> RemarketingListGetCall<'a, C> {
67228        self._scopes.clear();
67229        self
67230    }
67231}
67232
67233/// Inserts a new remarketing list.
67234///
67235/// A builder for the *insert* method supported by a *remarketingList* resource.
67236/// It is not used directly, but through a [`RemarketingListMethods`] instance.
67237///
67238/// # Example
67239///
67240/// Instantiate a resource method builder
67241///
67242/// ```test_harness,no_run
67243/// # extern crate hyper;
67244/// # extern crate hyper_rustls;
67245/// # extern crate google_dfareporting3d3 as dfareporting3d3;
67246/// use dfareporting3d3::api::RemarketingList;
67247/// # async fn dox() {
67248/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
67249///
67250/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
67251/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
67252/// #     secret,
67253/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
67254/// # ).build().await.unwrap();
67255///
67256/// # let client = hyper_util::client::legacy::Client::builder(
67257/// #     hyper_util::rt::TokioExecutor::new()
67258/// # )
67259/// # .build(
67260/// #     hyper_rustls::HttpsConnectorBuilder::new()
67261/// #         .with_native_roots()
67262/// #         .unwrap()
67263/// #         .https_or_http()
67264/// #         .enable_http1()
67265/// #         .build()
67266/// # );
67267/// # let mut hub = Dfareporting::new(client, auth);
67268/// // As the method needs a request, you would usually fill it with the desired information
67269/// // into the respective structure. Some of the parts shown here might not be applicable !
67270/// // Values shown here are possibly random and not representative !
67271/// let mut req = RemarketingList::default();
67272///
67273/// // You can configure optional parameters by calling the respective setters at will, and
67274/// // execute the final call using `doit()`.
67275/// // Values shown here are possibly random and not representative !
67276/// let result = hub.remarketing_lists().insert(req, -58)
67277///              .doit().await;
67278/// # }
67279/// ```
67280pub struct RemarketingListInsertCall<'a, C>
67281where
67282    C: 'a,
67283{
67284    hub: &'a Dfareporting<C>,
67285    _request: RemarketingList,
67286    _profile_id: i64,
67287    _delegate: Option<&'a mut dyn common::Delegate>,
67288    _additional_params: HashMap<String, String>,
67289    _scopes: BTreeSet<String>,
67290}
67291
67292impl<'a, C> common::CallBuilder for RemarketingListInsertCall<'a, C> {}
67293
67294impl<'a, C> RemarketingListInsertCall<'a, C>
67295where
67296    C: common::Connector,
67297{
67298    /// Perform the operation you have build so far.
67299    pub async fn doit(mut self) -> common::Result<(common::Response, RemarketingList)> {
67300        use std::borrow::Cow;
67301        use std::io::{Read, Seek};
67302
67303        use common::{url::Params, ToParts};
67304        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
67305
67306        let mut dd = common::DefaultDelegate;
67307        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
67308        dlg.begin(common::MethodInfo {
67309            id: "dfareporting.remarketingLists.insert",
67310            http_method: hyper::Method::POST,
67311        });
67312
67313        for &field in ["alt", "profileId"].iter() {
67314            if self._additional_params.contains_key(field) {
67315                dlg.finished(false);
67316                return Err(common::Error::FieldClash(field));
67317            }
67318        }
67319
67320        let mut params = Params::with_capacity(4 + self._additional_params.len());
67321        params.push("profileId", self._profile_id.to_string());
67322
67323        params.extend(self._additional_params.iter());
67324
67325        params.push("alt", "json");
67326        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/remarketingLists";
67327        if self._scopes.is_empty() {
67328            self._scopes
67329                .insert(Scope::Dfatrafficking.as_ref().to_string());
67330        }
67331
67332        #[allow(clippy::single_element_loop)]
67333        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
67334            url = params.uri_replacement(url, param_name, find_this, false);
67335        }
67336        {
67337            let to_remove = ["profileId"];
67338            params.remove_params(&to_remove);
67339        }
67340
67341        let url = params.parse_with_url(&url);
67342
67343        let mut json_mime_type = mime::APPLICATION_JSON;
67344        let mut request_value_reader = {
67345            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
67346            common::remove_json_null_values(&mut value);
67347            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
67348            serde_json::to_writer(&mut dst, &value).unwrap();
67349            dst
67350        };
67351        let request_size = request_value_reader
67352            .seek(std::io::SeekFrom::End(0))
67353            .unwrap();
67354        request_value_reader
67355            .seek(std::io::SeekFrom::Start(0))
67356            .unwrap();
67357
67358        loop {
67359            let token = match self
67360                .hub
67361                .auth
67362                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
67363                .await
67364            {
67365                Ok(token) => token,
67366                Err(e) => match dlg.token(e) {
67367                    Ok(token) => token,
67368                    Err(e) => {
67369                        dlg.finished(false);
67370                        return Err(common::Error::MissingToken(e));
67371                    }
67372                },
67373            };
67374            request_value_reader
67375                .seek(std::io::SeekFrom::Start(0))
67376                .unwrap();
67377            let mut req_result = {
67378                let client = &self.hub.client;
67379                dlg.pre_request();
67380                let mut req_builder = hyper::Request::builder()
67381                    .method(hyper::Method::POST)
67382                    .uri(url.as_str())
67383                    .header(USER_AGENT, self.hub._user_agent.clone());
67384
67385                if let Some(token) = token.as_ref() {
67386                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
67387                }
67388
67389                let request = req_builder
67390                    .header(CONTENT_TYPE, json_mime_type.to_string())
67391                    .header(CONTENT_LENGTH, request_size as u64)
67392                    .body(common::to_body(
67393                        request_value_reader.get_ref().clone().into(),
67394                    ));
67395
67396                client.request(request.unwrap()).await
67397            };
67398
67399            match req_result {
67400                Err(err) => {
67401                    if let common::Retry::After(d) = dlg.http_error(&err) {
67402                        sleep(d).await;
67403                        continue;
67404                    }
67405                    dlg.finished(false);
67406                    return Err(common::Error::HttpError(err));
67407                }
67408                Ok(res) => {
67409                    let (mut parts, body) = res.into_parts();
67410                    let mut body = common::Body::new(body);
67411                    if !parts.status.is_success() {
67412                        let bytes = common::to_bytes(body).await.unwrap_or_default();
67413                        let error = serde_json::from_str(&common::to_string(&bytes));
67414                        let response = common::to_response(parts, bytes.into());
67415
67416                        if let common::Retry::After(d) =
67417                            dlg.http_failure(&response, error.as_ref().ok())
67418                        {
67419                            sleep(d).await;
67420                            continue;
67421                        }
67422
67423                        dlg.finished(false);
67424
67425                        return Err(match error {
67426                            Ok(value) => common::Error::BadRequest(value),
67427                            _ => common::Error::Failure(response),
67428                        });
67429                    }
67430                    let response = {
67431                        let bytes = common::to_bytes(body).await.unwrap_or_default();
67432                        let encoded = common::to_string(&bytes);
67433                        match serde_json::from_str(&encoded) {
67434                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
67435                            Err(error) => {
67436                                dlg.response_json_decode_error(&encoded, &error);
67437                                return Err(common::Error::JsonDecodeError(
67438                                    encoded.to_string(),
67439                                    error,
67440                                ));
67441                            }
67442                        }
67443                    };
67444
67445                    dlg.finished(true);
67446                    return Ok(response);
67447                }
67448            }
67449        }
67450    }
67451
67452    ///
67453    /// Sets the *request* property to the given value.
67454    ///
67455    /// Even though the property as already been set when instantiating this call,
67456    /// we provide this method for API completeness.
67457    pub fn request(mut self, new_value: RemarketingList) -> RemarketingListInsertCall<'a, C> {
67458        self._request = new_value;
67459        self
67460    }
67461    /// User profile ID associated with this request.
67462    ///
67463    /// Sets the *profile id* path property to the given value.
67464    ///
67465    /// Even though the property as already been set when instantiating this call,
67466    /// we provide this method for API completeness.
67467    pub fn profile_id(mut self, new_value: i64) -> RemarketingListInsertCall<'a, C> {
67468        self._profile_id = new_value;
67469        self
67470    }
67471    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
67472    /// while executing the actual API request.
67473    ///
67474    /// ````text
67475    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
67476    /// ````
67477    ///
67478    /// Sets the *delegate* property to the given value.
67479    pub fn delegate(
67480        mut self,
67481        new_value: &'a mut dyn common::Delegate,
67482    ) -> RemarketingListInsertCall<'a, C> {
67483        self._delegate = Some(new_value);
67484        self
67485    }
67486
67487    /// Set any additional parameter of the query string used in the request.
67488    /// It should be used to set parameters which are not yet available through their own
67489    /// setters.
67490    ///
67491    /// Please note that this method must not be used to set any of the known parameters
67492    /// which have their own setter method. If done anyway, the request will fail.
67493    ///
67494    /// # Additional Parameters
67495    ///
67496    /// * *$.xgafv* (query-string) - V1 error format.
67497    /// * *access_token* (query-string) - OAuth access token.
67498    /// * *alt* (query-string) - Data format for response.
67499    /// * *callback* (query-string) - JSONP
67500    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
67501    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
67502    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
67503    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
67504    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
67505    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
67506    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
67507    pub fn param<T>(mut self, name: T, value: T) -> RemarketingListInsertCall<'a, C>
67508    where
67509        T: AsRef<str>,
67510    {
67511        self._additional_params
67512            .insert(name.as_ref().to_string(), value.as_ref().to_string());
67513        self
67514    }
67515
67516    /// Identifies the authorization scope for the method you are building.
67517    ///
67518    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
67519    /// [`Scope::Dfatrafficking`].
67520    ///
67521    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
67522    /// tokens for more than one scope.
67523    ///
67524    /// Usually there is more than one suitable scope to authorize an operation, some of which may
67525    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
67526    /// sufficient, a read-write scope will do as well.
67527    pub fn add_scope<St>(mut self, scope: St) -> RemarketingListInsertCall<'a, C>
67528    where
67529        St: AsRef<str>,
67530    {
67531        self._scopes.insert(String::from(scope.as_ref()));
67532        self
67533    }
67534    /// Identifies the authorization scope(s) for the method you are building.
67535    ///
67536    /// See [`Self::add_scope()`] for details.
67537    pub fn add_scopes<I, St>(mut self, scopes: I) -> RemarketingListInsertCall<'a, C>
67538    where
67539        I: IntoIterator<Item = St>,
67540        St: AsRef<str>,
67541    {
67542        self._scopes
67543            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
67544        self
67545    }
67546
67547    /// Removes all scopes, and no default scope will be used either.
67548    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
67549    /// for details).
67550    pub fn clear_scopes(mut self) -> RemarketingListInsertCall<'a, C> {
67551        self._scopes.clear();
67552        self
67553    }
67554}
67555
67556/// Retrieves a list of remarketing lists, possibly filtered. This method supports paging.
67557///
67558/// A builder for the *list* method supported by a *remarketingList* resource.
67559/// It is not used directly, but through a [`RemarketingListMethods`] instance.
67560///
67561/// # Example
67562///
67563/// Instantiate a resource method builder
67564///
67565/// ```test_harness,no_run
67566/// # extern crate hyper;
67567/// # extern crate hyper_rustls;
67568/// # extern crate google_dfareporting3d3 as dfareporting3d3;
67569/// # async fn dox() {
67570/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
67571///
67572/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
67573/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
67574/// #     secret,
67575/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
67576/// # ).build().await.unwrap();
67577///
67578/// # let client = hyper_util::client::legacy::Client::builder(
67579/// #     hyper_util::rt::TokioExecutor::new()
67580/// # )
67581/// # .build(
67582/// #     hyper_rustls::HttpsConnectorBuilder::new()
67583/// #         .with_native_roots()
67584/// #         .unwrap()
67585/// #         .https_or_http()
67586/// #         .enable_http1()
67587/// #         .build()
67588/// # );
67589/// # let mut hub = Dfareporting::new(client, auth);
67590/// // You can configure optional parameters by calling the respective setters at will, and
67591/// // execute the final call using `doit()`.
67592/// // Values shown here are possibly random and not representative !
67593/// let result = hub.remarketing_lists().list(-80, -25)
67594///              .sort_order("sit")
67595///              .sort_field("et")
67596///              .page_token("ea")
67597///              .name("dolor")
67598///              .max_results(-45)
67599///              .floodlight_activity_id(-92)
67600///              .active(false)
67601///              .doit().await;
67602/// # }
67603/// ```
67604pub struct RemarketingListListCall<'a, C>
67605where
67606    C: 'a,
67607{
67608    hub: &'a Dfareporting<C>,
67609    _profile_id: i64,
67610    _advertiser_id: i64,
67611    _sort_order: Option<String>,
67612    _sort_field: Option<String>,
67613    _page_token: Option<String>,
67614    _name: Option<String>,
67615    _max_results: Option<i32>,
67616    _floodlight_activity_id: Option<i64>,
67617    _active: Option<bool>,
67618    _delegate: Option<&'a mut dyn common::Delegate>,
67619    _additional_params: HashMap<String, String>,
67620    _scopes: BTreeSet<String>,
67621}
67622
67623impl<'a, C> common::CallBuilder for RemarketingListListCall<'a, C> {}
67624
67625impl<'a, C> RemarketingListListCall<'a, C>
67626where
67627    C: common::Connector,
67628{
67629    /// Perform the operation you have build so far.
67630    pub async fn doit(
67631        mut self,
67632    ) -> common::Result<(common::Response, RemarketingListsListResponse)> {
67633        use std::borrow::Cow;
67634        use std::io::{Read, Seek};
67635
67636        use common::{url::Params, ToParts};
67637        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
67638
67639        let mut dd = common::DefaultDelegate;
67640        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
67641        dlg.begin(common::MethodInfo {
67642            id: "dfareporting.remarketingLists.list",
67643            http_method: hyper::Method::GET,
67644        });
67645
67646        for &field in [
67647            "alt",
67648            "profileId",
67649            "advertiserId",
67650            "sortOrder",
67651            "sortField",
67652            "pageToken",
67653            "name",
67654            "maxResults",
67655            "floodlightActivityId",
67656            "active",
67657        ]
67658        .iter()
67659        {
67660            if self._additional_params.contains_key(field) {
67661                dlg.finished(false);
67662                return Err(common::Error::FieldClash(field));
67663            }
67664        }
67665
67666        let mut params = Params::with_capacity(11 + self._additional_params.len());
67667        params.push("profileId", self._profile_id.to_string());
67668        params.push("advertiserId", self._advertiser_id.to_string());
67669        if let Some(value) = self._sort_order.as_ref() {
67670            params.push("sortOrder", value);
67671        }
67672        if let Some(value) = self._sort_field.as_ref() {
67673            params.push("sortField", value);
67674        }
67675        if let Some(value) = self._page_token.as_ref() {
67676            params.push("pageToken", value);
67677        }
67678        if let Some(value) = self._name.as_ref() {
67679            params.push("name", value);
67680        }
67681        if let Some(value) = self._max_results.as_ref() {
67682            params.push("maxResults", value.to_string());
67683        }
67684        if let Some(value) = self._floodlight_activity_id.as_ref() {
67685            params.push("floodlightActivityId", value.to_string());
67686        }
67687        if let Some(value) = self._active.as_ref() {
67688            params.push("active", value.to_string());
67689        }
67690
67691        params.extend(self._additional_params.iter());
67692
67693        params.push("alt", "json");
67694        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/remarketingLists";
67695        if self._scopes.is_empty() {
67696            self._scopes
67697                .insert(Scope::Dfatrafficking.as_ref().to_string());
67698        }
67699
67700        #[allow(clippy::single_element_loop)]
67701        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
67702            url = params.uri_replacement(url, param_name, find_this, false);
67703        }
67704        {
67705            let to_remove = ["profileId"];
67706            params.remove_params(&to_remove);
67707        }
67708
67709        let url = params.parse_with_url(&url);
67710
67711        loop {
67712            let token = match self
67713                .hub
67714                .auth
67715                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
67716                .await
67717            {
67718                Ok(token) => token,
67719                Err(e) => match dlg.token(e) {
67720                    Ok(token) => token,
67721                    Err(e) => {
67722                        dlg.finished(false);
67723                        return Err(common::Error::MissingToken(e));
67724                    }
67725                },
67726            };
67727            let mut req_result = {
67728                let client = &self.hub.client;
67729                dlg.pre_request();
67730                let mut req_builder = hyper::Request::builder()
67731                    .method(hyper::Method::GET)
67732                    .uri(url.as_str())
67733                    .header(USER_AGENT, self.hub._user_agent.clone());
67734
67735                if let Some(token) = token.as_ref() {
67736                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
67737                }
67738
67739                let request = req_builder
67740                    .header(CONTENT_LENGTH, 0_u64)
67741                    .body(common::to_body::<String>(None));
67742
67743                client.request(request.unwrap()).await
67744            };
67745
67746            match req_result {
67747                Err(err) => {
67748                    if let common::Retry::After(d) = dlg.http_error(&err) {
67749                        sleep(d).await;
67750                        continue;
67751                    }
67752                    dlg.finished(false);
67753                    return Err(common::Error::HttpError(err));
67754                }
67755                Ok(res) => {
67756                    let (mut parts, body) = res.into_parts();
67757                    let mut body = common::Body::new(body);
67758                    if !parts.status.is_success() {
67759                        let bytes = common::to_bytes(body).await.unwrap_or_default();
67760                        let error = serde_json::from_str(&common::to_string(&bytes));
67761                        let response = common::to_response(parts, bytes.into());
67762
67763                        if let common::Retry::After(d) =
67764                            dlg.http_failure(&response, error.as_ref().ok())
67765                        {
67766                            sleep(d).await;
67767                            continue;
67768                        }
67769
67770                        dlg.finished(false);
67771
67772                        return Err(match error {
67773                            Ok(value) => common::Error::BadRequest(value),
67774                            _ => common::Error::Failure(response),
67775                        });
67776                    }
67777                    let response = {
67778                        let bytes = common::to_bytes(body).await.unwrap_or_default();
67779                        let encoded = common::to_string(&bytes);
67780                        match serde_json::from_str(&encoded) {
67781                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
67782                            Err(error) => {
67783                                dlg.response_json_decode_error(&encoded, &error);
67784                                return Err(common::Error::JsonDecodeError(
67785                                    encoded.to_string(),
67786                                    error,
67787                                ));
67788                            }
67789                        }
67790                    };
67791
67792                    dlg.finished(true);
67793                    return Ok(response);
67794                }
67795            }
67796        }
67797    }
67798
67799    /// User profile ID associated with this request.
67800    ///
67801    /// Sets the *profile id* path property to the given value.
67802    ///
67803    /// Even though the property as already been set when instantiating this call,
67804    /// we provide this method for API completeness.
67805    pub fn profile_id(mut self, new_value: i64) -> RemarketingListListCall<'a, C> {
67806        self._profile_id = new_value;
67807        self
67808    }
67809    /// Select only remarketing lists owned by this advertiser.
67810    ///
67811    /// Sets the *advertiser id* query property to the given value.
67812    ///
67813    /// Even though the property as already been set when instantiating this call,
67814    /// we provide this method for API completeness.
67815    pub fn advertiser_id(mut self, new_value: i64) -> RemarketingListListCall<'a, C> {
67816        self._advertiser_id = new_value;
67817        self
67818    }
67819    /// Order of sorted results.
67820    ///
67821    /// Sets the *sort order* query property to the given value.
67822    pub fn sort_order(mut self, new_value: &str) -> RemarketingListListCall<'a, C> {
67823        self._sort_order = Some(new_value.to_string());
67824        self
67825    }
67826    /// Field by which to sort the list.
67827    ///
67828    /// Sets the *sort field* query property to the given value.
67829    pub fn sort_field(mut self, new_value: &str) -> RemarketingListListCall<'a, C> {
67830        self._sort_field = Some(new_value.to_string());
67831        self
67832    }
67833    /// Value of the nextPageToken from the previous result page.
67834    ///
67835    /// Sets the *page token* query property to the given value.
67836    pub fn page_token(mut self, new_value: &str) -> RemarketingListListCall<'a, C> {
67837        self._page_token = Some(new_value.to_string());
67838        self
67839    }
67840    /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "remarketing list*2015" will return objects with names like "remarketing list June 2015", "remarketing list April 2015", or simply "remarketing list 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "remarketing list" will match objects with name "my remarketing list", "remarketing list 2015", or simply "remarketing list".
67841    ///
67842    /// Sets the *name* query property to the given value.
67843    pub fn name(mut self, new_value: &str) -> RemarketingListListCall<'a, C> {
67844        self._name = Some(new_value.to_string());
67845        self
67846    }
67847    /// Maximum number of results to return.
67848    ///
67849    /// Sets the *max results* query property to the given value.
67850    pub fn max_results(mut self, new_value: i32) -> RemarketingListListCall<'a, C> {
67851        self._max_results = Some(new_value);
67852        self
67853    }
67854    /// Select only remarketing lists that have this floodlight activity ID.
67855    ///
67856    /// Sets the *floodlight activity id* query property to the given value.
67857    pub fn floodlight_activity_id(mut self, new_value: i64) -> RemarketingListListCall<'a, C> {
67858        self._floodlight_activity_id = Some(new_value);
67859        self
67860    }
67861    /// Select only active or only inactive remarketing lists.
67862    ///
67863    /// Sets the *active* query property to the given value.
67864    pub fn active(mut self, new_value: bool) -> RemarketingListListCall<'a, C> {
67865        self._active = Some(new_value);
67866        self
67867    }
67868    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
67869    /// while executing the actual API request.
67870    ///
67871    /// ````text
67872    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
67873    /// ````
67874    ///
67875    /// Sets the *delegate* property to the given value.
67876    pub fn delegate(
67877        mut self,
67878        new_value: &'a mut dyn common::Delegate,
67879    ) -> RemarketingListListCall<'a, C> {
67880        self._delegate = Some(new_value);
67881        self
67882    }
67883
67884    /// Set any additional parameter of the query string used in the request.
67885    /// It should be used to set parameters which are not yet available through their own
67886    /// setters.
67887    ///
67888    /// Please note that this method must not be used to set any of the known parameters
67889    /// which have their own setter method. If done anyway, the request will fail.
67890    ///
67891    /// # Additional Parameters
67892    ///
67893    /// * *$.xgafv* (query-string) - V1 error format.
67894    /// * *access_token* (query-string) - OAuth access token.
67895    /// * *alt* (query-string) - Data format for response.
67896    /// * *callback* (query-string) - JSONP
67897    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
67898    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
67899    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
67900    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
67901    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
67902    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
67903    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
67904    pub fn param<T>(mut self, name: T, value: T) -> RemarketingListListCall<'a, C>
67905    where
67906        T: AsRef<str>,
67907    {
67908        self._additional_params
67909            .insert(name.as_ref().to_string(), value.as_ref().to_string());
67910        self
67911    }
67912
67913    /// Identifies the authorization scope for the method you are building.
67914    ///
67915    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
67916    /// [`Scope::Dfatrafficking`].
67917    ///
67918    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
67919    /// tokens for more than one scope.
67920    ///
67921    /// Usually there is more than one suitable scope to authorize an operation, some of which may
67922    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
67923    /// sufficient, a read-write scope will do as well.
67924    pub fn add_scope<St>(mut self, scope: St) -> RemarketingListListCall<'a, C>
67925    where
67926        St: AsRef<str>,
67927    {
67928        self._scopes.insert(String::from(scope.as_ref()));
67929        self
67930    }
67931    /// Identifies the authorization scope(s) for the method you are building.
67932    ///
67933    /// See [`Self::add_scope()`] for details.
67934    pub fn add_scopes<I, St>(mut self, scopes: I) -> RemarketingListListCall<'a, C>
67935    where
67936        I: IntoIterator<Item = St>,
67937        St: AsRef<str>,
67938    {
67939        self._scopes
67940            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
67941        self
67942    }
67943
67944    /// Removes all scopes, and no default scope will be used either.
67945    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
67946    /// for details).
67947    pub fn clear_scopes(mut self) -> RemarketingListListCall<'a, C> {
67948        self._scopes.clear();
67949        self
67950    }
67951}
67952
67953/// Updates an existing remarketing list. This method supports patch semantics.
67954///
67955/// A builder for the *patch* method supported by a *remarketingList* resource.
67956/// It is not used directly, but through a [`RemarketingListMethods`] instance.
67957///
67958/// # Example
67959///
67960/// Instantiate a resource method builder
67961///
67962/// ```test_harness,no_run
67963/// # extern crate hyper;
67964/// # extern crate hyper_rustls;
67965/// # extern crate google_dfareporting3d3 as dfareporting3d3;
67966/// use dfareporting3d3::api::RemarketingList;
67967/// # async fn dox() {
67968/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
67969///
67970/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
67971/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
67972/// #     secret,
67973/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
67974/// # ).build().await.unwrap();
67975///
67976/// # let client = hyper_util::client::legacy::Client::builder(
67977/// #     hyper_util::rt::TokioExecutor::new()
67978/// # )
67979/// # .build(
67980/// #     hyper_rustls::HttpsConnectorBuilder::new()
67981/// #         .with_native_roots()
67982/// #         .unwrap()
67983/// #         .https_or_http()
67984/// #         .enable_http1()
67985/// #         .build()
67986/// # );
67987/// # let mut hub = Dfareporting::new(client, auth);
67988/// // As the method needs a request, you would usually fill it with the desired information
67989/// // into the respective structure. Some of the parts shown here might not be applicable !
67990/// // Values shown here are possibly random and not representative !
67991/// let mut req = RemarketingList::default();
67992///
67993/// // You can configure optional parameters by calling the respective setters at will, and
67994/// // execute the final call using `doit()`.
67995/// // Values shown here are possibly random and not representative !
67996/// let result = hub.remarketing_lists().patch(req, -13, -33)
67997///              .doit().await;
67998/// # }
67999/// ```
68000pub struct RemarketingListPatchCall<'a, C>
68001where
68002    C: 'a,
68003{
68004    hub: &'a Dfareporting<C>,
68005    _request: RemarketingList,
68006    _profile_id: i64,
68007    _id: i64,
68008    _delegate: Option<&'a mut dyn common::Delegate>,
68009    _additional_params: HashMap<String, String>,
68010    _scopes: BTreeSet<String>,
68011}
68012
68013impl<'a, C> common::CallBuilder for RemarketingListPatchCall<'a, C> {}
68014
68015impl<'a, C> RemarketingListPatchCall<'a, C>
68016where
68017    C: common::Connector,
68018{
68019    /// Perform the operation you have build so far.
68020    pub async fn doit(mut self) -> common::Result<(common::Response, RemarketingList)> {
68021        use std::borrow::Cow;
68022        use std::io::{Read, Seek};
68023
68024        use common::{url::Params, ToParts};
68025        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
68026
68027        let mut dd = common::DefaultDelegate;
68028        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
68029        dlg.begin(common::MethodInfo {
68030            id: "dfareporting.remarketingLists.patch",
68031            http_method: hyper::Method::PATCH,
68032        });
68033
68034        for &field in ["alt", "profileId", "id"].iter() {
68035            if self._additional_params.contains_key(field) {
68036                dlg.finished(false);
68037                return Err(common::Error::FieldClash(field));
68038            }
68039        }
68040
68041        let mut params = Params::with_capacity(5 + self._additional_params.len());
68042        params.push("profileId", self._profile_id.to_string());
68043        params.push("id", self._id.to_string());
68044
68045        params.extend(self._additional_params.iter());
68046
68047        params.push("alt", "json");
68048        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/remarketingLists";
68049        if self._scopes.is_empty() {
68050            self._scopes
68051                .insert(Scope::Dfatrafficking.as_ref().to_string());
68052        }
68053
68054        #[allow(clippy::single_element_loop)]
68055        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
68056            url = params.uri_replacement(url, param_name, find_this, false);
68057        }
68058        {
68059            let to_remove = ["profileId"];
68060            params.remove_params(&to_remove);
68061        }
68062
68063        let url = params.parse_with_url(&url);
68064
68065        let mut json_mime_type = mime::APPLICATION_JSON;
68066        let mut request_value_reader = {
68067            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
68068            common::remove_json_null_values(&mut value);
68069            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
68070            serde_json::to_writer(&mut dst, &value).unwrap();
68071            dst
68072        };
68073        let request_size = request_value_reader
68074            .seek(std::io::SeekFrom::End(0))
68075            .unwrap();
68076        request_value_reader
68077            .seek(std::io::SeekFrom::Start(0))
68078            .unwrap();
68079
68080        loop {
68081            let token = match self
68082                .hub
68083                .auth
68084                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
68085                .await
68086            {
68087                Ok(token) => token,
68088                Err(e) => match dlg.token(e) {
68089                    Ok(token) => token,
68090                    Err(e) => {
68091                        dlg.finished(false);
68092                        return Err(common::Error::MissingToken(e));
68093                    }
68094                },
68095            };
68096            request_value_reader
68097                .seek(std::io::SeekFrom::Start(0))
68098                .unwrap();
68099            let mut req_result = {
68100                let client = &self.hub.client;
68101                dlg.pre_request();
68102                let mut req_builder = hyper::Request::builder()
68103                    .method(hyper::Method::PATCH)
68104                    .uri(url.as_str())
68105                    .header(USER_AGENT, self.hub._user_agent.clone());
68106
68107                if let Some(token) = token.as_ref() {
68108                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
68109                }
68110
68111                let request = req_builder
68112                    .header(CONTENT_TYPE, json_mime_type.to_string())
68113                    .header(CONTENT_LENGTH, request_size as u64)
68114                    .body(common::to_body(
68115                        request_value_reader.get_ref().clone().into(),
68116                    ));
68117
68118                client.request(request.unwrap()).await
68119            };
68120
68121            match req_result {
68122                Err(err) => {
68123                    if let common::Retry::After(d) = dlg.http_error(&err) {
68124                        sleep(d).await;
68125                        continue;
68126                    }
68127                    dlg.finished(false);
68128                    return Err(common::Error::HttpError(err));
68129                }
68130                Ok(res) => {
68131                    let (mut parts, body) = res.into_parts();
68132                    let mut body = common::Body::new(body);
68133                    if !parts.status.is_success() {
68134                        let bytes = common::to_bytes(body).await.unwrap_or_default();
68135                        let error = serde_json::from_str(&common::to_string(&bytes));
68136                        let response = common::to_response(parts, bytes.into());
68137
68138                        if let common::Retry::After(d) =
68139                            dlg.http_failure(&response, error.as_ref().ok())
68140                        {
68141                            sleep(d).await;
68142                            continue;
68143                        }
68144
68145                        dlg.finished(false);
68146
68147                        return Err(match error {
68148                            Ok(value) => common::Error::BadRequest(value),
68149                            _ => common::Error::Failure(response),
68150                        });
68151                    }
68152                    let response = {
68153                        let bytes = common::to_bytes(body).await.unwrap_or_default();
68154                        let encoded = common::to_string(&bytes);
68155                        match serde_json::from_str(&encoded) {
68156                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
68157                            Err(error) => {
68158                                dlg.response_json_decode_error(&encoded, &error);
68159                                return Err(common::Error::JsonDecodeError(
68160                                    encoded.to_string(),
68161                                    error,
68162                                ));
68163                            }
68164                        }
68165                    };
68166
68167                    dlg.finished(true);
68168                    return Ok(response);
68169                }
68170            }
68171        }
68172    }
68173
68174    ///
68175    /// Sets the *request* property to the given value.
68176    ///
68177    /// Even though the property as already been set when instantiating this call,
68178    /// we provide this method for API completeness.
68179    pub fn request(mut self, new_value: RemarketingList) -> RemarketingListPatchCall<'a, C> {
68180        self._request = new_value;
68181        self
68182    }
68183    /// User profile ID associated with this request.
68184    ///
68185    /// Sets the *profile id* path property to the given value.
68186    ///
68187    /// Even though the property as already been set when instantiating this call,
68188    /// we provide this method for API completeness.
68189    pub fn profile_id(mut self, new_value: i64) -> RemarketingListPatchCall<'a, C> {
68190        self._profile_id = new_value;
68191        self
68192    }
68193    /// RemarketingList ID.
68194    ///
68195    /// Sets the *id* query property to the given value.
68196    ///
68197    /// Even though the property as already been set when instantiating this call,
68198    /// we provide this method for API completeness.
68199    pub fn id(mut self, new_value: i64) -> RemarketingListPatchCall<'a, C> {
68200        self._id = new_value;
68201        self
68202    }
68203    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
68204    /// while executing the actual API request.
68205    ///
68206    /// ````text
68207    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
68208    /// ````
68209    ///
68210    /// Sets the *delegate* property to the given value.
68211    pub fn delegate(
68212        mut self,
68213        new_value: &'a mut dyn common::Delegate,
68214    ) -> RemarketingListPatchCall<'a, C> {
68215        self._delegate = Some(new_value);
68216        self
68217    }
68218
68219    /// Set any additional parameter of the query string used in the request.
68220    /// It should be used to set parameters which are not yet available through their own
68221    /// setters.
68222    ///
68223    /// Please note that this method must not be used to set any of the known parameters
68224    /// which have their own setter method. If done anyway, the request will fail.
68225    ///
68226    /// # Additional Parameters
68227    ///
68228    /// * *$.xgafv* (query-string) - V1 error format.
68229    /// * *access_token* (query-string) - OAuth access token.
68230    /// * *alt* (query-string) - Data format for response.
68231    /// * *callback* (query-string) - JSONP
68232    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
68233    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
68234    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
68235    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
68236    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
68237    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
68238    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
68239    pub fn param<T>(mut self, name: T, value: T) -> RemarketingListPatchCall<'a, C>
68240    where
68241        T: AsRef<str>,
68242    {
68243        self._additional_params
68244            .insert(name.as_ref().to_string(), value.as_ref().to_string());
68245        self
68246    }
68247
68248    /// Identifies the authorization scope for the method you are building.
68249    ///
68250    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
68251    /// [`Scope::Dfatrafficking`].
68252    ///
68253    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
68254    /// tokens for more than one scope.
68255    ///
68256    /// Usually there is more than one suitable scope to authorize an operation, some of which may
68257    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
68258    /// sufficient, a read-write scope will do as well.
68259    pub fn add_scope<St>(mut self, scope: St) -> RemarketingListPatchCall<'a, C>
68260    where
68261        St: AsRef<str>,
68262    {
68263        self._scopes.insert(String::from(scope.as_ref()));
68264        self
68265    }
68266    /// Identifies the authorization scope(s) for the method you are building.
68267    ///
68268    /// See [`Self::add_scope()`] for details.
68269    pub fn add_scopes<I, St>(mut self, scopes: I) -> RemarketingListPatchCall<'a, C>
68270    where
68271        I: IntoIterator<Item = St>,
68272        St: AsRef<str>,
68273    {
68274        self._scopes
68275            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
68276        self
68277    }
68278
68279    /// Removes all scopes, and no default scope will be used either.
68280    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
68281    /// for details).
68282    pub fn clear_scopes(mut self) -> RemarketingListPatchCall<'a, C> {
68283        self._scopes.clear();
68284        self
68285    }
68286}
68287
68288/// Updates an existing remarketing list.
68289///
68290/// A builder for the *update* method supported by a *remarketingList* resource.
68291/// It is not used directly, but through a [`RemarketingListMethods`] instance.
68292///
68293/// # Example
68294///
68295/// Instantiate a resource method builder
68296///
68297/// ```test_harness,no_run
68298/// # extern crate hyper;
68299/// # extern crate hyper_rustls;
68300/// # extern crate google_dfareporting3d3 as dfareporting3d3;
68301/// use dfareporting3d3::api::RemarketingList;
68302/// # async fn dox() {
68303/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
68304///
68305/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
68306/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
68307/// #     secret,
68308/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
68309/// # ).build().await.unwrap();
68310///
68311/// # let client = hyper_util::client::legacy::Client::builder(
68312/// #     hyper_util::rt::TokioExecutor::new()
68313/// # )
68314/// # .build(
68315/// #     hyper_rustls::HttpsConnectorBuilder::new()
68316/// #         .with_native_roots()
68317/// #         .unwrap()
68318/// #         .https_or_http()
68319/// #         .enable_http1()
68320/// #         .build()
68321/// # );
68322/// # let mut hub = Dfareporting::new(client, auth);
68323/// // As the method needs a request, you would usually fill it with the desired information
68324/// // into the respective structure. Some of the parts shown here might not be applicable !
68325/// // Values shown here are possibly random and not representative !
68326/// let mut req = RemarketingList::default();
68327///
68328/// // You can configure optional parameters by calling the respective setters at will, and
68329/// // execute the final call using `doit()`.
68330/// // Values shown here are possibly random and not representative !
68331/// let result = hub.remarketing_lists().update(req, -52)
68332///              .doit().await;
68333/// # }
68334/// ```
68335pub struct RemarketingListUpdateCall<'a, C>
68336where
68337    C: 'a,
68338{
68339    hub: &'a Dfareporting<C>,
68340    _request: RemarketingList,
68341    _profile_id: i64,
68342    _delegate: Option<&'a mut dyn common::Delegate>,
68343    _additional_params: HashMap<String, String>,
68344    _scopes: BTreeSet<String>,
68345}
68346
68347impl<'a, C> common::CallBuilder for RemarketingListUpdateCall<'a, C> {}
68348
68349impl<'a, C> RemarketingListUpdateCall<'a, C>
68350where
68351    C: common::Connector,
68352{
68353    /// Perform the operation you have build so far.
68354    pub async fn doit(mut self) -> common::Result<(common::Response, RemarketingList)> {
68355        use std::borrow::Cow;
68356        use std::io::{Read, Seek};
68357
68358        use common::{url::Params, ToParts};
68359        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
68360
68361        let mut dd = common::DefaultDelegate;
68362        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
68363        dlg.begin(common::MethodInfo {
68364            id: "dfareporting.remarketingLists.update",
68365            http_method: hyper::Method::PUT,
68366        });
68367
68368        for &field in ["alt", "profileId"].iter() {
68369            if self._additional_params.contains_key(field) {
68370                dlg.finished(false);
68371                return Err(common::Error::FieldClash(field));
68372            }
68373        }
68374
68375        let mut params = Params::with_capacity(4 + self._additional_params.len());
68376        params.push("profileId", self._profile_id.to_string());
68377
68378        params.extend(self._additional_params.iter());
68379
68380        params.push("alt", "json");
68381        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/remarketingLists";
68382        if self._scopes.is_empty() {
68383            self._scopes
68384                .insert(Scope::Dfatrafficking.as_ref().to_string());
68385        }
68386
68387        #[allow(clippy::single_element_loop)]
68388        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
68389            url = params.uri_replacement(url, param_name, find_this, false);
68390        }
68391        {
68392            let to_remove = ["profileId"];
68393            params.remove_params(&to_remove);
68394        }
68395
68396        let url = params.parse_with_url(&url);
68397
68398        let mut json_mime_type = mime::APPLICATION_JSON;
68399        let mut request_value_reader = {
68400            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
68401            common::remove_json_null_values(&mut value);
68402            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
68403            serde_json::to_writer(&mut dst, &value).unwrap();
68404            dst
68405        };
68406        let request_size = request_value_reader
68407            .seek(std::io::SeekFrom::End(0))
68408            .unwrap();
68409        request_value_reader
68410            .seek(std::io::SeekFrom::Start(0))
68411            .unwrap();
68412
68413        loop {
68414            let token = match self
68415                .hub
68416                .auth
68417                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
68418                .await
68419            {
68420                Ok(token) => token,
68421                Err(e) => match dlg.token(e) {
68422                    Ok(token) => token,
68423                    Err(e) => {
68424                        dlg.finished(false);
68425                        return Err(common::Error::MissingToken(e));
68426                    }
68427                },
68428            };
68429            request_value_reader
68430                .seek(std::io::SeekFrom::Start(0))
68431                .unwrap();
68432            let mut req_result = {
68433                let client = &self.hub.client;
68434                dlg.pre_request();
68435                let mut req_builder = hyper::Request::builder()
68436                    .method(hyper::Method::PUT)
68437                    .uri(url.as_str())
68438                    .header(USER_AGENT, self.hub._user_agent.clone());
68439
68440                if let Some(token) = token.as_ref() {
68441                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
68442                }
68443
68444                let request = req_builder
68445                    .header(CONTENT_TYPE, json_mime_type.to_string())
68446                    .header(CONTENT_LENGTH, request_size as u64)
68447                    .body(common::to_body(
68448                        request_value_reader.get_ref().clone().into(),
68449                    ));
68450
68451                client.request(request.unwrap()).await
68452            };
68453
68454            match req_result {
68455                Err(err) => {
68456                    if let common::Retry::After(d) = dlg.http_error(&err) {
68457                        sleep(d).await;
68458                        continue;
68459                    }
68460                    dlg.finished(false);
68461                    return Err(common::Error::HttpError(err));
68462                }
68463                Ok(res) => {
68464                    let (mut parts, body) = res.into_parts();
68465                    let mut body = common::Body::new(body);
68466                    if !parts.status.is_success() {
68467                        let bytes = common::to_bytes(body).await.unwrap_or_default();
68468                        let error = serde_json::from_str(&common::to_string(&bytes));
68469                        let response = common::to_response(parts, bytes.into());
68470
68471                        if let common::Retry::After(d) =
68472                            dlg.http_failure(&response, error.as_ref().ok())
68473                        {
68474                            sleep(d).await;
68475                            continue;
68476                        }
68477
68478                        dlg.finished(false);
68479
68480                        return Err(match error {
68481                            Ok(value) => common::Error::BadRequest(value),
68482                            _ => common::Error::Failure(response),
68483                        });
68484                    }
68485                    let response = {
68486                        let bytes = common::to_bytes(body).await.unwrap_or_default();
68487                        let encoded = common::to_string(&bytes);
68488                        match serde_json::from_str(&encoded) {
68489                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
68490                            Err(error) => {
68491                                dlg.response_json_decode_error(&encoded, &error);
68492                                return Err(common::Error::JsonDecodeError(
68493                                    encoded.to_string(),
68494                                    error,
68495                                ));
68496                            }
68497                        }
68498                    };
68499
68500                    dlg.finished(true);
68501                    return Ok(response);
68502                }
68503            }
68504        }
68505    }
68506
68507    ///
68508    /// Sets the *request* property to the given value.
68509    ///
68510    /// Even though the property as already been set when instantiating this call,
68511    /// we provide this method for API completeness.
68512    pub fn request(mut self, new_value: RemarketingList) -> RemarketingListUpdateCall<'a, C> {
68513        self._request = new_value;
68514        self
68515    }
68516    /// User profile ID associated with this request.
68517    ///
68518    /// Sets the *profile id* path property to the given value.
68519    ///
68520    /// Even though the property as already been set when instantiating this call,
68521    /// we provide this method for API completeness.
68522    pub fn profile_id(mut self, new_value: i64) -> RemarketingListUpdateCall<'a, C> {
68523        self._profile_id = new_value;
68524        self
68525    }
68526    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
68527    /// while executing the actual API request.
68528    ///
68529    /// ````text
68530    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
68531    /// ````
68532    ///
68533    /// Sets the *delegate* property to the given value.
68534    pub fn delegate(
68535        mut self,
68536        new_value: &'a mut dyn common::Delegate,
68537    ) -> RemarketingListUpdateCall<'a, C> {
68538        self._delegate = Some(new_value);
68539        self
68540    }
68541
68542    /// Set any additional parameter of the query string used in the request.
68543    /// It should be used to set parameters which are not yet available through their own
68544    /// setters.
68545    ///
68546    /// Please note that this method must not be used to set any of the known parameters
68547    /// which have their own setter method. If done anyway, the request will fail.
68548    ///
68549    /// # Additional Parameters
68550    ///
68551    /// * *$.xgafv* (query-string) - V1 error format.
68552    /// * *access_token* (query-string) - OAuth access token.
68553    /// * *alt* (query-string) - Data format for response.
68554    /// * *callback* (query-string) - JSONP
68555    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
68556    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
68557    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
68558    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
68559    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
68560    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
68561    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
68562    pub fn param<T>(mut self, name: T, value: T) -> RemarketingListUpdateCall<'a, C>
68563    where
68564        T: AsRef<str>,
68565    {
68566        self._additional_params
68567            .insert(name.as_ref().to_string(), value.as_ref().to_string());
68568        self
68569    }
68570
68571    /// Identifies the authorization scope for the method you are building.
68572    ///
68573    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
68574    /// [`Scope::Dfatrafficking`].
68575    ///
68576    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
68577    /// tokens for more than one scope.
68578    ///
68579    /// Usually there is more than one suitable scope to authorize an operation, some of which may
68580    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
68581    /// sufficient, a read-write scope will do as well.
68582    pub fn add_scope<St>(mut self, scope: St) -> RemarketingListUpdateCall<'a, C>
68583    where
68584        St: AsRef<str>,
68585    {
68586        self._scopes.insert(String::from(scope.as_ref()));
68587        self
68588    }
68589    /// Identifies the authorization scope(s) for the method you are building.
68590    ///
68591    /// See [`Self::add_scope()`] for details.
68592    pub fn add_scopes<I, St>(mut self, scopes: I) -> RemarketingListUpdateCall<'a, C>
68593    where
68594        I: IntoIterator<Item = St>,
68595        St: AsRef<str>,
68596    {
68597        self._scopes
68598            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
68599        self
68600    }
68601
68602    /// Removes all scopes, and no default scope will be used either.
68603    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
68604    /// for details).
68605    pub fn clear_scopes(mut self) -> RemarketingListUpdateCall<'a, C> {
68606        self._scopes.clear();
68607        self
68608    }
68609}
68610
68611/// Returns the fields that are compatible to be selected in the respective sections of a report criteria, given the fields already selected in the input report and user permissions.
68612///
68613/// A builder for the *compatibleFields.query* method supported by a *report* resource.
68614/// It is not used directly, but through a [`ReportMethods`] instance.
68615///
68616/// # Example
68617///
68618/// Instantiate a resource method builder
68619///
68620/// ```test_harness,no_run
68621/// # extern crate hyper;
68622/// # extern crate hyper_rustls;
68623/// # extern crate google_dfareporting3d3 as dfareporting3d3;
68624/// use dfareporting3d3::api::Report;
68625/// # async fn dox() {
68626/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
68627///
68628/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
68629/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
68630/// #     secret,
68631/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
68632/// # ).build().await.unwrap();
68633///
68634/// # let client = hyper_util::client::legacy::Client::builder(
68635/// #     hyper_util::rt::TokioExecutor::new()
68636/// # )
68637/// # .build(
68638/// #     hyper_rustls::HttpsConnectorBuilder::new()
68639/// #         .with_native_roots()
68640/// #         .unwrap()
68641/// #         .https_or_http()
68642/// #         .enable_http1()
68643/// #         .build()
68644/// # );
68645/// # let mut hub = Dfareporting::new(client, auth);
68646/// // As the method needs a request, you would usually fill it with the desired information
68647/// // into the respective structure. Some of the parts shown here might not be applicable !
68648/// // Values shown here are possibly random and not representative !
68649/// let mut req = Report::default();
68650///
68651/// // You can configure optional parameters by calling the respective setters at will, and
68652/// // execute the final call using `doit()`.
68653/// // Values shown here are possibly random and not representative !
68654/// let result = hub.reports().compatible_fields_query(req, -7)
68655///              .doit().await;
68656/// # }
68657/// ```
68658pub struct ReportCompatibleFieldQueryCall<'a, C>
68659where
68660    C: 'a,
68661{
68662    hub: &'a Dfareporting<C>,
68663    _request: Report,
68664    _profile_id: i64,
68665    _delegate: Option<&'a mut dyn common::Delegate>,
68666    _additional_params: HashMap<String, String>,
68667    _scopes: BTreeSet<String>,
68668}
68669
68670impl<'a, C> common::CallBuilder for ReportCompatibleFieldQueryCall<'a, C> {}
68671
68672impl<'a, C> ReportCompatibleFieldQueryCall<'a, C>
68673where
68674    C: common::Connector,
68675{
68676    /// Perform the operation you have build so far.
68677    pub async fn doit(mut self) -> common::Result<(common::Response, CompatibleFields)> {
68678        use std::borrow::Cow;
68679        use std::io::{Read, Seek};
68680
68681        use common::{url::Params, ToParts};
68682        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
68683
68684        let mut dd = common::DefaultDelegate;
68685        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
68686        dlg.begin(common::MethodInfo {
68687            id: "dfareporting.reports.compatibleFields.query",
68688            http_method: hyper::Method::POST,
68689        });
68690
68691        for &field in ["alt", "profileId"].iter() {
68692            if self._additional_params.contains_key(field) {
68693                dlg.finished(false);
68694                return Err(common::Error::FieldClash(field));
68695            }
68696        }
68697
68698        let mut params = Params::with_capacity(4 + self._additional_params.len());
68699        params.push("profileId", self._profile_id.to_string());
68700
68701        params.extend(self._additional_params.iter());
68702
68703        params.push("alt", "json");
68704        let mut url =
68705            self.hub._base_url.clone() + "userprofiles/{profileId}/reports/compatiblefields/query";
68706        if self._scopes.is_empty() {
68707            self._scopes.insert(Scope::Full.as_ref().to_string());
68708        }
68709
68710        #[allow(clippy::single_element_loop)]
68711        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
68712            url = params.uri_replacement(url, param_name, find_this, false);
68713        }
68714        {
68715            let to_remove = ["profileId"];
68716            params.remove_params(&to_remove);
68717        }
68718
68719        let url = params.parse_with_url(&url);
68720
68721        let mut json_mime_type = mime::APPLICATION_JSON;
68722        let mut request_value_reader = {
68723            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
68724            common::remove_json_null_values(&mut value);
68725            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
68726            serde_json::to_writer(&mut dst, &value).unwrap();
68727            dst
68728        };
68729        let request_size = request_value_reader
68730            .seek(std::io::SeekFrom::End(0))
68731            .unwrap();
68732        request_value_reader
68733            .seek(std::io::SeekFrom::Start(0))
68734            .unwrap();
68735
68736        loop {
68737            let token = match self
68738                .hub
68739                .auth
68740                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
68741                .await
68742            {
68743                Ok(token) => token,
68744                Err(e) => match dlg.token(e) {
68745                    Ok(token) => token,
68746                    Err(e) => {
68747                        dlg.finished(false);
68748                        return Err(common::Error::MissingToken(e));
68749                    }
68750                },
68751            };
68752            request_value_reader
68753                .seek(std::io::SeekFrom::Start(0))
68754                .unwrap();
68755            let mut req_result = {
68756                let client = &self.hub.client;
68757                dlg.pre_request();
68758                let mut req_builder = hyper::Request::builder()
68759                    .method(hyper::Method::POST)
68760                    .uri(url.as_str())
68761                    .header(USER_AGENT, self.hub._user_agent.clone());
68762
68763                if let Some(token) = token.as_ref() {
68764                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
68765                }
68766
68767                let request = req_builder
68768                    .header(CONTENT_TYPE, json_mime_type.to_string())
68769                    .header(CONTENT_LENGTH, request_size as u64)
68770                    .body(common::to_body(
68771                        request_value_reader.get_ref().clone().into(),
68772                    ));
68773
68774                client.request(request.unwrap()).await
68775            };
68776
68777            match req_result {
68778                Err(err) => {
68779                    if let common::Retry::After(d) = dlg.http_error(&err) {
68780                        sleep(d).await;
68781                        continue;
68782                    }
68783                    dlg.finished(false);
68784                    return Err(common::Error::HttpError(err));
68785                }
68786                Ok(res) => {
68787                    let (mut parts, body) = res.into_parts();
68788                    let mut body = common::Body::new(body);
68789                    if !parts.status.is_success() {
68790                        let bytes = common::to_bytes(body).await.unwrap_or_default();
68791                        let error = serde_json::from_str(&common::to_string(&bytes));
68792                        let response = common::to_response(parts, bytes.into());
68793
68794                        if let common::Retry::After(d) =
68795                            dlg.http_failure(&response, error.as_ref().ok())
68796                        {
68797                            sleep(d).await;
68798                            continue;
68799                        }
68800
68801                        dlg.finished(false);
68802
68803                        return Err(match error {
68804                            Ok(value) => common::Error::BadRequest(value),
68805                            _ => common::Error::Failure(response),
68806                        });
68807                    }
68808                    let response = {
68809                        let bytes = common::to_bytes(body).await.unwrap_or_default();
68810                        let encoded = common::to_string(&bytes);
68811                        match serde_json::from_str(&encoded) {
68812                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
68813                            Err(error) => {
68814                                dlg.response_json_decode_error(&encoded, &error);
68815                                return Err(common::Error::JsonDecodeError(
68816                                    encoded.to_string(),
68817                                    error,
68818                                ));
68819                            }
68820                        }
68821                    };
68822
68823                    dlg.finished(true);
68824                    return Ok(response);
68825                }
68826            }
68827        }
68828    }
68829
68830    ///
68831    /// Sets the *request* property to the given value.
68832    ///
68833    /// Even though the property as already been set when instantiating this call,
68834    /// we provide this method for API completeness.
68835    pub fn request(mut self, new_value: Report) -> ReportCompatibleFieldQueryCall<'a, C> {
68836        self._request = new_value;
68837        self
68838    }
68839    /// The Campaign Manager 360 user profile ID.
68840    ///
68841    /// Sets the *profile id* path property to the given value.
68842    ///
68843    /// Even though the property as already been set when instantiating this call,
68844    /// we provide this method for API completeness.
68845    pub fn profile_id(mut self, new_value: i64) -> ReportCompatibleFieldQueryCall<'a, C> {
68846        self._profile_id = new_value;
68847        self
68848    }
68849    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
68850    /// while executing the actual API request.
68851    ///
68852    /// ````text
68853    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
68854    /// ````
68855    ///
68856    /// Sets the *delegate* property to the given value.
68857    pub fn delegate(
68858        mut self,
68859        new_value: &'a mut dyn common::Delegate,
68860    ) -> ReportCompatibleFieldQueryCall<'a, C> {
68861        self._delegate = Some(new_value);
68862        self
68863    }
68864
68865    /// Set any additional parameter of the query string used in the request.
68866    /// It should be used to set parameters which are not yet available through their own
68867    /// setters.
68868    ///
68869    /// Please note that this method must not be used to set any of the known parameters
68870    /// which have their own setter method. If done anyway, the request will fail.
68871    ///
68872    /// # Additional Parameters
68873    ///
68874    /// * *$.xgafv* (query-string) - V1 error format.
68875    /// * *access_token* (query-string) - OAuth access token.
68876    /// * *alt* (query-string) - Data format for response.
68877    /// * *callback* (query-string) - JSONP
68878    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
68879    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
68880    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
68881    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
68882    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
68883    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
68884    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
68885    pub fn param<T>(mut self, name: T, value: T) -> ReportCompatibleFieldQueryCall<'a, C>
68886    where
68887        T: AsRef<str>,
68888    {
68889        self._additional_params
68890            .insert(name.as_ref().to_string(), value.as_ref().to_string());
68891        self
68892    }
68893
68894    /// Identifies the authorization scope for the method you are building.
68895    ///
68896    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
68897    /// [`Scope::Full`].
68898    ///
68899    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
68900    /// tokens for more than one scope.
68901    ///
68902    /// Usually there is more than one suitable scope to authorize an operation, some of which may
68903    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
68904    /// sufficient, a read-write scope will do as well.
68905    pub fn add_scope<St>(mut self, scope: St) -> ReportCompatibleFieldQueryCall<'a, C>
68906    where
68907        St: AsRef<str>,
68908    {
68909        self._scopes.insert(String::from(scope.as_ref()));
68910        self
68911    }
68912    /// Identifies the authorization scope(s) for the method you are building.
68913    ///
68914    /// See [`Self::add_scope()`] for details.
68915    pub fn add_scopes<I, St>(mut self, scopes: I) -> ReportCompatibleFieldQueryCall<'a, C>
68916    where
68917        I: IntoIterator<Item = St>,
68918        St: AsRef<str>,
68919    {
68920        self._scopes
68921            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
68922        self
68923    }
68924
68925    /// Removes all scopes, and no default scope will be used either.
68926    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
68927    /// for details).
68928    pub fn clear_scopes(mut self) -> ReportCompatibleFieldQueryCall<'a, C> {
68929        self._scopes.clear();
68930        self
68931    }
68932}
68933
68934/// Retrieves a report file by its report ID and file ID. This method supports media download.
68935///
68936/// This method supports **media download**. To enable it, adjust the builder like this:
68937/// `.param("alt", "media")`.
68938/// Please note that due to missing multi-part support on the server side, you will only receive the media,
68939/// but not the `File` structure that you would usually get. The latter will be a default value.
68940///
68941/// A builder for the *files.get* method supported by a *report* resource.
68942/// It is not used directly, but through a [`ReportMethods`] instance.
68943///
68944/// # Example
68945///
68946/// Instantiate a resource method builder
68947///
68948/// ```test_harness,no_run
68949/// # extern crate hyper;
68950/// # extern crate hyper_rustls;
68951/// # extern crate google_dfareporting3d3 as dfareporting3d3;
68952/// # async fn dox() {
68953/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
68954///
68955/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
68956/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
68957/// #     secret,
68958/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
68959/// # ).build().await.unwrap();
68960///
68961/// # let client = hyper_util::client::legacy::Client::builder(
68962/// #     hyper_util::rt::TokioExecutor::new()
68963/// # )
68964/// # .build(
68965/// #     hyper_rustls::HttpsConnectorBuilder::new()
68966/// #         .with_native_roots()
68967/// #         .unwrap()
68968/// #         .https_or_http()
68969/// #         .enable_http1()
68970/// #         .build()
68971/// # );
68972/// # let mut hub = Dfareporting::new(client, auth);
68973/// // You can configure optional parameters by calling the respective setters at will, and
68974/// // execute the final call using `doit()`.
68975/// // Values shown here are possibly random and not representative !
68976/// let result = hub.reports().files_get(-62, -75, -34)
68977///              .doit().await;
68978/// # }
68979/// ```
68980pub struct ReportFileGetCall<'a, C>
68981where
68982    C: 'a,
68983{
68984    hub: &'a Dfareporting<C>,
68985    _profile_id: i64,
68986    _report_id: i64,
68987    _file_id: i64,
68988    _delegate: Option<&'a mut dyn common::Delegate>,
68989    _additional_params: HashMap<String, String>,
68990    _scopes: BTreeSet<String>,
68991}
68992
68993impl<'a, C> common::CallBuilder for ReportFileGetCall<'a, C> {}
68994
68995impl<'a, C> ReportFileGetCall<'a, C>
68996where
68997    C: common::Connector,
68998{
68999    /// Perform the operation you have build so far.
69000    pub async fn doit(mut self) -> common::Result<(common::Response, File)> {
69001        use std::borrow::Cow;
69002        use std::io::{Read, Seek};
69003
69004        use common::{url::Params, ToParts};
69005        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
69006
69007        let mut dd = common::DefaultDelegate;
69008        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
69009        dlg.begin(common::MethodInfo {
69010            id: "dfareporting.reports.files.get",
69011            http_method: hyper::Method::GET,
69012        });
69013
69014        for &field in ["profileId", "reportId", "fileId"].iter() {
69015            if self._additional_params.contains_key(field) {
69016                dlg.finished(false);
69017                return Err(common::Error::FieldClash(field));
69018            }
69019        }
69020
69021        let mut params = Params::with_capacity(4 + self._additional_params.len());
69022        params.push("profileId", self._profile_id.to_string());
69023        params.push("reportId", self._report_id.to_string());
69024        params.push("fileId", self._file_id.to_string());
69025
69026        params.extend(self._additional_params.iter());
69027
69028        let (alt_field_missing, enable_resource_parsing) = {
69029            if let Some(value) = params.get("alt") {
69030                (false, value == "json")
69031            } else {
69032                (true, true)
69033            }
69034        };
69035        if alt_field_missing {
69036            params.push("alt", "json");
69037        }
69038        let mut url = self.hub._base_url.clone()
69039            + "userprofiles/{profileId}/reports/{reportId}/files/{fileId}";
69040        if self._scopes.is_empty() {
69041            self._scopes.insert(Scope::Full.as_ref().to_string());
69042        }
69043
69044        #[allow(clippy::single_element_loop)]
69045        for &(find_this, param_name) in [
69046            ("{profileId}", "profileId"),
69047            ("{reportId}", "reportId"),
69048            ("{fileId}", "fileId"),
69049        ]
69050        .iter()
69051        {
69052            url = params.uri_replacement(url, param_name, find_this, false);
69053        }
69054        {
69055            let to_remove = ["fileId", "reportId", "profileId"];
69056            params.remove_params(&to_remove);
69057        }
69058
69059        let url = params.parse_with_url(&url);
69060
69061        loop {
69062            let token = match self
69063                .hub
69064                .auth
69065                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
69066                .await
69067            {
69068                Ok(token) => token,
69069                Err(e) => match dlg.token(e) {
69070                    Ok(token) => token,
69071                    Err(e) => {
69072                        dlg.finished(false);
69073                        return Err(common::Error::MissingToken(e));
69074                    }
69075                },
69076            };
69077            let mut req_result = {
69078                let client = &self.hub.client;
69079                dlg.pre_request();
69080                let mut req_builder = hyper::Request::builder()
69081                    .method(hyper::Method::GET)
69082                    .uri(url.as_str())
69083                    .header(USER_AGENT, self.hub._user_agent.clone());
69084
69085                if let Some(token) = token.as_ref() {
69086                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
69087                }
69088
69089                let request = req_builder
69090                    .header(CONTENT_LENGTH, 0_u64)
69091                    .body(common::to_body::<String>(None));
69092
69093                client.request(request.unwrap()).await
69094            };
69095
69096            match req_result {
69097                Err(err) => {
69098                    if let common::Retry::After(d) = dlg.http_error(&err) {
69099                        sleep(d).await;
69100                        continue;
69101                    }
69102                    dlg.finished(false);
69103                    return Err(common::Error::HttpError(err));
69104                }
69105                Ok(res) => {
69106                    let (mut parts, body) = res.into_parts();
69107                    let mut body = common::Body::new(body);
69108                    if !parts.status.is_success() {
69109                        let bytes = common::to_bytes(body).await.unwrap_or_default();
69110                        let error = serde_json::from_str(&common::to_string(&bytes));
69111                        let response = common::to_response(parts, bytes.into());
69112
69113                        if let common::Retry::After(d) =
69114                            dlg.http_failure(&response, error.as_ref().ok())
69115                        {
69116                            sleep(d).await;
69117                            continue;
69118                        }
69119
69120                        dlg.finished(false);
69121
69122                        return Err(match error {
69123                            Ok(value) => common::Error::BadRequest(value),
69124                            _ => common::Error::Failure(response),
69125                        });
69126                    }
69127                    let response = if enable_resource_parsing {
69128                        let bytes = common::to_bytes(body).await.unwrap_or_default();
69129                        let encoded = common::to_string(&bytes);
69130                        match serde_json::from_str(&encoded) {
69131                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
69132                            Err(error) => {
69133                                dlg.response_json_decode_error(&encoded, &error);
69134                                return Err(common::Error::JsonDecodeError(
69135                                    encoded.to_string(),
69136                                    error,
69137                                ));
69138                            }
69139                        }
69140                    } else {
69141                        (
69142                            common::Response::from_parts(parts, body),
69143                            Default::default(),
69144                        )
69145                    };
69146
69147                    dlg.finished(true);
69148                    return Ok(response);
69149                }
69150            }
69151        }
69152    }
69153
69154    /// The Campaign Manager 360 user profile ID.
69155    ///
69156    /// Sets the *profile id* path property to the given value.
69157    ///
69158    /// Even though the property as already been set when instantiating this call,
69159    /// we provide this method for API completeness.
69160    pub fn profile_id(mut self, new_value: i64) -> ReportFileGetCall<'a, C> {
69161        self._profile_id = new_value;
69162        self
69163    }
69164    /// The ID of the report.
69165    ///
69166    /// Sets the *report id* path property to the given value.
69167    ///
69168    /// Even though the property as already been set when instantiating this call,
69169    /// we provide this method for API completeness.
69170    pub fn report_id(mut self, new_value: i64) -> ReportFileGetCall<'a, C> {
69171        self._report_id = new_value;
69172        self
69173    }
69174    /// The ID of the report file.
69175    ///
69176    /// Sets the *file id* path property to the given value.
69177    ///
69178    /// Even though the property as already been set when instantiating this call,
69179    /// we provide this method for API completeness.
69180    pub fn file_id(mut self, new_value: i64) -> ReportFileGetCall<'a, C> {
69181        self._file_id = new_value;
69182        self
69183    }
69184    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
69185    /// while executing the actual API request.
69186    ///
69187    /// ````text
69188    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
69189    /// ````
69190    ///
69191    /// Sets the *delegate* property to the given value.
69192    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ReportFileGetCall<'a, C> {
69193        self._delegate = Some(new_value);
69194        self
69195    }
69196
69197    /// Set any additional parameter of the query string used in the request.
69198    /// It should be used to set parameters which are not yet available through their own
69199    /// setters.
69200    ///
69201    /// Please note that this method must not be used to set any of the known parameters
69202    /// which have their own setter method. If done anyway, the request will fail.
69203    ///
69204    /// # Additional Parameters
69205    ///
69206    /// * *$.xgafv* (query-string) - V1 error format.
69207    /// * *access_token* (query-string) - OAuth access token.
69208    /// * *alt* (query-string) - Data format for response.
69209    /// * *callback* (query-string) - JSONP
69210    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
69211    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
69212    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
69213    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
69214    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
69215    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
69216    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
69217    pub fn param<T>(mut self, name: T, value: T) -> ReportFileGetCall<'a, C>
69218    where
69219        T: AsRef<str>,
69220    {
69221        self._additional_params
69222            .insert(name.as_ref().to_string(), value.as_ref().to_string());
69223        self
69224    }
69225
69226    /// Identifies the authorization scope for the method you are building.
69227    ///
69228    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
69229    /// [`Scope::Full`].
69230    ///
69231    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
69232    /// tokens for more than one scope.
69233    ///
69234    /// Usually there is more than one suitable scope to authorize an operation, some of which may
69235    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
69236    /// sufficient, a read-write scope will do as well.
69237    pub fn add_scope<St>(mut self, scope: St) -> ReportFileGetCall<'a, C>
69238    where
69239        St: AsRef<str>,
69240    {
69241        self._scopes.insert(String::from(scope.as_ref()));
69242        self
69243    }
69244    /// Identifies the authorization scope(s) for the method you are building.
69245    ///
69246    /// See [`Self::add_scope()`] for details.
69247    pub fn add_scopes<I, St>(mut self, scopes: I) -> ReportFileGetCall<'a, C>
69248    where
69249        I: IntoIterator<Item = St>,
69250        St: AsRef<str>,
69251    {
69252        self._scopes
69253            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
69254        self
69255    }
69256
69257    /// Removes all scopes, and no default scope will be used either.
69258    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
69259    /// for details).
69260    pub fn clear_scopes(mut self) -> ReportFileGetCall<'a, C> {
69261        self._scopes.clear();
69262        self
69263    }
69264}
69265
69266/// Lists files for a report.
69267///
69268/// A builder for the *files.list* method supported by a *report* resource.
69269/// It is not used directly, but through a [`ReportMethods`] instance.
69270///
69271/// # Example
69272///
69273/// Instantiate a resource method builder
69274///
69275/// ```test_harness,no_run
69276/// # extern crate hyper;
69277/// # extern crate hyper_rustls;
69278/// # extern crate google_dfareporting3d3 as dfareporting3d3;
69279/// # async fn dox() {
69280/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
69281///
69282/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
69283/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
69284/// #     secret,
69285/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
69286/// # ).build().await.unwrap();
69287///
69288/// # let client = hyper_util::client::legacy::Client::builder(
69289/// #     hyper_util::rt::TokioExecutor::new()
69290/// # )
69291/// # .build(
69292/// #     hyper_rustls::HttpsConnectorBuilder::new()
69293/// #         .with_native_roots()
69294/// #         .unwrap()
69295/// #         .https_or_http()
69296/// #         .enable_http1()
69297/// #         .build()
69298/// # );
69299/// # let mut hub = Dfareporting::new(client, auth);
69300/// // You can configure optional parameters by calling the respective setters at will, and
69301/// // execute the final call using `doit()`.
69302/// // Values shown here are possibly random and not representative !
69303/// let result = hub.reports().files_list(-39, -15)
69304///              .sort_order("accusam")
69305///              .sort_field("et")
69306///              .page_token("dolor")
69307///              .max_results(-29)
69308///              .doit().await;
69309/// # }
69310/// ```
69311pub struct ReportFileListCall<'a, C>
69312where
69313    C: 'a,
69314{
69315    hub: &'a Dfareporting<C>,
69316    _profile_id: i64,
69317    _report_id: i64,
69318    _sort_order: Option<String>,
69319    _sort_field: Option<String>,
69320    _page_token: Option<String>,
69321    _max_results: Option<i32>,
69322    _delegate: Option<&'a mut dyn common::Delegate>,
69323    _additional_params: HashMap<String, String>,
69324    _scopes: BTreeSet<String>,
69325}
69326
69327impl<'a, C> common::CallBuilder for ReportFileListCall<'a, C> {}
69328
69329impl<'a, C> ReportFileListCall<'a, C>
69330where
69331    C: common::Connector,
69332{
69333    /// Perform the operation you have build so far.
69334    pub async fn doit(mut self) -> common::Result<(common::Response, FileList)> {
69335        use std::borrow::Cow;
69336        use std::io::{Read, Seek};
69337
69338        use common::{url::Params, ToParts};
69339        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
69340
69341        let mut dd = common::DefaultDelegate;
69342        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
69343        dlg.begin(common::MethodInfo {
69344            id: "dfareporting.reports.files.list",
69345            http_method: hyper::Method::GET,
69346        });
69347
69348        for &field in [
69349            "alt",
69350            "profileId",
69351            "reportId",
69352            "sortOrder",
69353            "sortField",
69354            "pageToken",
69355            "maxResults",
69356        ]
69357        .iter()
69358        {
69359            if self._additional_params.contains_key(field) {
69360                dlg.finished(false);
69361                return Err(common::Error::FieldClash(field));
69362            }
69363        }
69364
69365        let mut params = Params::with_capacity(8 + self._additional_params.len());
69366        params.push("profileId", self._profile_id.to_string());
69367        params.push("reportId", self._report_id.to_string());
69368        if let Some(value) = self._sort_order.as_ref() {
69369            params.push("sortOrder", value);
69370        }
69371        if let Some(value) = self._sort_field.as_ref() {
69372            params.push("sortField", value);
69373        }
69374        if let Some(value) = self._page_token.as_ref() {
69375            params.push("pageToken", value);
69376        }
69377        if let Some(value) = self._max_results.as_ref() {
69378            params.push("maxResults", value.to_string());
69379        }
69380
69381        params.extend(self._additional_params.iter());
69382
69383        params.push("alt", "json");
69384        let mut url =
69385            self.hub._base_url.clone() + "userprofiles/{profileId}/reports/{reportId}/files";
69386        if self._scopes.is_empty() {
69387            self._scopes.insert(Scope::Full.as_ref().to_string());
69388        }
69389
69390        #[allow(clippy::single_element_loop)]
69391        for &(find_this, param_name) in
69392            [("{profileId}", "profileId"), ("{reportId}", "reportId")].iter()
69393        {
69394            url = params.uri_replacement(url, param_name, find_this, false);
69395        }
69396        {
69397            let to_remove = ["reportId", "profileId"];
69398            params.remove_params(&to_remove);
69399        }
69400
69401        let url = params.parse_with_url(&url);
69402
69403        loop {
69404            let token = match self
69405                .hub
69406                .auth
69407                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
69408                .await
69409            {
69410                Ok(token) => token,
69411                Err(e) => match dlg.token(e) {
69412                    Ok(token) => token,
69413                    Err(e) => {
69414                        dlg.finished(false);
69415                        return Err(common::Error::MissingToken(e));
69416                    }
69417                },
69418            };
69419            let mut req_result = {
69420                let client = &self.hub.client;
69421                dlg.pre_request();
69422                let mut req_builder = hyper::Request::builder()
69423                    .method(hyper::Method::GET)
69424                    .uri(url.as_str())
69425                    .header(USER_AGENT, self.hub._user_agent.clone());
69426
69427                if let Some(token) = token.as_ref() {
69428                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
69429                }
69430
69431                let request = req_builder
69432                    .header(CONTENT_LENGTH, 0_u64)
69433                    .body(common::to_body::<String>(None));
69434
69435                client.request(request.unwrap()).await
69436            };
69437
69438            match req_result {
69439                Err(err) => {
69440                    if let common::Retry::After(d) = dlg.http_error(&err) {
69441                        sleep(d).await;
69442                        continue;
69443                    }
69444                    dlg.finished(false);
69445                    return Err(common::Error::HttpError(err));
69446                }
69447                Ok(res) => {
69448                    let (mut parts, body) = res.into_parts();
69449                    let mut body = common::Body::new(body);
69450                    if !parts.status.is_success() {
69451                        let bytes = common::to_bytes(body).await.unwrap_or_default();
69452                        let error = serde_json::from_str(&common::to_string(&bytes));
69453                        let response = common::to_response(parts, bytes.into());
69454
69455                        if let common::Retry::After(d) =
69456                            dlg.http_failure(&response, error.as_ref().ok())
69457                        {
69458                            sleep(d).await;
69459                            continue;
69460                        }
69461
69462                        dlg.finished(false);
69463
69464                        return Err(match error {
69465                            Ok(value) => common::Error::BadRequest(value),
69466                            _ => common::Error::Failure(response),
69467                        });
69468                    }
69469                    let response = {
69470                        let bytes = common::to_bytes(body).await.unwrap_or_default();
69471                        let encoded = common::to_string(&bytes);
69472                        match serde_json::from_str(&encoded) {
69473                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
69474                            Err(error) => {
69475                                dlg.response_json_decode_error(&encoded, &error);
69476                                return Err(common::Error::JsonDecodeError(
69477                                    encoded.to_string(),
69478                                    error,
69479                                ));
69480                            }
69481                        }
69482                    };
69483
69484                    dlg.finished(true);
69485                    return Ok(response);
69486                }
69487            }
69488        }
69489    }
69490
69491    /// The Campaign Manager 360 user profile ID.
69492    ///
69493    /// Sets the *profile id* path property to the given value.
69494    ///
69495    /// Even though the property as already been set when instantiating this call,
69496    /// we provide this method for API completeness.
69497    pub fn profile_id(mut self, new_value: i64) -> ReportFileListCall<'a, C> {
69498        self._profile_id = new_value;
69499        self
69500    }
69501    /// The ID of the parent report.
69502    ///
69503    /// Sets the *report id* path property to the given value.
69504    ///
69505    /// Even though the property as already been set when instantiating this call,
69506    /// we provide this method for API completeness.
69507    pub fn report_id(mut self, new_value: i64) -> ReportFileListCall<'a, C> {
69508        self._report_id = new_value;
69509        self
69510    }
69511    /// Order of sorted results.
69512    ///
69513    /// Sets the *sort order* query property to the given value.
69514    pub fn sort_order(mut self, new_value: &str) -> ReportFileListCall<'a, C> {
69515        self._sort_order = Some(new_value.to_string());
69516        self
69517    }
69518    /// The field by which to sort the list.
69519    ///
69520    /// Sets the *sort field* query property to the given value.
69521    pub fn sort_field(mut self, new_value: &str) -> ReportFileListCall<'a, C> {
69522        self._sort_field = Some(new_value.to_string());
69523        self
69524    }
69525    /// The value of the nextToken from the previous result page.
69526    ///
69527    /// Sets the *page token* query property to the given value.
69528    pub fn page_token(mut self, new_value: &str) -> ReportFileListCall<'a, C> {
69529        self._page_token = Some(new_value.to_string());
69530        self
69531    }
69532    /// Maximum number of results to return.
69533    ///
69534    /// Sets the *max results* query property to the given value.
69535    pub fn max_results(mut self, new_value: i32) -> ReportFileListCall<'a, C> {
69536        self._max_results = Some(new_value);
69537        self
69538    }
69539    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
69540    /// while executing the actual API request.
69541    ///
69542    /// ````text
69543    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
69544    /// ````
69545    ///
69546    /// Sets the *delegate* property to the given value.
69547    pub fn delegate(
69548        mut self,
69549        new_value: &'a mut dyn common::Delegate,
69550    ) -> ReportFileListCall<'a, C> {
69551        self._delegate = Some(new_value);
69552        self
69553    }
69554
69555    /// Set any additional parameter of the query string used in the request.
69556    /// It should be used to set parameters which are not yet available through their own
69557    /// setters.
69558    ///
69559    /// Please note that this method must not be used to set any of the known parameters
69560    /// which have their own setter method. If done anyway, the request will fail.
69561    ///
69562    /// # Additional Parameters
69563    ///
69564    /// * *$.xgafv* (query-string) - V1 error format.
69565    /// * *access_token* (query-string) - OAuth access token.
69566    /// * *alt* (query-string) - Data format for response.
69567    /// * *callback* (query-string) - JSONP
69568    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
69569    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
69570    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
69571    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
69572    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
69573    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
69574    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
69575    pub fn param<T>(mut self, name: T, value: T) -> ReportFileListCall<'a, C>
69576    where
69577        T: AsRef<str>,
69578    {
69579        self._additional_params
69580            .insert(name.as_ref().to_string(), value.as_ref().to_string());
69581        self
69582    }
69583
69584    /// Identifies the authorization scope for the method you are building.
69585    ///
69586    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
69587    /// [`Scope::Full`].
69588    ///
69589    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
69590    /// tokens for more than one scope.
69591    ///
69592    /// Usually there is more than one suitable scope to authorize an operation, some of which may
69593    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
69594    /// sufficient, a read-write scope will do as well.
69595    pub fn add_scope<St>(mut self, scope: St) -> ReportFileListCall<'a, C>
69596    where
69597        St: AsRef<str>,
69598    {
69599        self._scopes.insert(String::from(scope.as_ref()));
69600        self
69601    }
69602    /// Identifies the authorization scope(s) for the method you are building.
69603    ///
69604    /// See [`Self::add_scope()`] for details.
69605    pub fn add_scopes<I, St>(mut self, scopes: I) -> ReportFileListCall<'a, C>
69606    where
69607        I: IntoIterator<Item = St>,
69608        St: AsRef<str>,
69609    {
69610        self._scopes
69611            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
69612        self
69613    }
69614
69615    /// Removes all scopes, and no default scope will be used either.
69616    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
69617    /// for details).
69618    pub fn clear_scopes(mut self) -> ReportFileListCall<'a, C> {
69619        self._scopes.clear();
69620        self
69621    }
69622}
69623
69624/// Deletes a report by its ID.
69625///
69626/// A builder for the *delete* method supported by a *report* resource.
69627/// It is not used directly, but through a [`ReportMethods`] instance.
69628///
69629/// # Example
69630///
69631/// Instantiate a resource method builder
69632///
69633/// ```test_harness,no_run
69634/// # extern crate hyper;
69635/// # extern crate hyper_rustls;
69636/// # extern crate google_dfareporting3d3 as dfareporting3d3;
69637/// # async fn dox() {
69638/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
69639///
69640/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
69641/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
69642/// #     secret,
69643/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
69644/// # ).build().await.unwrap();
69645///
69646/// # let client = hyper_util::client::legacy::Client::builder(
69647/// #     hyper_util::rt::TokioExecutor::new()
69648/// # )
69649/// # .build(
69650/// #     hyper_rustls::HttpsConnectorBuilder::new()
69651/// #         .with_native_roots()
69652/// #         .unwrap()
69653/// #         .https_or_http()
69654/// #         .enable_http1()
69655/// #         .build()
69656/// # );
69657/// # let mut hub = Dfareporting::new(client, auth);
69658/// // You can configure optional parameters by calling the respective setters at will, and
69659/// // execute the final call using `doit()`.
69660/// // Values shown here are possibly random and not representative !
69661/// let result = hub.reports().delete(-44, -10)
69662///              .doit().await;
69663/// # }
69664/// ```
69665pub struct ReportDeleteCall<'a, C>
69666where
69667    C: 'a,
69668{
69669    hub: &'a Dfareporting<C>,
69670    _profile_id: i64,
69671    _report_id: i64,
69672    _delegate: Option<&'a mut dyn common::Delegate>,
69673    _additional_params: HashMap<String, String>,
69674    _scopes: BTreeSet<String>,
69675}
69676
69677impl<'a, C> common::CallBuilder for ReportDeleteCall<'a, C> {}
69678
69679impl<'a, C> ReportDeleteCall<'a, C>
69680where
69681    C: common::Connector,
69682{
69683    /// Perform the operation you have build so far.
69684    pub async fn doit(mut self) -> common::Result<common::Response> {
69685        use std::borrow::Cow;
69686        use std::io::{Read, Seek};
69687
69688        use common::{url::Params, ToParts};
69689        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
69690
69691        let mut dd = common::DefaultDelegate;
69692        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
69693        dlg.begin(common::MethodInfo {
69694            id: "dfareporting.reports.delete",
69695            http_method: hyper::Method::DELETE,
69696        });
69697
69698        for &field in ["profileId", "reportId"].iter() {
69699            if self._additional_params.contains_key(field) {
69700                dlg.finished(false);
69701                return Err(common::Error::FieldClash(field));
69702            }
69703        }
69704
69705        let mut params = Params::with_capacity(3 + self._additional_params.len());
69706        params.push("profileId", self._profile_id.to_string());
69707        params.push("reportId", self._report_id.to_string());
69708
69709        params.extend(self._additional_params.iter());
69710
69711        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/reports/{reportId}";
69712        if self._scopes.is_empty() {
69713            self._scopes.insert(Scope::Full.as_ref().to_string());
69714        }
69715
69716        #[allow(clippy::single_element_loop)]
69717        for &(find_this, param_name) in
69718            [("{profileId}", "profileId"), ("{reportId}", "reportId")].iter()
69719        {
69720            url = params.uri_replacement(url, param_name, find_this, false);
69721        }
69722        {
69723            let to_remove = ["reportId", "profileId"];
69724            params.remove_params(&to_remove);
69725        }
69726
69727        let url = params.parse_with_url(&url);
69728
69729        loop {
69730            let token = match self
69731                .hub
69732                .auth
69733                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
69734                .await
69735            {
69736                Ok(token) => token,
69737                Err(e) => match dlg.token(e) {
69738                    Ok(token) => token,
69739                    Err(e) => {
69740                        dlg.finished(false);
69741                        return Err(common::Error::MissingToken(e));
69742                    }
69743                },
69744            };
69745            let mut req_result = {
69746                let client = &self.hub.client;
69747                dlg.pre_request();
69748                let mut req_builder = hyper::Request::builder()
69749                    .method(hyper::Method::DELETE)
69750                    .uri(url.as_str())
69751                    .header(USER_AGENT, self.hub._user_agent.clone());
69752
69753                if let Some(token) = token.as_ref() {
69754                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
69755                }
69756
69757                let request = req_builder
69758                    .header(CONTENT_LENGTH, 0_u64)
69759                    .body(common::to_body::<String>(None));
69760
69761                client.request(request.unwrap()).await
69762            };
69763
69764            match req_result {
69765                Err(err) => {
69766                    if let common::Retry::After(d) = dlg.http_error(&err) {
69767                        sleep(d).await;
69768                        continue;
69769                    }
69770                    dlg.finished(false);
69771                    return Err(common::Error::HttpError(err));
69772                }
69773                Ok(res) => {
69774                    let (mut parts, body) = res.into_parts();
69775                    let mut body = common::Body::new(body);
69776                    if !parts.status.is_success() {
69777                        let bytes = common::to_bytes(body).await.unwrap_or_default();
69778                        let error = serde_json::from_str(&common::to_string(&bytes));
69779                        let response = common::to_response(parts, bytes.into());
69780
69781                        if let common::Retry::After(d) =
69782                            dlg.http_failure(&response, error.as_ref().ok())
69783                        {
69784                            sleep(d).await;
69785                            continue;
69786                        }
69787
69788                        dlg.finished(false);
69789
69790                        return Err(match error {
69791                            Ok(value) => common::Error::BadRequest(value),
69792                            _ => common::Error::Failure(response),
69793                        });
69794                    }
69795                    let response = common::Response::from_parts(parts, body);
69796
69797                    dlg.finished(true);
69798                    return Ok(response);
69799                }
69800            }
69801        }
69802    }
69803
69804    /// The Campaign Manager 360 user profile ID.
69805    ///
69806    /// Sets the *profile id* path property to the given value.
69807    ///
69808    /// Even though the property as already been set when instantiating this call,
69809    /// we provide this method for API completeness.
69810    pub fn profile_id(mut self, new_value: i64) -> ReportDeleteCall<'a, C> {
69811        self._profile_id = new_value;
69812        self
69813    }
69814    /// The ID of the report.
69815    ///
69816    /// Sets the *report id* path property to the given value.
69817    ///
69818    /// Even though the property as already been set when instantiating this call,
69819    /// we provide this method for API completeness.
69820    pub fn report_id(mut self, new_value: i64) -> ReportDeleteCall<'a, C> {
69821        self._report_id = new_value;
69822        self
69823    }
69824    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
69825    /// while executing the actual API request.
69826    ///
69827    /// ````text
69828    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
69829    /// ````
69830    ///
69831    /// Sets the *delegate* property to the given value.
69832    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ReportDeleteCall<'a, C> {
69833        self._delegate = Some(new_value);
69834        self
69835    }
69836
69837    /// Set any additional parameter of the query string used in the request.
69838    /// It should be used to set parameters which are not yet available through their own
69839    /// setters.
69840    ///
69841    /// Please note that this method must not be used to set any of the known parameters
69842    /// which have their own setter method. If done anyway, the request will fail.
69843    ///
69844    /// # Additional Parameters
69845    ///
69846    /// * *$.xgafv* (query-string) - V1 error format.
69847    /// * *access_token* (query-string) - OAuth access token.
69848    /// * *alt* (query-string) - Data format for response.
69849    /// * *callback* (query-string) - JSONP
69850    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
69851    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
69852    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
69853    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
69854    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
69855    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
69856    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
69857    pub fn param<T>(mut self, name: T, value: T) -> ReportDeleteCall<'a, C>
69858    where
69859        T: AsRef<str>,
69860    {
69861        self._additional_params
69862            .insert(name.as_ref().to_string(), value.as_ref().to_string());
69863        self
69864    }
69865
69866    /// Identifies the authorization scope for the method you are building.
69867    ///
69868    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
69869    /// [`Scope::Full`].
69870    ///
69871    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
69872    /// tokens for more than one scope.
69873    ///
69874    /// Usually there is more than one suitable scope to authorize an operation, some of which may
69875    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
69876    /// sufficient, a read-write scope will do as well.
69877    pub fn add_scope<St>(mut self, scope: St) -> ReportDeleteCall<'a, C>
69878    where
69879        St: AsRef<str>,
69880    {
69881        self._scopes.insert(String::from(scope.as_ref()));
69882        self
69883    }
69884    /// Identifies the authorization scope(s) for the method you are building.
69885    ///
69886    /// See [`Self::add_scope()`] for details.
69887    pub fn add_scopes<I, St>(mut self, scopes: I) -> ReportDeleteCall<'a, C>
69888    where
69889        I: IntoIterator<Item = St>,
69890        St: AsRef<str>,
69891    {
69892        self._scopes
69893            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
69894        self
69895    }
69896
69897    /// Removes all scopes, and no default scope will be used either.
69898    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
69899    /// for details).
69900    pub fn clear_scopes(mut self) -> ReportDeleteCall<'a, C> {
69901        self._scopes.clear();
69902        self
69903    }
69904}
69905
69906/// Retrieves a report by its ID.
69907///
69908/// A builder for the *get* method supported by a *report* resource.
69909/// It is not used directly, but through a [`ReportMethods`] instance.
69910///
69911/// # Example
69912///
69913/// Instantiate a resource method builder
69914///
69915/// ```test_harness,no_run
69916/// # extern crate hyper;
69917/// # extern crate hyper_rustls;
69918/// # extern crate google_dfareporting3d3 as dfareporting3d3;
69919/// # async fn dox() {
69920/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
69921///
69922/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
69923/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
69924/// #     secret,
69925/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
69926/// # ).build().await.unwrap();
69927///
69928/// # let client = hyper_util::client::legacy::Client::builder(
69929/// #     hyper_util::rt::TokioExecutor::new()
69930/// # )
69931/// # .build(
69932/// #     hyper_rustls::HttpsConnectorBuilder::new()
69933/// #         .with_native_roots()
69934/// #         .unwrap()
69935/// #         .https_or_http()
69936/// #         .enable_http1()
69937/// #         .build()
69938/// # );
69939/// # let mut hub = Dfareporting::new(client, auth);
69940/// // You can configure optional parameters by calling the respective setters at will, and
69941/// // execute the final call using `doit()`.
69942/// // Values shown here are possibly random and not representative !
69943/// let result = hub.reports().get(-26, -85)
69944///              .doit().await;
69945/// # }
69946/// ```
69947pub struct ReportGetCall<'a, C>
69948where
69949    C: 'a,
69950{
69951    hub: &'a Dfareporting<C>,
69952    _profile_id: i64,
69953    _report_id: i64,
69954    _delegate: Option<&'a mut dyn common::Delegate>,
69955    _additional_params: HashMap<String, String>,
69956    _scopes: BTreeSet<String>,
69957}
69958
69959impl<'a, C> common::CallBuilder for ReportGetCall<'a, C> {}
69960
69961impl<'a, C> ReportGetCall<'a, C>
69962where
69963    C: common::Connector,
69964{
69965    /// Perform the operation you have build so far.
69966    pub async fn doit(mut self) -> common::Result<(common::Response, Report)> {
69967        use std::borrow::Cow;
69968        use std::io::{Read, Seek};
69969
69970        use common::{url::Params, ToParts};
69971        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
69972
69973        let mut dd = common::DefaultDelegate;
69974        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
69975        dlg.begin(common::MethodInfo {
69976            id: "dfareporting.reports.get",
69977            http_method: hyper::Method::GET,
69978        });
69979
69980        for &field in ["alt", "profileId", "reportId"].iter() {
69981            if self._additional_params.contains_key(field) {
69982                dlg.finished(false);
69983                return Err(common::Error::FieldClash(field));
69984            }
69985        }
69986
69987        let mut params = Params::with_capacity(4 + self._additional_params.len());
69988        params.push("profileId", self._profile_id.to_string());
69989        params.push("reportId", self._report_id.to_string());
69990
69991        params.extend(self._additional_params.iter());
69992
69993        params.push("alt", "json");
69994        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/reports/{reportId}";
69995        if self._scopes.is_empty() {
69996            self._scopes.insert(Scope::Full.as_ref().to_string());
69997        }
69998
69999        #[allow(clippy::single_element_loop)]
70000        for &(find_this, param_name) in
70001            [("{profileId}", "profileId"), ("{reportId}", "reportId")].iter()
70002        {
70003            url = params.uri_replacement(url, param_name, find_this, false);
70004        }
70005        {
70006            let to_remove = ["reportId", "profileId"];
70007            params.remove_params(&to_remove);
70008        }
70009
70010        let url = params.parse_with_url(&url);
70011
70012        loop {
70013            let token = match self
70014                .hub
70015                .auth
70016                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
70017                .await
70018            {
70019                Ok(token) => token,
70020                Err(e) => match dlg.token(e) {
70021                    Ok(token) => token,
70022                    Err(e) => {
70023                        dlg.finished(false);
70024                        return Err(common::Error::MissingToken(e));
70025                    }
70026                },
70027            };
70028            let mut req_result = {
70029                let client = &self.hub.client;
70030                dlg.pre_request();
70031                let mut req_builder = hyper::Request::builder()
70032                    .method(hyper::Method::GET)
70033                    .uri(url.as_str())
70034                    .header(USER_AGENT, self.hub._user_agent.clone());
70035
70036                if let Some(token) = token.as_ref() {
70037                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
70038                }
70039
70040                let request = req_builder
70041                    .header(CONTENT_LENGTH, 0_u64)
70042                    .body(common::to_body::<String>(None));
70043
70044                client.request(request.unwrap()).await
70045            };
70046
70047            match req_result {
70048                Err(err) => {
70049                    if let common::Retry::After(d) = dlg.http_error(&err) {
70050                        sleep(d).await;
70051                        continue;
70052                    }
70053                    dlg.finished(false);
70054                    return Err(common::Error::HttpError(err));
70055                }
70056                Ok(res) => {
70057                    let (mut parts, body) = res.into_parts();
70058                    let mut body = common::Body::new(body);
70059                    if !parts.status.is_success() {
70060                        let bytes = common::to_bytes(body).await.unwrap_or_default();
70061                        let error = serde_json::from_str(&common::to_string(&bytes));
70062                        let response = common::to_response(parts, bytes.into());
70063
70064                        if let common::Retry::After(d) =
70065                            dlg.http_failure(&response, error.as_ref().ok())
70066                        {
70067                            sleep(d).await;
70068                            continue;
70069                        }
70070
70071                        dlg.finished(false);
70072
70073                        return Err(match error {
70074                            Ok(value) => common::Error::BadRequest(value),
70075                            _ => common::Error::Failure(response),
70076                        });
70077                    }
70078                    let response = {
70079                        let bytes = common::to_bytes(body).await.unwrap_or_default();
70080                        let encoded = common::to_string(&bytes);
70081                        match serde_json::from_str(&encoded) {
70082                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
70083                            Err(error) => {
70084                                dlg.response_json_decode_error(&encoded, &error);
70085                                return Err(common::Error::JsonDecodeError(
70086                                    encoded.to_string(),
70087                                    error,
70088                                ));
70089                            }
70090                        }
70091                    };
70092
70093                    dlg.finished(true);
70094                    return Ok(response);
70095                }
70096            }
70097        }
70098    }
70099
70100    /// The Campaign Manager 360 user profile ID.
70101    ///
70102    /// Sets the *profile id* path property to the given value.
70103    ///
70104    /// Even though the property as already been set when instantiating this call,
70105    /// we provide this method for API completeness.
70106    pub fn profile_id(mut self, new_value: i64) -> ReportGetCall<'a, C> {
70107        self._profile_id = new_value;
70108        self
70109    }
70110    /// The ID of the report.
70111    ///
70112    /// Sets the *report id* path property to the given value.
70113    ///
70114    /// Even though the property as already been set when instantiating this call,
70115    /// we provide this method for API completeness.
70116    pub fn report_id(mut self, new_value: i64) -> ReportGetCall<'a, C> {
70117        self._report_id = new_value;
70118        self
70119    }
70120    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
70121    /// while executing the actual API request.
70122    ///
70123    /// ````text
70124    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
70125    /// ````
70126    ///
70127    /// Sets the *delegate* property to the given value.
70128    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ReportGetCall<'a, C> {
70129        self._delegate = Some(new_value);
70130        self
70131    }
70132
70133    /// Set any additional parameter of the query string used in the request.
70134    /// It should be used to set parameters which are not yet available through their own
70135    /// setters.
70136    ///
70137    /// Please note that this method must not be used to set any of the known parameters
70138    /// which have their own setter method. If done anyway, the request will fail.
70139    ///
70140    /// # Additional Parameters
70141    ///
70142    /// * *$.xgafv* (query-string) - V1 error format.
70143    /// * *access_token* (query-string) - OAuth access token.
70144    /// * *alt* (query-string) - Data format for response.
70145    /// * *callback* (query-string) - JSONP
70146    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
70147    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
70148    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
70149    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
70150    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
70151    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
70152    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
70153    pub fn param<T>(mut self, name: T, value: T) -> ReportGetCall<'a, C>
70154    where
70155        T: AsRef<str>,
70156    {
70157        self._additional_params
70158            .insert(name.as_ref().to_string(), value.as_ref().to_string());
70159        self
70160    }
70161
70162    /// Identifies the authorization scope for the method you are building.
70163    ///
70164    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
70165    /// [`Scope::Full`].
70166    ///
70167    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
70168    /// tokens for more than one scope.
70169    ///
70170    /// Usually there is more than one suitable scope to authorize an operation, some of which may
70171    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
70172    /// sufficient, a read-write scope will do as well.
70173    pub fn add_scope<St>(mut self, scope: St) -> ReportGetCall<'a, C>
70174    where
70175        St: AsRef<str>,
70176    {
70177        self._scopes.insert(String::from(scope.as_ref()));
70178        self
70179    }
70180    /// Identifies the authorization scope(s) for the method you are building.
70181    ///
70182    /// See [`Self::add_scope()`] for details.
70183    pub fn add_scopes<I, St>(mut self, scopes: I) -> ReportGetCall<'a, C>
70184    where
70185        I: IntoIterator<Item = St>,
70186        St: AsRef<str>,
70187    {
70188        self._scopes
70189            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
70190        self
70191    }
70192
70193    /// Removes all scopes, and no default scope will be used either.
70194    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
70195    /// for details).
70196    pub fn clear_scopes(mut self) -> ReportGetCall<'a, C> {
70197        self._scopes.clear();
70198        self
70199    }
70200}
70201
70202/// Creates a report.
70203///
70204/// A builder for the *insert* method supported by a *report* resource.
70205/// It is not used directly, but through a [`ReportMethods`] instance.
70206///
70207/// # Example
70208///
70209/// Instantiate a resource method builder
70210///
70211/// ```test_harness,no_run
70212/// # extern crate hyper;
70213/// # extern crate hyper_rustls;
70214/// # extern crate google_dfareporting3d3 as dfareporting3d3;
70215/// use dfareporting3d3::api::Report;
70216/// # async fn dox() {
70217/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
70218///
70219/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
70220/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
70221/// #     secret,
70222/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
70223/// # ).build().await.unwrap();
70224///
70225/// # let client = hyper_util::client::legacy::Client::builder(
70226/// #     hyper_util::rt::TokioExecutor::new()
70227/// # )
70228/// # .build(
70229/// #     hyper_rustls::HttpsConnectorBuilder::new()
70230/// #         .with_native_roots()
70231/// #         .unwrap()
70232/// #         .https_or_http()
70233/// #         .enable_http1()
70234/// #         .build()
70235/// # );
70236/// # let mut hub = Dfareporting::new(client, auth);
70237/// // As the method needs a request, you would usually fill it with the desired information
70238/// // into the respective structure. Some of the parts shown here might not be applicable !
70239/// // Values shown here are possibly random and not representative !
70240/// let mut req = Report::default();
70241///
70242/// // You can configure optional parameters by calling the respective setters at will, and
70243/// // execute the final call using `doit()`.
70244/// // Values shown here are possibly random and not representative !
70245/// let result = hub.reports().insert(req, -51)
70246///              .doit().await;
70247/// # }
70248/// ```
70249pub struct ReportInsertCall<'a, C>
70250where
70251    C: 'a,
70252{
70253    hub: &'a Dfareporting<C>,
70254    _request: Report,
70255    _profile_id: i64,
70256    _delegate: Option<&'a mut dyn common::Delegate>,
70257    _additional_params: HashMap<String, String>,
70258    _scopes: BTreeSet<String>,
70259}
70260
70261impl<'a, C> common::CallBuilder for ReportInsertCall<'a, C> {}
70262
70263impl<'a, C> ReportInsertCall<'a, C>
70264where
70265    C: common::Connector,
70266{
70267    /// Perform the operation you have build so far.
70268    pub async fn doit(mut self) -> common::Result<(common::Response, Report)> {
70269        use std::borrow::Cow;
70270        use std::io::{Read, Seek};
70271
70272        use common::{url::Params, ToParts};
70273        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
70274
70275        let mut dd = common::DefaultDelegate;
70276        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
70277        dlg.begin(common::MethodInfo {
70278            id: "dfareporting.reports.insert",
70279            http_method: hyper::Method::POST,
70280        });
70281
70282        for &field in ["alt", "profileId"].iter() {
70283            if self._additional_params.contains_key(field) {
70284                dlg.finished(false);
70285                return Err(common::Error::FieldClash(field));
70286            }
70287        }
70288
70289        let mut params = Params::with_capacity(4 + self._additional_params.len());
70290        params.push("profileId", self._profile_id.to_string());
70291
70292        params.extend(self._additional_params.iter());
70293
70294        params.push("alt", "json");
70295        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/reports";
70296        if self._scopes.is_empty() {
70297            self._scopes.insert(Scope::Full.as_ref().to_string());
70298        }
70299
70300        #[allow(clippy::single_element_loop)]
70301        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
70302            url = params.uri_replacement(url, param_name, find_this, false);
70303        }
70304        {
70305            let to_remove = ["profileId"];
70306            params.remove_params(&to_remove);
70307        }
70308
70309        let url = params.parse_with_url(&url);
70310
70311        let mut json_mime_type = mime::APPLICATION_JSON;
70312        let mut request_value_reader = {
70313            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
70314            common::remove_json_null_values(&mut value);
70315            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
70316            serde_json::to_writer(&mut dst, &value).unwrap();
70317            dst
70318        };
70319        let request_size = request_value_reader
70320            .seek(std::io::SeekFrom::End(0))
70321            .unwrap();
70322        request_value_reader
70323            .seek(std::io::SeekFrom::Start(0))
70324            .unwrap();
70325
70326        loop {
70327            let token = match self
70328                .hub
70329                .auth
70330                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
70331                .await
70332            {
70333                Ok(token) => token,
70334                Err(e) => match dlg.token(e) {
70335                    Ok(token) => token,
70336                    Err(e) => {
70337                        dlg.finished(false);
70338                        return Err(common::Error::MissingToken(e));
70339                    }
70340                },
70341            };
70342            request_value_reader
70343                .seek(std::io::SeekFrom::Start(0))
70344                .unwrap();
70345            let mut req_result = {
70346                let client = &self.hub.client;
70347                dlg.pre_request();
70348                let mut req_builder = hyper::Request::builder()
70349                    .method(hyper::Method::POST)
70350                    .uri(url.as_str())
70351                    .header(USER_AGENT, self.hub._user_agent.clone());
70352
70353                if let Some(token) = token.as_ref() {
70354                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
70355                }
70356
70357                let request = req_builder
70358                    .header(CONTENT_TYPE, json_mime_type.to_string())
70359                    .header(CONTENT_LENGTH, request_size as u64)
70360                    .body(common::to_body(
70361                        request_value_reader.get_ref().clone().into(),
70362                    ));
70363
70364                client.request(request.unwrap()).await
70365            };
70366
70367            match req_result {
70368                Err(err) => {
70369                    if let common::Retry::After(d) = dlg.http_error(&err) {
70370                        sleep(d).await;
70371                        continue;
70372                    }
70373                    dlg.finished(false);
70374                    return Err(common::Error::HttpError(err));
70375                }
70376                Ok(res) => {
70377                    let (mut parts, body) = res.into_parts();
70378                    let mut body = common::Body::new(body);
70379                    if !parts.status.is_success() {
70380                        let bytes = common::to_bytes(body).await.unwrap_or_default();
70381                        let error = serde_json::from_str(&common::to_string(&bytes));
70382                        let response = common::to_response(parts, bytes.into());
70383
70384                        if let common::Retry::After(d) =
70385                            dlg.http_failure(&response, error.as_ref().ok())
70386                        {
70387                            sleep(d).await;
70388                            continue;
70389                        }
70390
70391                        dlg.finished(false);
70392
70393                        return Err(match error {
70394                            Ok(value) => common::Error::BadRequest(value),
70395                            _ => common::Error::Failure(response),
70396                        });
70397                    }
70398                    let response = {
70399                        let bytes = common::to_bytes(body).await.unwrap_or_default();
70400                        let encoded = common::to_string(&bytes);
70401                        match serde_json::from_str(&encoded) {
70402                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
70403                            Err(error) => {
70404                                dlg.response_json_decode_error(&encoded, &error);
70405                                return Err(common::Error::JsonDecodeError(
70406                                    encoded.to_string(),
70407                                    error,
70408                                ));
70409                            }
70410                        }
70411                    };
70412
70413                    dlg.finished(true);
70414                    return Ok(response);
70415                }
70416            }
70417        }
70418    }
70419
70420    ///
70421    /// Sets the *request* property to the given value.
70422    ///
70423    /// Even though the property as already been set when instantiating this call,
70424    /// we provide this method for API completeness.
70425    pub fn request(mut self, new_value: Report) -> ReportInsertCall<'a, C> {
70426        self._request = new_value;
70427        self
70428    }
70429    /// The Campaign Manager 360 user profile ID.
70430    ///
70431    /// Sets the *profile id* path property to the given value.
70432    ///
70433    /// Even though the property as already been set when instantiating this call,
70434    /// we provide this method for API completeness.
70435    pub fn profile_id(mut self, new_value: i64) -> ReportInsertCall<'a, C> {
70436        self._profile_id = new_value;
70437        self
70438    }
70439    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
70440    /// while executing the actual API request.
70441    ///
70442    /// ````text
70443    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
70444    /// ````
70445    ///
70446    /// Sets the *delegate* property to the given value.
70447    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ReportInsertCall<'a, C> {
70448        self._delegate = Some(new_value);
70449        self
70450    }
70451
70452    /// Set any additional parameter of the query string used in the request.
70453    /// It should be used to set parameters which are not yet available through their own
70454    /// setters.
70455    ///
70456    /// Please note that this method must not be used to set any of the known parameters
70457    /// which have their own setter method. If done anyway, the request will fail.
70458    ///
70459    /// # Additional Parameters
70460    ///
70461    /// * *$.xgafv* (query-string) - V1 error format.
70462    /// * *access_token* (query-string) - OAuth access token.
70463    /// * *alt* (query-string) - Data format for response.
70464    /// * *callback* (query-string) - JSONP
70465    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
70466    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
70467    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
70468    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
70469    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
70470    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
70471    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
70472    pub fn param<T>(mut self, name: T, value: T) -> ReportInsertCall<'a, C>
70473    where
70474        T: AsRef<str>,
70475    {
70476        self._additional_params
70477            .insert(name.as_ref().to_string(), value.as_ref().to_string());
70478        self
70479    }
70480
70481    /// Identifies the authorization scope for the method you are building.
70482    ///
70483    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
70484    /// [`Scope::Full`].
70485    ///
70486    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
70487    /// tokens for more than one scope.
70488    ///
70489    /// Usually there is more than one suitable scope to authorize an operation, some of which may
70490    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
70491    /// sufficient, a read-write scope will do as well.
70492    pub fn add_scope<St>(mut self, scope: St) -> ReportInsertCall<'a, C>
70493    where
70494        St: AsRef<str>,
70495    {
70496        self._scopes.insert(String::from(scope.as_ref()));
70497        self
70498    }
70499    /// Identifies the authorization scope(s) for the method you are building.
70500    ///
70501    /// See [`Self::add_scope()`] for details.
70502    pub fn add_scopes<I, St>(mut self, scopes: I) -> ReportInsertCall<'a, C>
70503    where
70504        I: IntoIterator<Item = St>,
70505        St: AsRef<str>,
70506    {
70507        self._scopes
70508            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
70509        self
70510    }
70511
70512    /// Removes all scopes, and no default scope will be used either.
70513    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
70514    /// for details).
70515    pub fn clear_scopes(mut self) -> ReportInsertCall<'a, C> {
70516        self._scopes.clear();
70517        self
70518    }
70519}
70520
70521/// Retrieves list of reports.
70522///
70523/// A builder for the *list* method supported by a *report* resource.
70524/// It is not used directly, but through a [`ReportMethods`] instance.
70525///
70526/// # Example
70527///
70528/// Instantiate a resource method builder
70529///
70530/// ```test_harness,no_run
70531/// # extern crate hyper;
70532/// # extern crate hyper_rustls;
70533/// # extern crate google_dfareporting3d3 as dfareporting3d3;
70534/// # async fn dox() {
70535/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
70536///
70537/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
70538/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
70539/// #     secret,
70540/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
70541/// # ).build().await.unwrap();
70542///
70543/// # let client = hyper_util::client::legacy::Client::builder(
70544/// #     hyper_util::rt::TokioExecutor::new()
70545/// # )
70546/// # .build(
70547/// #     hyper_rustls::HttpsConnectorBuilder::new()
70548/// #         .with_native_roots()
70549/// #         .unwrap()
70550/// #         .https_or_http()
70551/// #         .enable_http1()
70552/// #         .build()
70553/// # );
70554/// # let mut hub = Dfareporting::new(client, auth);
70555/// // You can configure optional parameters by calling the respective setters at will, and
70556/// // execute the final call using `doit()`.
70557/// // Values shown here are possibly random and not representative !
70558/// let result = hub.reports().list(-53)
70559///              .sort_order("Lorem")
70560///              .sort_field("amet.")
70561///              .scope("diam")
70562///              .page_token("diam")
70563///              .max_results(-68)
70564///              .doit().await;
70565/// # }
70566/// ```
70567pub struct ReportListCall<'a, C>
70568where
70569    C: 'a,
70570{
70571    hub: &'a Dfareporting<C>,
70572    _profile_id: i64,
70573    _sort_order: Option<String>,
70574    _sort_field: Option<String>,
70575    _scope: Option<String>,
70576    _page_token: Option<String>,
70577    _max_results: Option<i32>,
70578    _delegate: Option<&'a mut dyn common::Delegate>,
70579    _additional_params: HashMap<String, String>,
70580    _scopes: BTreeSet<String>,
70581}
70582
70583impl<'a, C> common::CallBuilder for ReportListCall<'a, C> {}
70584
70585impl<'a, C> ReportListCall<'a, C>
70586where
70587    C: common::Connector,
70588{
70589    /// Perform the operation you have build so far.
70590    pub async fn doit(mut self) -> common::Result<(common::Response, ReportList)> {
70591        use std::borrow::Cow;
70592        use std::io::{Read, Seek};
70593
70594        use common::{url::Params, ToParts};
70595        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
70596
70597        let mut dd = common::DefaultDelegate;
70598        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
70599        dlg.begin(common::MethodInfo {
70600            id: "dfareporting.reports.list",
70601            http_method: hyper::Method::GET,
70602        });
70603
70604        for &field in [
70605            "alt",
70606            "profileId",
70607            "sortOrder",
70608            "sortField",
70609            "scope",
70610            "pageToken",
70611            "maxResults",
70612        ]
70613        .iter()
70614        {
70615            if self._additional_params.contains_key(field) {
70616                dlg.finished(false);
70617                return Err(common::Error::FieldClash(field));
70618            }
70619        }
70620
70621        let mut params = Params::with_capacity(8 + self._additional_params.len());
70622        params.push("profileId", self._profile_id.to_string());
70623        if let Some(value) = self._sort_order.as_ref() {
70624            params.push("sortOrder", value);
70625        }
70626        if let Some(value) = self._sort_field.as_ref() {
70627            params.push("sortField", value);
70628        }
70629        if let Some(value) = self._scope.as_ref() {
70630            params.push("scope", value);
70631        }
70632        if let Some(value) = self._page_token.as_ref() {
70633            params.push("pageToken", value);
70634        }
70635        if let Some(value) = self._max_results.as_ref() {
70636            params.push("maxResults", value.to_string());
70637        }
70638
70639        params.extend(self._additional_params.iter());
70640
70641        params.push("alt", "json");
70642        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/reports";
70643        if self._scopes.is_empty() {
70644            self._scopes.insert(Scope::Full.as_ref().to_string());
70645        }
70646
70647        #[allow(clippy::single_element_loop)]
70648        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
70649            url = params.uri_replacement(url, param_name, find_this, false);
70650        }
70651        {
70652            let to_remove = ["profileId"];
70653            params.remove_params(&to_remove);
70654        }
70655
70656        let url = params.parse_with_url(&url);
70657
70658        loop {
70659            let token = match self
70660                .hub
70661                .auth
70662                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
70663                .await
70664            {
70665                Ok(token) => token,
70666                Err(e) => match dlg.token(e) {
70667                    Ok(token) => token,
70668                    Err(e) => {
70669                        dlg.finished(false);
70670                        return Err(common::Error::MissingToken(e));
70671                    }
70672                },
70673            };
70674            let mut req_result = {
70675                let client = &self.hub.client;
70676                dlg.pre_request();
70677                let mut req_builder = hyper::Request::builder()
70678                    .method(hyper::Method::GET)
70679                    .uri(url.as_str())
70680                    .header(USER_AGENT, self.hub._user_agent.clone());
70681
70682                if let Some(token) = token.as_ref() {
70683                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
70684                }
70685
70686                let request = req_builder
70687                    .header(CONTENT_LENGTH, 0_u64)
70688                    .body(common::to_body::<String>(None));
70689
70690                client.request(request.unwrap()).await
70691            };
70692
70693            match req_result {
70694                Err(err) => {
70695                    if let common::Retry::After(d) = dlg.http_error(&err) {
70696                        sleep(d).await;
70697                        continue;
70698                    }
70699                    dlg.finished(false);
70700                    return Err(common::Error::HttpError(err));
70701                }
70702                Ok(res) => {
70703                    let (mut parts, body) = res.into_parts();
70704                    let mut body = common::Body::new(body);
70705                    if !parts.status.is_success() {
70706                        let bytes = common::to_bytes(body).await.unwrap_or_default();
70707                        let error = serde_json::from_str(&common::to_string(&bytes));
70708                        let response = common::to_response(parts, bytes.into());
70709
70710                        if let common::Retry::After(d) =
70711                            dlg.http_failure(&response, error.as_ref().ok())
70712                        {
70713                            sleep(d).await;
70714                            continue;
70715                        }
70716
70717                        dlg.finished(false);
70718
70719                        return Err(match error {
70720                            Ok(value) => common::Error::BadRequest(value),
70721                            _ => common::Error::Failure(response),
70722                        });
70723                    }
70724                    let response = {
70725                        let bytes = common::to_bytes(body).await.unwrap_or_default();
70726                        let encoded = common::to_string(&bytes);
70727                        match serde_json::from_str(&encoded) {
70728                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
70729                            Err(error) => {
70730                                dlg.response_json_decode_error(&encoded, &error);
70731                                return Err(common::Error::JsonDecodeError(
70732                                    encoded.to_string(),
70733                                    error,
70734                                ));
70735                            }
70736                        }
70737                    };
70738
70739                    dlg.finished(true);
70740                    return Ok(response);
70741                }
70742            }
70743        }
70744    }
70745
70746    /// The Campaign Manager 360 user profile ID.
70747    ///
70748    /// Sets the *profile id* path property to the given value.
70749    ///
70750    /// Even though the property as already been set when instantiating this call,
70751    /// we provide this method for API completeness.
70752    pub fn profile_id(mut self, new_value: i64) -> ReportListCall<'a, C> {
70753        self._profile_id = new_value;
70754        self
70755    }
70756    /// Order of sorted results.
70757    ///
70758    /// Sets the *sort order* query property to the given value.
70759    pub fn sort_order(mut self, new_value: &str) -> ReportListCall<'a, C> {
70760        self._sort_order = Some(new_value.to_string());
70761        self
70762    }
70763    /// The field by which to sort the list.
70764    ///
70765    /// Sets the *sort field* query property to the given value.
70766    pub fn sort_field(mut self, new_value: &str) -> ReportListCall<'a, C> {
70767        self._sort_field = Some(new_value.to_string());
70768        self
70769    }
70770    /// The scope that defines which results are returned.
70771    ///
70772    /// Sets the *scope* query property to the given value.
70773    pub fn scope(mut self, new_value: &str) -> ReportListCall<'a, C> {
70774        self._scope = Some(new_value.to_string());
70775        self
70776    }
70777    /// The value of the nextToken from the previous result page.
70778    ///
70779    /// Sets the *page token* query property to the given value.
70780    pub fn page_token(mut self, new_value: &str) -> ReportListCall<'a, C> {
70781        self._page_token = Some(new_value.to_string());
70782        self
70783    }
70784    /// Maximum number of results to return.
70785    ///
70786    /// Sets the *max results* query property to the given value.
70787    pub fn max_results(mut self, new_value: i32) -> ReportListCall<'a, C> {
70788        self._max_results = Some(new_value);
70789        self
70790    }
70791    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
70792    /// while executing the actual API request.
70793    ///
70794    /// ````text
70795    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
70796    /// ````
70797    ///
70798    /// Sets the *delegate* property to the given value.
70799    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ReportListCall<'a, C> {
70800        self._delegate = Some(new_value);
70801        self
70802    }
70803
70804    /// Set any additional parameter of the query string used in the request.
70805    /// It should be used to set parameters which are not yet available through their own
70806    /// setters.
70807    ///
70808    /// Please note that this method must not be used to set any of the known parameters
70809    /// which have their own setter method. If done anyway, the request will fail.
70810    ///
70811    /// # Additional Parameters
70812    ///
70813    /// * *$.xgafv* (query-string) - V1 error format.
70814    /// * *access_token* (query-string) - OAuth access token.
70815    /// * *alt* (query-string) - Data format for response.
70816    /// * *callback* (query-string) - JSONP
70817    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
70818    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
70819    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
70820    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
70821    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
70822    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
70823    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
70824    pub fn param<T>(mut self, name: T, value: T) -> ReportListCall<'a, C>
70825    where
70826        T: AsRef<str>,
70827    {
70828        self._additional_params
70829            .insert(name.as_ref().to_string(), value.as_ref().to_string());
70830        self
70831    }
70832
70833    /// Identifies the authorization scope for the method you are building.
70834    ///
70835    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
70836    /// [`Scope::Full`].
70837    ///
70838    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
70839    /// tokens for more than one scope.
70840    ///
70841    /// Usually there is more than one suitable scope to authorize an operation, some of which may
70842    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
70843    /// sufficient, a read-write scope will do as well.
70844    pub fn add_scope<St>(mut self, scope: St) -> ReportListCall<'a, C>
70845    where
70846        St: AsRef<str>,
70847    {
70848        self._scopes.insert(String::from(scope.as_ref()));
70849        self
70850    }
70851    /// Identifies the authorization scope(s) for the method you are building.
70852    ///
70853    /// See [`Self::add_scope()`] for details.
70854    pub fn add_scopes<I, St>(mut self, scopes: I) -> ReportListCall<'a, C>
70855    where
70856        I: IntoIterator<Item = St>,
70857        St: AsRef<str>,
70858    {
70859        self._scopes
70860            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
70861        self
70862    }
70863
70864    /// Removes all scopes, and no default scope will be used either.
70865    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
70866    /// for details).
70867    pub fn clear_scopes(mut self) -> ReportListCall<'a, C> {
70868        self._scopes.clear();
70869        self
70870    }
70871}
70872
70873/// Updates an existing report. This method supports patch semantics.
70874///
70875/// A builder for the *patch* method supported by a *report* resource.
70876/// It is not used directly, but through a [`ReportMethods`] instance.
70877///
70878/// # Example
70879///
70880/// Instantiate a resource method builder
70881///
70882/// ```test_harness,no_run
70883/// # extern crate hyper;
70884/// # extern crate hyper_rustls;
70885/// # extern crate google_dfareporting3d3 as dfareporting3d3;
70886/// use dfareporting3d3::api::Report;
70887/// # async fn dox() {
70888/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
70889///
70890/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
70891/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
70892/// #     secret,
70893/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
70894/// # ).build().await.unwrap();
70895///
70896/// # let client = hyper_util::client::legacy::Client::builder(
70897/// #     hyper_util::rt::TokioExecutor::new()
70898/// # )
70899/// # .build(
70900/// #     hyper_rustls::HttpsConnectorBuilder::new()
70901/// #         .with_native_roots()
70902/// #         .unwrap()
70903/// #         .https_or_http()
70904/// #         .enable_http1()
70905/// #         .build()
70906/// # );
70907/// # let mut hub = Dfareporting::new(client, auth);
70908/// // As the method needs a request, you would usually fill it with the desired information
70909/// // into the respective structure. Some of the parts shown here might not be applicable !
70910/// // Values shown here are possibly random and not representative !
70911/// let mut req = Report::default();
70912///
70913/// // You can configure optional parameters by calling the respective setters at will, and
70914/// // execute the final call using `doit()`.
70915/// // Values shown here are possibly random and not representative !
70916/// let result = hub.reports().patch(req, -59, -85)
70917///              .doit().await;
70918/// # }
70919/// ```
70920pub struct ReportPatchCall<'a, C>
70921where
70922    C: 'a,
70923{
70924    hub: &'a Dfareporting<C>,
70925    _request: Report,
70926    _profile_id: i64,
70927    _report_id: i64,
70928    _delegate: Option<&'a mut dyn common::Delegate>,
70929    _additional_params: HashMap<String, String>,
70930    _scopes: BTreeSet<String>,
70931}
70932
70933impl<'a, C> common::CallBuilder for ReportPatchCall<'a, C> {}
70934
70935impl<'a, C> ReportPatchCall<'a, C>
70936where
70937    C: common::Connector,
70938{
70939    /// Perform the operation you have build so far.
70940    pub async fn doit(mut self) -> common::Result<(common::Response, Report)> {
70941        use std::borrow::Cow;
70942        use std::io::{Read, Seek};
70943
70944        use common::{url::Params, ToParts};
70945        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
70946
70947        let mut dd = common::DefaultDelegate;
70948        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
70949        dlg.begin(common::MethodInfo {
70950            id: "dfareporting.reports.patch",
70951            http_method: hyper::Method::PATCH,
70952        });
70953
70954        for &field in ["alt", "profileId", "reportId"].iter() {
70955            if self._additional_params.contains_key(field) {
70956                dlg.finished(false);
70957                return Err(common::Error::FieldClash(field));
70958            }
70959        }
70960
70961        let mut params = Params::with_capacity(5 + self._additional_params.len());
70962        params.push("profileId", self._profile_id.to_string());
70963        params.push("reportId", self._report_id.to_string());
70964
70965        params.extend(self._additional_params.iter());
70966
70967        params.push("alt", "json");
70968        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/reports/{reportId}";
70969        if self._scopes.is_empty() {
70970            self._scopes.insert(Scope::Full.as_ref().to_string());
70971        }
70972
70973        #[allow(clippy::single_element_loop)]
70974        for &(find_this, param_name) in
70975            [("{profileId}", "profileId"), ("{reportId}", "reportId")].iter()
70976        {
70977            url = params.uri_replacement(url, param_name, find_this, false);
70978        }
70979        {
70980            let to_remove = ["reportId", "profileId"];
70981            params.remove_params(&to_remove);
70982        }
70983
70984        let url = params.parse_with_url(&url);
70985
70986        let mut json_mime_type = mime::APPLICATION_JSON;
70987        let mut request_value_reader = {
70988            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
70989            common::remove_json_null_values(&mut value);
70990            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
70991            serde_json::to_writer(&mut dst, &value).unwrap();
70992            dst
70993        };
70994        let request_size = request_value_reader
70995            .seek(std::io::SeekFrom::End(0))
70996            .unwrap();
70997        request_value_reader
70998            .seek(std::io::SeekFrom::Start(0))
70999            .unwrap();
71000
71001        loop {
71002            let token = match self
71003                .hub
71004                .auth
71005                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
71006                .await
71007            {
71008                Ok(token) => token,
71009                Err(e) => match dlg.token(e) {
71010                    Ok(token) => token,
71011                    Err(e) => {
71012                        dlg.finished(false);
71013                        return Err(common::Error::MissingToken(e));
71014                    }
71015                },
71016            };
71017            request_value_reader
71018                .seek(std::io::SeekFrom::Start(0))
71019                .unwrap();
71020            let mut req_result = {
71021                let client = &self.hub.client;
71022                dlg.pre_request();
71023                let mut req_builder = hyper::Request::builder()
71024                    .method(hyper::Method::PATCH)
71025                    .uri(url.as_str())
71026                    .header(USER_AGENT, self.hub._user_agent.clone());
71027
71028                if let Some(token) = token.as_ref() {
71029                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
71030                }
71031
71032                let request = req_builder
71033                    .header(CONTENT_TYPE, json_mime_type.to_string())
71034                    .header(CONTENT_LENGTH, request_size as u64)
71035                    .body(common::to_body(
71036                        request_value_reader.get_ref().clone().into(),
71037                    ));
71038
71039                client.request(request.unwrap()).await
71040            };
71041
71042            match req_result {
71043                Err(err) => {
71044                    if let common::Retry::After(d) = dlg.http_error(&err) {
71045                        sleep(d).await;
71046                        continue;
71047                    }
71048                    dlg.finished(false);
71049                    return Err(common::Error::HttpError(err));
71050                }
71051                Ok(res) => {
71052                    let (mut parts, body) = res.into_parts();
71053                    let mut body = common::Body::new(body);
71054                    if !parts.status.is_success() {
71055                        let bytes = common::to_bytes(body).await.unwrap_or_default();
71056                        let error = serde_json::from_str(&common::to_string(&bytes));
71057                        let response = common::to_response(parts, bytes.into());
71058
71059                        if let common::Retry::After(d) =
71060                            dlg.http_failure(&response, error.as_ref().ok())
71061                        {
71062                            sleep(d).await;
71063                            continue;
71064                        }
71065
71066                        dlg.finished(false);
71067
71068                        return Err(match error {
71069                            Ok(value) => common::Error::BadRequest(value),
71070                            _ => common::Error::Failure(response),
71071                        });
71072                    }
71073                    let response = {
71074                        let bytes = common::to_bytes(body).await.unwrap_or_default();
71075                        let encoded = common::to_string(&bytes);
71076                        match serde_json::from_str(&encoded) {
71077                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
71078                            Err(error) => {
71079                                dlg.response_json_decode_error(&encoded, &error);
71080                                return Err(common::Error::JsonDecodeError(
71081                                    encoded.to_string(),
71082                                    error,
71083                                ));
71084                            }
71085                        }
71086                    };
71087
71088                    dlg.finished(true);
71089                    return Ok(response);
71090                }
71091            }
71092        }
71093    }
71094
71095    ///
71096    /// Sets the *request* property to the given value.
71097    ///
71098    /// Even though the property as already been set when instantiating this call,
71099    /// we provide this method for API completeness.
71100    pub fn request(mut self, new_value: Report) -> ReportPatchCall<'a, C> {
71101        self._request = new_value;
71102        self
71103    }
71104    /// The DFA user profile ID.
71105    ///
71106    /// Sets the *profile id* path property to the given value.
71107    ///
71108    /// Even though the property as already been set when instantiating this call,
71109    /// we provide this method for API completeness.
71110    pub fn profile_id(mut self, new_value: i64) -> ReportPatchCall<'a, C> {
71111        self._profile_id = new_value;
71112        self
71113    }
71114    /// The ID of the report.
71115    ///
71116    /// Sets the *report id* path property to the given value.
71117    ///
71118    /// Even though the property as already been set when instantiating this call,
71119    /// we provide this method for API completeness.
71120    pub fn report_id(mut self, new_value: i64) -> ReportPatchCall<'a, C> {
71121        self._report_id = new_value;
71122        self
71123    }
71124    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
71125    /// while executing the actual API request.
71126    ///
71127    /// ````text
71128    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
71129    /// ````
71130    ///
71131    /// Sets the *delegate* property to the given value.
71132    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ReportPatchCall<'a, C> {
71133        self._delegate = Some(new_value);
71134        self
71135    }
71136
71137    /// Set any additional parameter of the query string used in the request.
71138    /// It should be used to set parameters which are not yet available through their own
71139    /// setters.
71140    ///
71141    /// Please note that this method must not be used to set any of the known parameters
71142    /// which have their own setter method. If done anyway, the request will fail.
71143    ///
71144    /// # Additional Parameters
71145    ///
71146    /// * *$.xgafv* (query-string) - V1 error format.
71147    /// * *access_token* (query-string) - OAuth access token.
71148    /// * *alt* (query-string) - Data format for response.
71149    /// * *callback* (query-string) - JSONP
71150    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
71151    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
71152    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
71153    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
71154    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
71155    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
71156    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
71157    pub fn param<T>(mut self, name: T, value: T) -> ReportPatchCall<'a, C>
71158    where
71159        T: AsRef<str>,
71160    {
71161        self._additional_params
71162            .insert(name.as_ref().to_string(), value.as_ref().to_string());
71163        self
71164    }
71165
71166    /// Identifies the authorization scope for the method you are building.
71167    ///
71168    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
71169    /// [`Scope::Full`].
71170    ///
71171    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
71172    /// tokens for more than one scope.
71173    ///
71174    /// Usually there is more than one suitable scope to authorize an operation, some of which may
71175    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
71176    /// sufficient, a read-write scope will do as well.
71177    pub fn add_scope<St>(mut self, scope: St) -> ReportPatchCall<'a, C>
71178    where
71179        St: AsRef<str>,
71180    {
71181        self._scopes.insert(String::from(scope.as_ref()));
71182        self
71183    }
71184    /// Identifies the authorization scope(s) for the method you are building.
71185    ///
71186    /// See [`Self::add_scope()`] for details.
71187    pub fn add_scopes<I, St>(mut self, scopes: I) -> ReportPatchCall<'a, C>
71188    where
71189        I: IntoIterator<Item = St>,
71190        St: AsRef<str>,
71191    {
71192        self._scopes
71193            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
71194        self
71195    }
71196
71197    /// Removes all scopes, and no default scope will be used either.
71198    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
71199    /// for details).
71200    pub fn clear_scopes(mut self) -> ReportPatchCall<'a, C> {
71201        self._scopes.clear();
71202        self
71203    }
71204}
71205
71206/// Runs a report.
71207///
71208/// A builder for the *run* method supported by a *report* resource.
71209/// It is not used directly, but through a [`ReportMethods`] instance.
71210///
71211/// # Example
71212///
71213/// Instantiate a resource method builder
71214///
71215/// ```test_harness,no_run
71216/// # extern crate hyper;
71217/// # extern crate hyper_rustls;
71218/// # extern crate google_dfareporting3d3 as dfareporting3d3;
71219/// # async fn dox() {
71220/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
71221///
71222/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
71223/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
71224/// #     secret,
71225/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
71226/// # ).build().await.unwrap();
71227///
71228/// # let client = hyper_util::client::legacy::Client::builder(
71229/// #     hyper_util::rt::TokioExecutor::new()
71230/// # )
71231/// # .build(
71232/// #     hyper_rustls::HttpsConnectorBuilder::new()
71233/// #         .with_native_roots()
71234/// #         .unwrap()
71235/// #         .https_or_http()
71236/// #         .enable_http1()
71237/// #         .build()
71238/// # );
71239/// # let mut hub = Dfareporting::new(client, auth);
71240/// // You can configure optional parameters by calling the respective setters at will, and
71241/// // execute the final call using `doit()`.
71242/// // Values shown here are possibly random and not representative !
71243/// let result = hub.reports().run(-69, -19)
71244///              .synchronous(true)
71245///              .doit().await;
71246/// # }
71247/// ```
71248pub struct ReportRunCall<'a, C>
71249where
71250    C: 'a,
71251{
71252    hub: &'a Dfareporting<C>,
71253    _profile_id: i64,
71254    _report_id: i64,
71255    _synchronous: Option<bool>,
71256    _delegate: Option<&'a mut dyn common::Delegate>,
71257    _additional_params: HashMap<String, String>,
71258    _scopes: BTreeSet<String>,
71259}
71260
71261impl<'a, C> common::CallBuilder for ReportRunCall<'a, C> {}
71262
71263impl<'a, C> ReportRunCall<'a, C>
71264where
71265    C: common::Connector,
71266{
71267    /// Perform the operation you have build so far.
71268    pub async fn doit(mut self) -> common::Result<(common::Response, File)> {
71269        use std::borrow::Cow;
71270        use std::io::{Read, Seek};
71271
71272        use common::{url::Params, ToParts};
71273        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
71274
71275        let mut dd = common::DefaultDelegate;
71276        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
71277        dlg.begin(common::MethodInfo {
71278            id: "dfareporting.reports.run",
71279            http_method: hyper::Method::POST,
71280        });
71281
71282        for &field in ["alt", "profileId", "reportId", "synchronous"].iter() {
71283            if self._additional_params.contains_key(field) {
71284                dlg.finished(false);
71285                return Err(common::Error::FieldClash(field));
71286            }
71287        }
71288
71289        let mut params = Params::with_capacity(5 + self._additional_params.len());
71290        params.push("profileId", self._profile_id.to_string());
71291        params.push("reportId", self._report_id.to_string());
71292        if let Some(value) = self._synchronous.as_ref() {
71293            params.push("synchronous", value.to_string());
71294        }
71295
71296        params.extend(self._additional_params.iter());
71297
71298        params.push("alt", "json");
71299        let mut url =
71300            self.hub._base_url.clone() + "userprofiles/{profileId}/reports/{reportId}/run";
71301        if self._scopes.is_empty() {
71302            self._scopes.insert(Scope::Full.as_ref().to_string());
71303        }
71304
71305        #[allow(clippy::single_element_loop)]
71306        for &(find_this, param_name) in
71307            [("{profileId}", "profileId"), ("{reportId}", "reportId")].iter()
71308        {
71309            url = params.uri_replacement(url, param_name, find_this, false);
71310        }
71311        {
71312            let to_remove = ["reportId", "profileId"];
71313            params.remove_params(&to_remove);
71314        }
71315
71316        let url = params.parse_with_url(&url);
71317
71318        loop {
71319            let token = match self
71320                .hub
71321                .auth
71322                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
71323                .await
71324            {
71325                Ok(token) => token,
71326                Err(e) => match dlg.token(e) {
71327                    Ok(token) => token,
71328                    Err(e) => {
71329                        dlg.finished(false);
71330                        return Err(common::Error::MissingToken(e));
71331                    }
71332                },
71333            };
71334            let mut req_result = {
71335                let client = &self.hub.client;
71336                dlg.pre_request();
71337                let mut req_builder = hyper::Request::builder()
71338                    .method(hyper::Method::POST)
71339                    .uri(url.as_str())
71340                    .header(USER_AGENT, self.hub._user_agent.clone());
71341
71342                if let Some(token) = token.as_ref() {
71343                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
71344                }
71345
71346                let request = req_builder
71347                    .header(CONTENT_LENGTH, 0_u64)
71348                    .body(common::to_body::<String>(None));
71349
71350                client.request(request.unwrap()).await
71351            };
71352
71353            match req_result {
71354                Err(err) => {
71355                    if let common::Retry::After(d) = dlg.http_error(&err) {
71356                        sleep(d).await;
71357                        continue;
71358                    }
71359                    dlg.finished(false);
71360                    return Err(common::Error::HttpError(err));
71361                }
71362                Ok(res) => {
71363                    let (mut parts, body) = res.into_parts();
71364                    let mut body = common::Body::new(body);
71365                    if !parts.status.is_success() {
71366                        let bytes = common::to_bytes(body).await.unwrap_or_default();
71367                        let error = serde_json::from_str(&common::to_string(&bytes));
71368                        let response = common::to_response(parts, bytes.into());
71369
71370                        if let common::Retry::After(d) =
71371                            dlg.http_failure(&response, error.as_ref().ok())
71372                        {
71373                            sleep(d).await;
71374                            continue;
71375                        }
71376
71377                        dlg.finished(false);
71378
71379                        return Err(match error {
71380                            Ok(value) => common::Error::BadRequest(value),
71381                            _ => common::Error::Failure(response),
71382                        });
71383                    }
71384                    let response = {
71385                        let bytes = common::to_bytes(body).await.unwrap_or_default();
71386                        let encoded = common::to_string(&bytes);
71387                        match serde_json::from_str(&encoded) {
71388                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
71389                            Err(error) => {
71390                                dlg.response_json_decode_error(&encoded, &error);
71391                                return Err(common::Error::JsonDecodeError(
71392                                    encoded.to_string(),
71393                                    error,
71394                                ));
71395                            }
71396                        }
71397                    };
71398
71399                    dlg.finished(true);
71400                    return Ok(response);
71401                }
71402            }
71403        }
71404    }
71405
71406    /// The Campaign Manager 360 user profile ID.
71407    ///
71408    /// Sets the *profile id* path property to the given value.
71409    ///
71410    /// Even though the property as already been set when instantiating this call,
71411    /// we provide this method for API completeness.
71412    pub fn profile_id(mut self, new_value: i64) -> ReportRunCall<'a, C> {
71413        self._profile_id = new_value;
71414        self
71415    }
71416    /// The ID of the report.
71417    ///
71418    /// Sets the *report id* path property to the given value.
71419    ///
71420    /// Even though the property as already been set when instantiating this call,
71421    /// we provide this method for API completeness.
71422    pub fn report_id(mut self, new_value: i64) -> ReportRunCall<'a, C> {
71423        self._report_id = new_value;
71424        self
71425    }
71426    /// If set and true, tries to run the report synchronously.
71427    ///
71428    /// Sets the *synchronous* query property to the given value.
71429    pub fn synchronous(mut self, new_value: bool) -> ReportRunCall<'a, C> {
71430        self._synchronous = Some(new_value);
71431        self
71432    }
71433    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
71434    /// while executing the actual API request.
71435    ///
71436    /// ````text
71437    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
71438    /// ````
71439    ///
71440    /// Sets the *delegate* property to the given value.
71441    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ReportRunCall<'a, C> {
71442        self._delegate = Some(new_value);
71443        self
71444    }
71445
71446    /// Set any additional parameter of the query string used in the request.
71447    /// It should be used to set parameters which are not yet available through their own
71448    /// setters.
71449    ///
71450    /// Please note that this method must not be used to set any of the known parameters
71451    /// which have their own setter method. If done anyway, the request will fail.
71452    ///
71453    /// # Additional Parameters
71454    ///
71455    /// * *$.xgafv* (query-string) - V1 error format.
71456    /// * *access_token* (query-string) - OAuth access token.
71457    /// * *alt* (query-string) - Data format for response.
71458    /// * *callback* (query-string) - JSONP
71459    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
71460    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
71461    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
71462    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
71463    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
71464    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
71465    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
71466    pub fn param<T>(mut self, name: T, value: T) -> ReportRunCall<'a, C>
71467    where
71468        T: AsRef<str>,
71469    {
71470        self._additional_params
71471            .insert(name.as_ref().to_string(), value.as_ref().to_string());
71472        self
71473    }
71474
71475    /// Identifies the authorization scope for the method you are building.
71476    ///
71477    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
71478    /// [`Scope::Full`].
71479    ///
71480    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
71481    /// tokens for more than one scope.
71482    ///
71483    /// Usually there is more than one suitable scope to authorize an operation, some of which may
71484    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
71485    /// sufficient, a read-write scope will do as well.
71486    pub fn add_scope<St>(mut self, scope: St) -> ReportRunCall<'a, C>
71487    where
71488        St: AsRef<str>,
71489    {
71490        self._scopes.insert(String::from(scope.as_ref()));
71491        self
71492    }
71493    /// Identifies the authorization scope(s) for the method you are building.
71494    ///
71495    /// See [`Self::add_scope()`] for details.
71496    pub fn add_scopes<I, St>(mut self, scopes: I) -> ReportRunCall<'a, C>
71497    where
71498        I: IntoIterator<Item = St>,
71499        St: AsRef<str>,
71500    {
71501        self._scopes
71502            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
71503        self
71504    }
71505
71506    /// Removes all scopes, and no default scope will be used either.
71507    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
71508    /// for details).
71509    pub fn clear_scopes(mut self) -> ReportRunCall<'a, C> {
71510        self._scopes.clear();
71511        self
71512    }
71513}
71514
71515/// Updates a report.
71516///
71517/// A builder for the *update* method supported by a *report* resource.
71518/// It is not used directly, but through a [`ReportMethods`] instance.
71519///
71520/// # Example
71521///
71522/// Instantiate a resource method builder
71523///
71524/// ```test_harness,no_run
71525/// # extern crate hyper;
71526/// # extern crate hyper_rustls;
71527/// # extern crate google_dfareporting3d3 as dfareporting3d3;
71528/// use dfareporting3d3::api::Report;
71529/// # async fn dox() {
71530/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
71531///
71532/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
71533/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
71534/// #     secret,
71535/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
71536/// # ).build().await.unwrap();
71537///
71538/// # let client = hyper_util::client::legacy::Client::builder(
71539/// #     hyper_util::rt::TokioExecutor::new()
71540/// # )
71541/// # .build(
71542/// #     hyper_rustls::HttpsConnectorBuilder::new()
71543/// #         .with_native_roots()
71544/// #         .unwrap()
71545/// #         .https_or_http()
71546/// #         .enable_http1()
71547/// #         .build()
71548/// # );
71549/// # let mut hub = Dfareporting::new(client, auth);
71550/// // As the method needs a request, you would usually fill it with the desired information
71551/// // into the respective structure. Some of the parts shown here might not be applicable !
71552/// // Values shown here are possibly random and not representative !
71553/// let mut req = Report::default();
71554///
71555/// // You can configure optional parameters by calling the respective setters at will, and
71556/// // execute the final call using `doit()`.
71557/// // Values shown here are possibly random and not representative !
71558/// let result = hub.reports().update(req, -10, -34)
71559///              .doit().await;
71560/// # }
71561/// ```
71562pub struct ReportUpdateCall<'a, C>
71563where
71564    C: 'a,
71565{
71566    hub: &'a Dfareporting<C>,
71567    _request: Report,
71568    _profile_id: i64,
71569    _report_id: i64,
71570    _delegate: Option<&'a mut dyn common::Delegate>,
71571    _additional_params: HashMap<String, String>,
71572    _scopes: BTreeSet<String>,
71573}
71574
71575impl<'a, C> common::CallBuilder for ReportUpdateCall<'a, C> {}
71576
71577impl<'a, C> ReportUpdateCall<'a, C>
71578where
71579    C: common::Connector,
71580{
71581    /// Perform the operation you have build so far.
71582    pub async fn doit(mut self) -> common::Result<(common::Response, Report)> {
71583        use std::borrow::Cow;
71584        use std::io::{Read, Seek};
71585
71586        use common::{url::Params, ToParts};
71587        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
71588
71589        let mut dd = common::DefaultDelegate;
71590        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
71591        dlg.begin(common::MethodInfo {
71592            id: "dfareporting.reports.update",
71593            http_method: hyper::Method::PUT,
71594        });
71595
71596        for &field in ["alt", "profileId", "reportId"].iter() {
71597            if self._additional_params.contains_key(field) {
71598                dlg.finished(false);
71599                return Err(common::Error::FieldClash(field));
71600            }
71601        }
71602
71603        let mut params = Params::with_capacity(5 + self._additional_params.len());
71604        params.push("profileId", self._profile_id.to_string());
71605        params.push("reportId", self._report_id.to_string());
71606
71607        params.extend(self._additional_params.iter());
71608
71609        params.push("alt", "json");
71610        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/reports/{reportId}";
71611        if self._scopes.is_empty() {
71612            self._scopes.insert(Scope::Full.as_ref().to_string());
71613        }
71614
71615        #[allow(clippy::single_element_loop)]
71616        for &(find_this, param_name) in
71617            [("{profileId}", "profileId"), ("{reportId}", "reportId")].iter()
71618        {
71619            url = params.uri_replacement(url, param_name, find_this, false);
71620        }
71621        {
71622            let to_remove = ["reportId", "profileId"];
71623            params.remove_params(&to_remove);
71624        }
71625
71626        let url = params.parse_with_url(&url);
71627
71628        let mut json_mime_type = mime::APPLICATION_JSON;
71629        let mut request_value_reader = {
71630            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
71631            common::remove_json_null_values(&mut value);
71632            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
71633            serde_json::to_writer(&mut dst, &value).unwrap();
71634            dst
71635        };
71636        let request_size = request_value_reader
71637            .seek(std::io::SeekFrom::End(0))
71638            .unwrap();
71639        request_value_reader
71640            .seek(std::io::SeekFrom::Start(0))
71641            .unwrap();
71642
71643        loop {
71644            let token = match self
71645                .hub
71646                .auth
71647                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
71648                .await
71649            {
71650                Ok(token) => token,
71651                Err(e) => match dlg.token(e) {
71652                    Ok(token) => token,
71653                    Err(e) => {
71654                        dlg.finished(false);
71655                        return Err(common::Error::MissingToken(e));
71656                    }
71657                },
71658            };
71659            request_value_reader
71660                .seek(std::io::SeekFrom::Start(0))
71661                .unwrap();
71662            let mut req_result = {
71663                let client = &self.hub.client;
71664                dlg.pre_request();
71665                let mut req_builder = hyper::Request::builder()
71666                    .method(hyper::Method::PUT)
71667                    .uri(url.as_str())
71668                    .header(USER_AGENT, self.hub._user_agent.clone());
71669
71670                if let Some(token) = token.as_ref() {
71671                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
71672                }
71673
71674                let request = req_builder
71675                    .header(CONTENT_TYPE, json_mime_type.to_string())
71676                    .header(CONTENT_LENGTH, request_size as u64)
71677                    .body(common::to_body(
71678                        request_value_reader.get_ref().clone().into(),
71679                    ));
71680
71681                client.request(request.unwrap()).await
71682            };
71683
71684            match req_result {
71685                Err(err) => {
71686                    if let common::Retry::After(d) = dlg.http_error(&err) {
71687                        sleep(d).await;
71688                        continue;
71689                    }
71690                    dlg.finished(false);
71691                    return Err(common::Error::HttpError(err));
71692                }
71693                Ok(res) => {
71694                    let (mut parts, body) = res.into_parts();
71695                    let mut body = common::Body::new(body);
71696                    if !parts.status.is_success() {
71697                        let bytes = common::to_bytes(body).await.unwrap_or_default();
71698                        let error = serde_json::from_str(&common::to_string(&bytes));
71699                        let response = common::to_response(parts, bytes.into());
71700
71701                        if let common::Retry::After(d) =
71702                            dlg.http_failure(&response, error.as_ref().ok())
71703                        {
71704                            sleep(d).await;
71705                            continue;
71706                        }
71707
71708                        dlg.finished(false);
71709
71710                        return Err(match error {
71711                            Ok(value) => common::Error::BadRequest(value),
71712                            _ => common::Error::Failure(response),
71713                        });
71714                    }
71715                    let response = {
71716                        let bytes = common::to_bytes(body).await.unwrap_or_default();
71717                        let encoded = common::to_string(&bytes);
71718                        match serde_json::from_str(&encoded) {
71719                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
71720                            Err(error) => {
71721                                dlg.response_json_decode_error(&encoded, &error);
71722                                return Err(common::Error::JsonDecodeError(
71723                                    encoded.to_string(),
71724                                    error,
71725                                ));
71726                            }
71727                        }
71728                    };
71729
71730                    dlg.finished(true);
71731                    return Ok(response);
71732                }
71733            }
71734        }
71735    }
71736
71737    ///
71738    /// Sets the *request* property to the given value.
71739    ///
71740    /// Even though the property as already been set when instantiating this call,
71741    /// we provide this method for API completeness.
71742    pub fn request(mut self, new_value: Report) -> ReportUpdateCall<'a, C> {
71743        self._request = new_value;
71744        self
71745    }
71746    /// The Campaign Manager 360 user profile ID.
71747    ///
71748    /// Sets the *profile id* path property to the given value.
71749    ///
71750    /// Even though the property as already been set when instantiating this call,
71751    /// we provide this method for API completeness.
71752    pub fn profile_id(mut self, new_value: i64) -> ReportUpdateCall<'a, C> {
71753        self._profile_id = new_value;
71754        self
71755    }
71756    /// The ID of the report.
71757    ///
71758    /// Sets the *report id* path property to the given value.
71759    ///
71760    /// Even though the property as already been set when instantiating this call,
71761    /// we provide this method for API completeness.
71762    pub fn report_id(mut self, new_value: i64) -> ReportUpdateCall<'a, C> {
71763        self._report_id = new_value;
71764        self
71765    }
71766    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
71767    /// while executing the actual API request.
71768    ///
71769    /// ````text
71770    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
71771    /// ````
71772    ///
71773    /// Sets the *delegate* property to the given value.
71774    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ReportUpdateCall<'a, C> {
71775        self._delegate = Some(new_value);
71776        self
71777    }
71778
71779    /// Set any additional parameter of the query string used in the request.
71780    /// It should be used to set parameters which are not yet available through their own
71781    /// setters.
71782    ///
71783    /// Please note that this method must not be used to set any of the known parameters
71784    /// which have their own setter method. If done anyway, the request will fail.
71785    ///
71786    /// # Additional Parameters
71787    ///
71788    /// * *$.xgafv* (query-string) - V1 error format.
71789    /// * *access_token* (query-string) - OAuth access token.
71790    /// * *alt* (query-string) - Data format for response.
71791    /// * *callback* (query-string) - JSONP
71792    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
71793    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
71794    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
71795    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
71796    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
71797    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
71798    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
71799    pub fn param<T>(mut self, name: T, value: T) -> ReportUpdateCall<'a, C>
71800    where
71801        T: AsRef<str>,
71802    {
71803        self._additional_params
71804            .insert(name.as_ref().to_string(), value.as_ref().to_string());
71805        self
71806    }
71807
71808    /// Identifies the authorization scope for the method you are building.
71809    ///
71810    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
71811    /// [`Scope::Full`].
71812    ///
71813    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
71814    /// tokens for more than one scope.
71815    ///
71816    /// Usually there is more than one suitable scope to authorize an operation, some of which may
71817    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
71818    /// sufficient, a read-write scope will do as well.
71819    pub fn add_scope<St>(mut self, scope: St) -> ReportUpdateCall<'a, C>
71820    where
71821        St: AsRef<str>,
71822    {
71823        self._scopes.insert(String::from(scope.as_ref()));
71824        self
71825    }
71826    /// Identifies the authorization scope(s) for the method you are building.
71827    ///
71828    /// See [`Self::add_scope()`] for details.
71829    pub fn add_scopes<I, St>(mut self, scopes: I) -> ReportUpdateCall<'a, C>
71830    where
71831        I: IntoIterator<Item = St>,
71832        St: AsRef<str>,
71833    {
71834        self._scopes
71835            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
71836        self
71837    }
71838
71839    /// Removes all scopes, and no default scope will be used either.
71840    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
71841    /// for details).
71842    pub fn clear_scopes(mut self) -> ReportUpdateCall<'a, C> {
71843        self._scopes.clear();
71844        self
71845    }
71846}
71847
71848/// Gets one site by ID.
71849///
71850/// A builder for the *get* method supported by a *site* resource.
71851/// It is not used directly, but through a [`SiteMethods`] instance.
71852///
71853/// # Example
71854///
71855/// Instantiate a resource method builder
71856///
71857/// ```test_harness,no_run
71858/// # extern crate hyper;
71859/// # extern crate hyper_rustls;
71860/// # extern crate google_dfareporting3d3 as dfareporting3d3;
71861/// # async fn dox() {
71862/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
71863///
71864/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
71865/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
71866/// #     secret,
71867/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
71868/// # ).build().await.unwrap();
71869///
71870/// # let client = hyper_util::client::legacy::Client::builder(
71871/// #     hyper_util::rt::TokioExecutor::new()
71872/// # )
71873/// # .build(
71874/// #     hyper_rustls::HttpsConnectorBuilder::new()
71875/// #         .with_native_roots()
71876/// #         .unwrap()
71877/// #         .https_or_http()
71878/// #         .enable_http1()
71879/// #         .build()
71880/// # );
71881/// # let mut hub = Dfareporting::new(client, auth);
71882/// // You can configure optional parameters by calling the respective setters at will, and
71883/// // execute the final call using `doit()`.
71884/// // Values shown here are possibly random and not representative !
71885/// let result = hub.sites().get(-69, -88)
71886///              .doit().await;
71887/// # }
71888/// ```
71889pub struct SiteGetCall<'a, C>
71890where
71891    C: 'a,
71892{
71893    hub: &'a Dfareporting<C>,
71894    _profile_id: i64,
71895    _id: i64,
71896    _delegate: Option<&'a mut dyn common::Delegate>,
71897    _additional_params: HashMap<String, String>,
71898    _scopes: BTreeSet<String>,
71899}
71900
71901impl<'a, C> common::CallBuilder for SiteGetCall<'a, C> {}
71902
71903impl<'a, C> SiteGetCall<'a, C>
71904where
71905    C: common::Connector,
71906{
71907    /// Perform the operation you have build so far.
71908    pub async fn doit(mut self) -> common::Result<(common::Response, Site)> {
71909        use std::borrow::Cow;
71910        use std::io::{Read, Seek};
71911
71912        use common::{url::Params, ToParts};
71913        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
71914
71915        let mut dd = common::DefaultDelegate;
71916        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
71917        dlg.begin(common::MethodInfo {
71918            id: "dfareporting.sites.get",
71919            http_method: hyper::Method::GET,
71920        });
71921
71922        for &field in ["alt", "profileId", "id"].iter() {
71923            if self._additional_params.contains_key(field) {
71924                dlg.finished(false);
71925                return Err(common::Error::FieldClash(field));
71926            }
71927        }
71928
71929        let mut params = Params::with_capacity(4 + self._additional_params.len());
71930        params.push("profileId", self._profile_id.to_string());
71931        params.push("id", self._id.to_string());
71932
71933        params.extend(self._additional_params.iter());
71934
71935        params.push("alt", "json");
71936        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/sites/{id}";
71937        if self._scopes.is_empty() {
71938            self._scopes
71939                .insert(Scope::Dfatrafficking.as_ref().to_string());
71940        }
71941
71942        #[allow(clippy::single_element_loop)]
71943        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
71944            url = params.uri_replacement(url, param_name, find_this, false);
71945        }
71946        {
71947            let to_remove = ["id", "profileId"];
71948            params.remove_params(&to_remove);
71949        }
71950
71951        let url = params.parse_with_url(&url);
71952
71953        loop {
71954            let token = match self
71955                .hub
71956                .auth
71957                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
71958                .await
71959            {
71960                Ok(token) => token,
71961                Err(e) => match dlg.token(e) {
71962                    Ok(token) => token,
71963                    Err(e) => {
71964                        dlg.finished(false);
71965                        return Err(common::Error::MissingToken(e));
71966                    }
71967                },
71968            };
71969            let mut req_result = {
71970                let client = &self.hub.client;
71971                dlg.pre_request();
71972                let mut req_builder = hyper::Request::builder()
71973                    .method(hyper::Method::GET)
71974                    .uri(url.as_str())
71975                    .header(USER_AGENT, self.hub._user_agent.clone());
71976
71977                if let Some(token) = token.as_ref() {
71978                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
71979                }
71980
71981                let request = req_builder
71982                    .header(CONTENT_LENGTH, 0_u64)
71983                    .body(common::to_body::<String>(None));
71984
71985                client.request(request.unwrap()).await
71986            };
71987
71988            match req_result {
71989                Err(err) => {
71990                    if let common::Retry::After(d) = dlg.http_error(&err) {
71991                        sleep(d).await;
71992                        continue;
71993                    }
71994                    dlg.finished(false);
71995                    return Err(common::Error::HttpError(err));
71996                }
71997                Ok(res) => {
71998                    let (mut parts, body) = res.into_parts();
71999                    let mut body = common::Body::new(body);
72000                    if !parts.status.is_success() {
72001                        let bytes = common::to_bytes(body).await.unwrap_or_default();
72002                        let error = serde_json::from_str(&common::to_string(&bytes));
72003                        let response = common::to_response(parts, bytes.into());
72004
72005                        if let common::Retry::After(d) =
72006                            dlg.http_failure(&response, error.as_ref().ok())
72007                        {
72008                            sleep(d).await;
72009                            continue;
72010                        }
72011
72012                        dlg.finished(false);
72013
72014                        return Err(match error {
72015                            Ok(value) => common::Error::BadRequest(value),
72016                            _ => common::Error::Failure(response),
72017                        });
72018                    }
72019                    let response = {
72020                        let bytes = common::to_bytes(body).await.unwrap_or_default();
72021                        let encoded = common::to_string(&bytes);
72022                        match serde_json::from_str(&encoded) {
72023                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
72024                            Err(error) => {
72025                                dlg.response_json_decode_error(&encoded, &error);
72026                                return Err(common::Error::JsonDecodeError(
72027                                    encoded.to_string(),
72028                                    error,
72029                                ));
72030                            }
72031                        }
72032                    };
72033
72034                    dlg.finished(true);
72035                    return Ok(response);
72036                }
72037            }
72038        }
72039    }
72040
72041    /// User profile ID associated with this request.
72042    ///
72043    /// Sets the *profile id* path property to the given value.
72044    ///
72045    /// Even though the property as already been set when instantiating this call,
72046    /// we provide this method for API completeness.
72047    pub fn profile_id(mut self, new_value: i64) -> SiteGetCall<'a, C> {
72048        self._profile_id = new_value;
72049        self
72050    }
72051    /// Site ID.
72052    ///
72053    /// Sets the *id* path property to the given value.
72054    ///
72055    /// Even though the property as already been set when instantiating this call,
72056    /// we provide this method for API completeness.
72057    pub fn id(mut self, new_value: i64) -> SiteGetCall<'a, C> {
72058        self._id = new_value;
72059        self
72060    }
72061    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
72062    /// while executing the actual API request.
72063    ///
72064    /// ````text
72065    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
72066    /// ````
72067    ///
72068    /// Sets the *delegate* property to the given value.
72069    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> SiteGetCall<'a, C> {
72070        self._delegate = Some(new_value);
72071        self
72072    }
72073
72074    /// Set any additional parameter of the query string used in the request.
72075    /// It should be used to set parameters which are not yet available through their own
72076    /// setters.
72077    ///
72078    /// Please note that this method must not be used to set any of the known parameters
72079    /// which have their own setter method. If done anyway, the request will fail.
72080    ///
72081    /// # Additional Parameters
72082    ///
72083    /// * *$.xgafv* (query-string) - V1 error format.
72084    /// * *access_token* (query-string) - OAuth access token.
72085    /// * *alt* (query-string) - Data format for response.
72086    /// * *callback* (query-string) - JSONP
72087    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
72088    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
72089    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
72090    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
72091    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
72092    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
72093    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
72094    pub fn param<T>(mut self, name: T, value: T) -> SiteGetCall<'a, C>
72095    where
72096        T: AsRef<str>,
72097    {
72098        self._additional_params
72099            .insert(name.as_ref().to_string(), value.as_ref().to_string());
72100        self
72101    }
72102
72103    /// Identifies the authorization scope for the method you are building.
72104    ///
72105    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
72106    /// [`Scope::Dfatrafficking`].
72107    ///
72108    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
72109    /// tokens for more than one scope.
72110    ///
72111    /// Usually there is more than one suitable scope to authorize an operation, some of which may
72112    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
72113    /// sufficient, a read-write scope will do as well.
72114    pub fn add_scope<St>(mut self, scope: St) -> SiteGetCall<'a, C>
72115    where
72116        St: AsRef<str>,
72117    {
72118        self._scopes.insert(String::from(scope.as_ref()));
72119        self
72120    }
72121    /// Identifies the authorization scope(s) for the method you are building.
72122    ///
72123    /// See [`Self::add_scope()`] for details.
72124    pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteGetCall<'a, C>
72125    where
72126        I: IntoIterator<Item = St>,
72127        St: AsRef<str>,
72128    {
72129        self._scopes
72130            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
72131        self
72132    }
72133
72134    /// Removes all scopes, and no default scope will be used either.
72135    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
72136    /// for details).
72137    pub fn clear_scopes(mut self) -> SiteGetCall<'a, C> {
72138        self._scopes.clear();
72139        self
72140    }
72141}
72142
72143/// Inserts a new site.
72144///
72145/// A builder for the *insert* method supported by a *site* resource.
72146/// It is not used directly, but through a [`SiteMethods`] instance.
72147///
72148/// # Example
72149///
72150/// Instantiate a resource method builder
72151///
72152/// ```test_harness,no_run
72153/// # extern crate hyper;
72154/// # extern crate hyper_rustls;
72155/// # extern crate google_dfareporting3d3 as dfareporting3d3;
72156/// use dfareporting3d3::api::Site;
72157/// # async fn dox() {
72158/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
72159///
72160/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
72161/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
72162/// #     secret,
72163/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
72164/// # ).build().await.unwrap();
72165///
72166/// # let client = hyper_util::client::legacy::Client::builder(
72167/// #     hyper_util::rt::TokioExecutor::new()
72168/// # )
72169/// # .build(
72170/// #     hyper_rustls::HttpsConnectorBuilder::new()
72171/// #         .with_native_roots()
72172/// #         .unwrap()
72173/// #         .https_or_http()
72174/// #         .enable_http1()
72175/// #         .build()
72176/// # );
72177/// # let mut hub = Dfareporting::new(client, auth);
72178/// // As the method needs a request, you would usually fill it with the desired information
72179/// // into the respective structure. Some of the parts shown here might not be applicable !
72180/// // Values shown here are possibly random and not representative !
72181/// let mut req = Site::default();
72182///
72183/// // You can configure optional parameters by calling the respective setters at will, and
72184/// // execute the final call using `doit()`.
72185/// // Values shown here are possibly random and not representative !
72186/// let result = hub.sites().insert(req, -89)
72187///              .doit().await;
72188/// # }
72189/// ```
72190pub struct SiteInsertCall<'a, C>
72191where
72192    C: 'a,
72193{
72194    hub: &'a Dfareporting<C>,
72195    _request: Site,
72196    _profile_id: i64,
72197    _delegate: Option<&'a mut dyn common::Delegate>,
72198    _additional_params: HashMap<String, String>,
72199    _scopes: BTreeSet<String>,
72200}
72201
72202impl<'a, C> common::CallBuilder for SiteInsertCall<'a, C> {}
72203
72204impl<'a, C> SiteInsertCall<'a, C>
72205where
72206    C: common::Connector,
72207{
72208    /// Perform the operation you have build so far.
72209    pub async fn doit(mut self) -> common::Result<(common::Response, Site)> {
72210        use std::borrow::Cow;
72211        use std::io::{Read, Seek};
72212
72213        use common::{url::Params, ToParts};
72214        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
72215
72216        let mut dd = common::DefaultDelegate;
72217        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
72218        dlg.begin(common::MethodInfo {
72219            id: "dfareporting.sites.insert",
72220            http_method: hyper::Method::POST,
72221        });
72222
72223        for &field in ["alt", "profileId"].iter() {
72224            if self._additional_params.contains_key(field) {
72225                dlg.finished(false);
72226                return Err(common::Error::FieldClash(field));
72227            }
72228        }
72229
72230        let mut params = Params::with_capacity(4 + self._additional_params.len());
72231        params.push("profileId", self._profile_id.to_string());
72232
72233        params.extend(self._additional_params.iter());
72234
72235        params.push("alt", "json");
72236        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/sites";
72237        if self._scopes.is_empty() {
72238            self._scopes
72239                .insert(Scope::Dfatrafficking.as_ref().to_string());
72240        }
72241
72242        #[allow(clippy::single_element_loop)]
72243        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
72244            url = params.uri_replacement(url, param_name, find_this, false);
72245        }
72246        {
72247            let to_remove = ["profileId"];
72248            params.remove_params(&to_remove);
72249        }
72250
72251        let url = params.parse_with_url(&url);
72252
72253        let mut json_mime_type = mime::APPLICATION_JSON;
72254        let mut request_value_reader = {
72255            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
72256            common::remove_json_null_values(&mut value);
72257            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
72258            serde_json::to_writer(&mut dst, &value).unwrap();
72259            dst
72260        };
72261        let request_size = request_value_reader
72262            .seek(std::io::SeekFrom::End(0))
72263            .unwrap();
72264        request_value_reader
72265            .seek(std::io::SeekFrom::Start(0))
72266            .unwrap();
72267
72268        loop {
72269            let token = match self
72270                .hub
72271                .auth
72272                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
72273                .await
72274            {
72275                Ok(token) => token,
72276                Err(e) => match dlg.token(e) {
72277                    Ok(token) => token,
72278                    Err(e) => {
72279                        dlg.finished(false);
72280                        return Err(common::Error::MissingToken(e));
72281                    }
72282                },
72283            };
72284            request_value_reader
72285                .seek(std::io::SeekFrom::Start(0))
72286                .unwrap();
72287            let mut req_result = {
72288                let client = &self.hub.client;
72289                dlg.pre_request();
72290                let mut req_builder = hyper::Request::builder()
72291                    .method(hyper::Method::POST)
72292                    .uri(url.as_str())
72293                    .header(USER_AGENT, self.hub._user_agent.clone());
72294
72295                if let Some(token) = token.as_ref() {
72296                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
72297                }
72298
72299                let request = req_builder
72300                    .header(CONTENT_TYPE, json_mime_type.to_string())
72301                    .header(CONTENT_LENGTH, request_size as u64)
72302                    .body(common::to_body(
72303                        request_value_reader.get_ref().clone().into(),
72304                    ));
72305
72306                client.request(request.unwrap()).await
72307            };
72308
72309            match req_result {
72310                Err(err) => {
72311                    if let common::Retry::After(d) = dlg.http_error(&err) {
72312                        sleep(d).await;
72313                        continue;
72314                    }
72315                    dlg.finished(false);
72316                    return Err(common::Error::HttpError(err));
72317                }
72318                Ok(res) => {
72319                    let (mut parts, body) = res.into_parts();
72320                    let mut body = common::Body::new(body);
72321                    if !parts.status.is_success() {
72322                        let bytes = common::to_bytes(body).await.unwrap_or_default();
72323                        let error = serde_json::from_str(&common::to_string(&bytes));
72324                        let response = common::to_response(parts, bytes.into());
72325
72326                        if let common::Retry::After(d) =
72327                            dlg.http_failure(&response, error.as_ref().ok())
72328                        {
72329                            sleep(d).await;
72330                            continue;
72331                        }
72332
72333                        dlg.finished(false);
72334
72335                        return Err(match error {
72336                            Ok(value) => common::Error::BadRequest(value),
72337                            _ => common::Error::Failure(response),
72338                        });
72339                    }
72340                    let response = {
72341                        let bytes = common::to_bytes(body).await.unwrap_or_default();
72342                        let encoded = common::to_string(&bytes);
72343                        match serde_json::from_str(&encoded) {
72344                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
72345                            Err(error) => {
72346                                dlg.response_json_decode_error(&encoded, &error);
72347                                return Err(common::Error::JsonDecodeError(
72348                                    encoded.to_string(),
72349                                    error,
72350                                ));
72351                            }
72352                        }
72353                    };
72354
72355                    dlg.finished(true);
72356                    return Ok(response);
72357                }
72358            }
72359        }
72360    }
72361
72362    ///
72363    /// Sets the *request* property to the given value.
72364    ///
72365    /// Even though the property as already been set when instantiating this call,
72366    /// we provide this method for API completeness.
72367    pub fn request(mut self, new_value: Site) -> SiteInsertCall<'a, C> {
72368        self._request = new_value;
72369        self
72370    }
72371    /// User profile ID associated with this request.
72372    ///
72373    /// Sets the *profile id* path property to the given value.
72374    ///
72375    /// Even though the property as already been set when instantiating this call,
72376    /// we provide this method for API completeness.
72377    pub fn profile_id(mut self, new_value: i64) -> SiteInsertCall<'a, C> {
72378        self._profile_id = new_value;
72379        self
72380    }
72381    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
72382    /// while executing the actual API request.
72383    ///
72384    /// ````text
72385    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
72386    /// ````
72387    ///
72388    /// Sets the *delegate* property to the given value.
72389    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> SiteInsertCall<'a, C> {
72390        self._delegate = Some(new_value);
72391        self
72392    }
72393
72394    /// Set any additional parameter of the query string used in the request.
72395    /// It should be used to set parameters which are not yet available through their own
72396    /// setters.
72397    ///
72398    /// Please note that this method must not be used to set any of the known parameters
72399    /// which have their own setter method. If done anyway, the request will fail.
72400    ///
72401    /// # Additional Parameters
72402    ///
72403    /// * *$.xgafv* (query-string) - V1 error format.
72404    /// * *access_token* (query-string) - OAuth access token.
72405    /// * *alt* (query-string) - Data format for response.
72406    /// * *callback* (query-string) - JSONP
72407    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
72408    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
72409    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
72410    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
72411    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
72412    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
72413    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
72414    pub fn param<T>(mut self, name: T, value: T) -> SiteInsertCall<'a, C>
72415    where
72416        T: AsRef<str>,
72417    {
72418        self._additional_params
72419            .insert(name.as_ref().to_string(), value.as_ref().to_string());
72420        self
72421    }
72422
72423    /// Identifies the authorization scope for the method you are building.
72424    ///
72425    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
72426    /// [`Scope::Dfatrafficking`].
72427    ///
72428    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
72429    /// tokens for more than one scope.
72430    ///
72431    /// Usually there is more than one suitable scope to authorize an operation, some of which may
72432    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
72433    /// sufficient, a read-write scope will do as well.
72434    pub fn add_scope<St>(mut self, scope: St) -> SiteInsertCall<'a, C>
72435    where
72436        St: AsRef<str>,
72437    {
72438        self._scopes.insert(String::from(scope.as_ref()));
72439        self
72440    }
72441    /// Identifies the authorization scope(s) for the method you are building.
72442    ///
72443    /// See [`Self::add_scope()`] for details.
72444    pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteInsertCall<'a, C>
72445    where
72446        I: IntoIterator<Item = St>,
72447        St: AsRef<str>,
72448    {
72449        self._scopes
72450            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
72451        self
72452    }
72453
72454    /// Removes all scopes, and no default scope will be used either.
72455    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
72456    /// for details).
72457    pub fn clear_scopes(mut self) -> SiteInsertCall<'a, C> {
72458        self._scopes.clear();
72459        self
72460    }
72461}
72462
72463/// Retrieves a list of sites, possibly filtered. This method supports paging.
72464///
72465/// A builder for the *list* method supported by a *site* resource.
72466/// It is not used directly, but through a [`SiteMethods`] instance.
72467///
72468/// # Example
72469///
72470/// Instantiate a resource method builder
72471///
72472/// ```test_harness,no_run
72473/// # extern crate hyper;
72474/// # extern crate hyper_rustls;
72475/// # extern crate google_dfareporting3d3 as dfareporting3d3;
72476/// # async fn dox() {
72477/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
72478///
72479/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
72480/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
72481/// #     secret,
72482/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
72483/// # ).build().await.unwrap();
72484///
72485/// # let client = hyper_util::client::legacy::Client::builder(
72486/// #     hyper_util::rt::TokioExecutor::new()
72487/// # )
72488/// # .build(
72489/// #     hyper_rustls::HttpsConnectorBuilder::new()
72490/// #         .with_native_roots()
72491/// #         .unwrap()
72492/// #         .https_or_http()
72493/// #         .enable_http1()
72494/// #         .build()
72495/// # );
72496/// # let mut hub = Dfareporting::new(client, auth);
72497/// // You can configure optional parameters by calling the respective setters at will, and
72498/// // execute the final call using `doit()`.
72499/// // Values shown here are possibly random and not representative !
72500/// let result = hub.sites().list(-22)
72501///              .unmapped_site(false)
72502///              .subaccount_id(-85)
72503///              .sort_order("est")
72504///              .sort_field("Stet")
72505///              .search_string("dolor")
72506///              .page_token("et")
72507///              .max_results(-36)
72508///              .add_ids(-86)
72509///              .add_directory_site_ids(-18)
72510///              .add_campaign_ids(-82)
72511///              .approved(true)
72512///              .ad_words_site(true)
72513///              .accepts_publisher_paid_placements(true)
72514///              .accepts_interstitial_placements(false)
72515///              .accepts_in_stream_video_placements(true)
72516///              .doit().await;
72517/// # }
72518/// ```
72519pub struct SiteListCall<'a, C>
72520where
72521    C: 'a,
72522{
72523    hub: &'a Dfareporting<C>,
72524    _profile_id: i64,
72525    _unmapped_site: Option<bool>,
72526    _subaccount_id: Option<i64>,
72527    _sort_order: Option<String>,
72528    _sort_field: Option<String>,
72529    _search_string: Option<String>,
72530    _page_token: Option<String>,
72531    _max_results: Option<i32>,
72532    _ids: Vec<i64>,
72533    _directory_site_ids: Vec<i64>,
72534    _campaign_ids: Vec<i64>,
72535    _approved: Option<bool>,
72536    _ad_words_site: Option<bool>,
72537    _accepts_publisher_paid_placements: Option<bool>,
72538    _accepts_interstitial_placements: Option<bool>,
72539    _accepts_in_stream_video_placements: Option<bool>,
72540    _delegate: Option<&'a mut dyn common::Delegate>,
72541    _additional_params: HashMap<String, String>,
72542    _scopes: BTreeSet<String>,
72543}
72544
72545impl<'a, C> common::CallBuilder for SiteListCall<'a, C> {}
72546
72547impl<'a, C> SiteListCall<'a, C>
72548where
72549    C: common::Connector,
72550{
72551    /// Perform the operation you have build so far.
72552    pub async fn doit(mut self) -> common::Result<(common::Response, SitesListResponse)> {
72553        use std::borrow::Cow;
72554        use std::io::{Read, Seek};
72555
72556        use common::{url::Params, ToParts};
72557        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
72558
72559        let mut dd = common::DefaultDelegate;
72560        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
72561        dlg.begin(common::MethodInfo {
72562            id: "dfareporting.sites.list",
72563            http_method: hyper::Method::GET,
72564        });
72565
72566        for &field in [
72567            "alt",
72568            "profileId",
72569            "unmappedSite",
72570            "subaccountId",
72571            "sortOrder",
72572            "sortField",
72573            "searchString",
72574            "pageToken",
72575            "maxResults",
72576            "ids",
72577            "directorySiteIds",
72578            "campaignIds",
72579            "approved",
72580            "adWordsSite",
72581            "acceptsPublisherPaidPlacements",
72582            "acceptsInterstitialPlacements",
72583            "acceptsInStreamVideoPlacements",
72584        ]
72585        .iter()
72586        {
72587            if self._additional_params.contains_key(field) {
72588                dlg.finished(false);
72589                return Err(common::Error::FieldClash(field));
72590            }
72591        }
72592
72593        let mut params = Params::with_capacity(18 + self._additional_params.len());
72594        params.push("profileId", self._profile_id.to_string());
72595        if let Some(value) = self._unmapped_site.as_ref() {
72596            params.push("unmappedSite", value.to_string());
72597        }
72598        if let Some(value) = self._subaccount_id.as_ref() {
72599            params.push("subaccountId", value.to_string());
72600        }
72601        if let Some(value) = self._sort_order.as_ref() {
72602            params.push("sortOrder", value);
72603        }
72604        if let Some(value) = self._sort_field.as_ref() {
72605            params.push("sortField", value);
72606        }
72607        if let Some(value) = self._search_string.as_ref() {
72608            params.push("searchString", value);
72609        }
72610        if let Some(value) = self._page_token.as_ref() {
72611            params.push("pageToken", value);
72612        }
72613        if let Some(value) = self._max_results.as_ref() {
72614            params.push("maxResults", value.to_string());
72615        }
72616        if !self._ids.is_empty() {
72617            for f in self._ids.iter() {
72618                params.push("ids", f.to_string());
72619            }
72620        }
72621        if !self._directory_site_ids.is_empty() {
72622            for f in self._directory_site_ids.iter() {
72623                params.push("directorySiteIds", f.to_string());
72624            }
72625        }
72626        if !self._campaign_ids.is_empty() {
72627            for f in self._campaign_ids.iter() {
72628                params.push("campaignIds", f.to_string());
72629            }
72630        }
72631        if let Some(value) = self._approved.as_ref() {
72632            params.push("approved", value.to_string());
72633        }
72634        if let Some(value) = self._ad_words_site.as_ref() {
72635            params.push("adWordsSite", value.to_string());
72636        }
72637        if let Some(value) = self._accepts_publisher_paid_placements.as_ref() {
72638            params.push("acceptsPublisherPaidPlacements", value.to_string());
72639        }
72640        if let Some(value) = self._accepts_interstitial_placements.as_ref() {
72641            params.push("acceptsInterstitialPlacements", value.to_string());
72642        }
72643        if let Some(value) = self._accepts_in_stream_video_placements.as_ref() {
72644            params.push("acceptsInStreamVideoPlacements", value.to_string());
72645        }
72646
72647        params.extend(self._additional_params.iter());
72648
72649        params.push("alt", "json");
72650        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/sites";
72651        if self._scopes.is_empty() {
72652            self._scopes
72653                .insert(Scope::Dfatrafficking.as_ref().to_string());
72654        }
72655
72656        #[allow(clippy::single_element_loop)]
72657        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
72658            url = params.uri_replacement(url, param_name, find_this, false);
72659        }
72660        {
72661            let to_remove = ["profileId"];
72662            params.remove_params(&to_remove);
72663        }
72664
72665        let url = params.parse_with_url(&url);
72666
72667        loop {
72668            let token = match self
72669                .hub
72670                .auth
72671                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
72672                .await
72673            {
72674                Ok(token) => token,
72675                Err(e) => match dlg.token(e) {
72676                    Ok(token) => token,
72677                    Err(e) => {
72678                        dlg.finished(false);
72679                        return Err(common::Error::MissingToken(e));
72680                    }
72681                },
72682            };
72683            let mut req_result = {
72684                let client = &self.hub.client;
72685                dlg.pre_request();
72686                let mut req_builder = hyper::Request::builder()
72687                    .method(hyper::Method::GET)
72688                    .uri(url.as_str())
72689                    .header(USER_AGENT, self.hub._user_agent.clone());
72690
72691                if let Some(token) = token.as_ref() {
72692                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
72693                }
72694
72695                let request = req_builder
72696                    .header(CONTENT_LENGTH, 0_u64)
72697                    .body(common::to_body::<String>(None));
72698
72699                client.request(request.unwrap()).await
72700            };
72701
72702            match req_result {
72703                Err(err) => {
72704                    if let common::Retry::After(d) = dlg.http_error(&err) {
72705                        sleep(d).await;
72706                        continue;
72707                    }
72708                    dlg.finished(false);
72709                    return Err(common::Error::HttpError(err));
72710                }
72711                Ok(res) => {
72712                    let (mut parts, body) = res.into_parts();
72713                    let mut body = common::Body::new(body);
72714                    if !parts.status.is_success() {
72715                        let bytes = common::to_bytes(body).await.unwrap_or_default();
72716                        let error = serde_json::from_str(&common::to_string(&bytes));
72717                        let response = common::to_response(parts, bytes.into());
72718
72719                        if let common::Retry::After(d) =
72720                            dlg.http_failure(&response, error.as_ref().ok())
72721                        {
72722                            sleep(d).await;
72723                            continue;
72724                        }
72725
72726                        dlg.finished(false);
72727
72728                        return Err(match error {
72729                            Ok(value) => common::Error::BadRequest(value),
72730                            _ => common::Error::Failure(response),
72731                        });
72732                    }
72733                    let response = {
72734                        let bytes = common::to_bytes(body).await.unwrap_or_default();
72735                        let encoded = common::to_string(&bytes);
72736                        match serde_json::from_str(&encoded) {
72737                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
72738                            Err(error) => {
72739                                dlg.response_json_decode_error(&encoded, &error);
72740                                return Err(common::Error::JsonDecodeError(
72741                                    encoded.to_string(),
72742                                    error,
72743                                ));
72744                            }
72745                        }
72746                    };
72747
72748                    dlg.finished(true);
72749                    return Ok(response);
72750                }
72751            }
72752        }
72753    }
72754
72755    /// User profile ID associated with this request.
72756    ///
72757    /// Sets the *profile id* path property to the given value.
72758    ///
72759    /// Even though the property as already been set when instantiating this call,
72760    /// we provide this method for API completeness.
72761    pub fn profile_id(mut self, new_value: i64) -> SiteListCall<'a, C> {
72762        self._profile_id = new_value;
72763        self
72764    }
72765    /// Select only sites that have not been mapped to a directory site.
72766    ///
72767    /// Sets the *unmapped site* query property to the given value.
72768    pub fn unmapped_site(mut self, new_value: bool) -> SiteListCall<'a, C> {
72769        self._unmapped_site = Some(new_value);
72770        self
72771    }
72772    /// Select only sites with this subaccount ID.
72773    ///
72774    /// Sets the *subaccount id* query property to the given value.
72775    pub fn subaccount_id(mut self, new_value: i64) -> SiteListCall<'a, C> {
72776        self._subaccount_id = Some(new_value);
72777        self
72778    }
72779    /// Order of sorted results.
72780    ///
72781    /// Sets the *sort order* query property to the given value.
72782    pub fn sort_order(mut self, new_value: &str) -> SiteListCall<'a, C> {
72783        self._sort_order = Some(new_value.to_string());
72784        self
72785    }
72786    /// Field by which to sort the list.
72787    ///
72788    /// Sets the *sort field* query property to the given value.
72789    pub fn sort_field(mut self, new_value: &str) -> SiteListCall<'a, C> {
72790        self._sort_field = Some(new_value.to_string());
72791        self
72792    }
72793    /// Allows searching for objects by name, ID or keyName. Wildcards (*) are allowed. For example, "site*2015" will return objects with names like "site June 2015", "site April 2015", or simply "site 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "site" will match objects with name "my site", "site 2015", or simply "site".
72794    ///
72795    /// Sets the *search string* query property to the given value.
72796    pub fn search_string(mut self, new_value: &str) -> SiteListCall<'a, C> {
72797        self._search_string = Some(new_value.to_string());
72798        self
72799    }
72800    /// Value of the nextPageToken from the previous result page.
72801    ///
72802    /// Sets the *page token* query property to the given value.
72803    pub fn page_token(mut self, new_value: &str) -> SiteListCall<'a, C> {
72804        self._page_token = Some(new_value.to_string());
72805        self
72806    }
72807    /// Maximum number of results to return.
72808    ///
72809    /// Sets the *max results* query property to the given value.
72810    pub fn max_results(mut self, new_value: i32) -> SiteListCall<'a, C> {
72811        self._max_results = Some(new_value);
72812        self
72813    }
72814    /// Select only sites with these IDs.
72815    ///
72816    /// Append the given value to the *ids* query property.
72817    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
72818    pub fn add_ids(mut self, new_value: i64) -> SiteListCall<'a, C> {
72819        self._ids.push(new_value);
72820        self
72821    }
72822    /// Select only sites with these directory site IDs.
72823    ///
72824    /// Append the given value to the *directory site ids* query property.
72825    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
72826    pub fn add_directory_site_ids(mut self, new_value: i64) -> SiteListCall<'a, C> {
72827        self._directory_site_ids.push(new_value);
72828        self
72829    }
72830    /// Select only sites with these campaign IDs.
72831    ///
72832    /// Append the given value to the *campaign ids* query property.
72833    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
72834    pub fn add_campaign_ids(mut self, new_value: i64) -> SiteListCall<'a, C> {
72835        self._campaign_ids.push(new_value);
72836        self
72837    }
72838    /// Select only approved sites.
72839    ///
72840    /// Sets the *approved* query property to the given value.
72841    pub fn approved(mut self, new_value: bool) -> SiteListCall<'a, C> {
72842        self._approved = Some(new_value);
72843        self
72844    }
72845    /// Select only AdWords sites.
72846    ///
72847    /// Sets the *ad words site* query property to the given value.
72848    pub fn ad_words_site(mut self, new_value: bool) -> SiteListCall<'a, C> {
72849        self._ad_words_site = Some(new_value);
72850        self
72851    }
72852    /// Select only sites that accept publisher paid placements.
72853    ///
72854    /// Sets the *accepts publisher paid placements* query property to the given value.
72855    pub fn accepts_publisher_paid_placements(mut self, new_value: bool) -> SiteListCall<'a, C> {
72856        self._accepts_publisher_paid_placements = Some(new_value);
72857        self
72858    }
72859    /// This search filter is no longer supported and will have no effect on the results returned.
72860    ///
72861    /// Sets the *accepts interstitial placements* query property to the given value.
72862    pub fn accepts_interstitial_placements(mut self, new_value: bool) -> SiteListCall<'a, C> {
72863        self._accepts_interstitial_placements = Some(new_value);
72864        self
72865    }
72866    /// This search filter is no longer supported and will have no effect on the results returned.
72867    ///
72868    /// Sets the *accepts in stream video placements* query property to the given value.
72869    pub fn accepts_in_stream_video_placements(mut self, new_value: bool) -> SiteListCall<'a, C> {
72870        self._accepts_in_stream_video_placements = Some(new_value);
72871        self
72872    }
72873    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
72874    /// while executing the actual API request.
72875    ///
72876    /// ````text
72877    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
72878    /// ````
72879    ///
72880    /// Sets the *delegate* property to the given value.
72881    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> SiteListCall<'a, C> {
72882        self._delegate = Some(new_value);
72883        self
72884    }
72885
72886    /// Set any additional parameter of the query string used in the request.
72887    /// It should be used to set parameters which are not yet available through their own
72888    /// setters.
72889    ///
72890    /// Please note that this method must not be used to set any of the known parameters
72891    /// which have their own setter method. If done anyway, the request will fail.
72892    ///
72893    /// # Additional Parameters
72894    ///
72895    /// * *$.xgafv* (query-string) - V1 error format.
72896    /// * *access_token* (query-string) - OAuth access token.
72897    /// * *alt* (query-string) - Data format for response.
72898    /// * *callback* (query-string) - JSONP
72899    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
72900    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
72901    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
72902    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
72903    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
72904    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
72905    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
72906    pub fn param<T>(mut self, name: T, value: T) -> SiteListCall<'a, C>
72907    where
72908        T: AsRef<str>,
72909    {
72910        self._additional_params
72911            .insert(name.as_ref().to_string(), value.as_ref().to_string());
72912        self
72913    }
72914
72915    /// Identifies the authorization scope for the method you are building.
72916    ///
72917    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
72918    /// [`Scope::Dfatrafficking`].
72919    ///
72920    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
72921    /// tokens for more than one scope.
72922    ///
72923    /// Usually there is more than one suitable scope to authorize an operation, some of which may
72924    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
72925    /// sufficient, a read-write scope will do as well.
72926    pub fn add_scope<St>(mut self, scope: St) -> SiteListCall<'a, C>
72927    where
72928        St: AsRef<str>,
72929    {
72930        self._scopes.insert(String::from(scope.as_ref()));
72931        self
72932    }
72933    /// Identifies the authorization scope(s) for the method you are building.
72934    ///
72935    /// See [`Self::add_scope()`] for details.
72936    pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteListCall<'a, C>
72937    where
72938        I: IntoIterator<Item = St>,
72939        St: AsRef<str>,
72940    {
72941        self._scopes
72942            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
72943        self
72944    }
72945
72946    /// Removes all scopes, and no default scope will be used either.
72947    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
72948    /// for details).
72949    pub fn clear_scopes(mut self) -> SiteListCall<'a, C> {
72950        self._scopes.clear();
72951        self
72952    }
72953}
72954
72955/// Updates an existing site. This method supports patch semantics.
72956///
72957/// A builder for the *patch* method supported by a *site* resource.
72958/// It is not used directly, but through a [`SiteMethods`] instance.
72959///
72960/// # Example
72961///
72962/// Instantiate a resource method builder
72963///
72964/// ```test_harness,no_run
72965/// # extern crate hyper;
72966/// # extern crate hyper_rustls;
72967/// # extern crate google_dfareporting3d3 as dfareporting3d3;
72968/// use dfareporting3d3::api::Site;
72969/// # async fn dox() {
72970/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
72971///
72972/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
72973/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
72974/// #     secret,
72975/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
72976/// # ).build().await.unwrap();
72977///
72978/// # let client = hyper_util::client::legacy::Client::builder(
72979/// #     hyper_util::rt::TokioExecutor::new()
72980/// # )
72981/// # .build(
72982/// #     hyper_rustls::HttpsConnectorBuilder::new()
72983/// #         .with_native_roots()
72984/// #         .unwrap()
72985/// #         .https_or_http()
72986/// #         .enable_http1()
72987/// #         .build()
72988/// # );
72989/// # let mut hub = Dfareporting::new(client, auth);
72990/// // As the method needs a request, you would usually fill it with the desired information
72991/// // into the respective structure. Some of the parts shown here might not be applicable !
72992/// // Values shown here are possibly random and not representative !
72993/// let mut req = Site::default();
72994///
72995/// // You can configure optional parameters by calling the respective setters at will, and
72996/// // execute the final call using `doit()`.
72997/// // Values shown here are possibly random and not representative !
72998/// let result = hub.sites().patch(req, -90, -52)
72999///              .doit().await;
73000/// # }
73001/// ```
73002pub struct SitePatchCall<'a, C>
73003where
73004    C: 'a,
73005{
73006    hub: &'a Dfareporting<C>,
73007    _request: Site,
73008    _profile_id: i64,
73009    _id: i64,
73010    _delegate: Option<&'a mut dyn common::Delegate>,
73011    _additional_params: HashMap<String, String>,
73012    _scopes: BTreeSet<String>,
73013}
73014
73015impl<'a, C> common::CallBuilder for SitePatchCall<'a, C> {}
73016
73017impl<'a, C> SitePatchCall<'a, C>
73018where
73019    C: common::Connector,
73020{
73021    /// Perform the operation you have build so far.
73022    pub async fn doit(mut self) -> common::Result<(common::Response, Site)> {
73023        use std::borrow::Cow;
73024        use std::io::{Read, Seek};
73025
73026        use common::{url::Params, ToParts};
73027        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
73028
73029        let mut dd = common::DefaultDelegate;
73030        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
73031        dlg.begin(common::MethodInfo {
73032            id: "dfareporting.sites.patch",
73033            http_method: hyper::Method::PATCH,
73034        });
73035
73036        for &field in ["alt", "profileId", "id"].iter() {
73037            if self._additional_params.contains_key(field) {
73038                dlg.finished(false);
73039                return Err(common::Error::FieldClash(field));
73040            }
73041        }
73042
73043        let mut params = Params::with_capacity(5 + self._additional_params.len());
73044        params.push("profileId", self._profile_id.to_string());
73045        params.push("id", self._id.to_string());
73046
73047        params.extend(self._additional_params.iter());
73048
73049        params.push("alt", "json");
73050        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/sites";
73051        if self._scopes.is_empty() {
73052            self._scopes
73053                .insert(Scope::Dfatrafficking.as_ref().to_string());
73054        }
73055
73056        #[allow(clippy::single_element_loop)]
73057        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
73058            url = params.uri_replacement(url, param_name, find_this, false);
73059        }
73060        {
73061            let to_remove = ["profileId"];
73062            params.remove_params(&to_remove);
73063        }
73064
73065        let url = params.parse_with_url(&url);
73066
73067        let mut json_mime_type = mime::APPLICATION_JSON;
73068        let mut request_value_reader = {
73069            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
73070            common::remove_json_null_values(&mut value);
73071            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
73072            serde_json::to_writer(&mut dst, &value).unwrap();
73073            dst
73074        };
73075        let request_size = request_value_reader
73076            .seek(std::io::SeekFrom::End(0))
73077            .unwrap();
73078        request_value_reader
73079            .seek(std::io::SeekFrom::Start(0))
73080            .unwrap();
73081
73082        loop {
73083            let token = match self
73084                .hub
73085                .auth
73086                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
73087                .await
73088            {
73089                Ok(token) => token,
73090                Err(e) => match dlg.token(e) {
73091                    Ok(token) => token,
73092                    Err(e) => {
73093                        dlg.finished(false);
73094                        return Err(common::Error::MissingToken(e));
73095                    }
73096                },
73097            };
73098            request_value_reader
73099                .seek(std::io::SeekFrom::Start(0))
73100                .unwrap();
73101            let mut req_result = {
73102                let client = &self.hub.client;
73103                dlg.pre_request();
73104                let mut req_builder = hyper::Request::builder()
73105                    .method(hyper::Method::PATCH)
73106                    .uri(url.as_str())
73107                    .header(USER_AGENT, self.hub._user_agent.clone());
73108
73109                if let Some(token) = token.as_ref() {
73110                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
73111                }
73112
73113                let request = req_builder
73114                    .header(CONTENT_TYPE, json_mime_type.to_string())
73115                    .header(CONTENT_LENGTH, request_size as u64)
73116                    .body(common::to_body(
73117                        request_value_reader.get_ref().clone().into(),
73118                    ));
73119
73120                client.request(request.unwrap()).await
73121            };
73122
73123            match req_result {
73124                Err(err) => {
73125                    if let common::Retry::After(d) = dlg.http_error(&err) {
73126                        sleep(d).await;
73127                        continue;
73128                    }
73129                    dlg.finished(false);
73130                    return Err(common::Error::HttpError(err));
73131                }
73132                Ok(res) => {
73133                    let (mut parts, body) = res.into_parts();
73134                    let mut body = common::Body::new(body);
73135                    if !parts.status.is_success() {
73136                        let bytes = common::to_bytes(body).await.unwrap_or_default();
73137                        let error = serde_json::from_str(&common::to_string(&bytes));
73138                        let response = common::to_response(parts, bytes.into());
73139
73140                        if let common::Retry::After(d) =
73141                            dlg.http_failure(&response, error.as_ref().ok())
73142                        {
73143                            sleep(d).await;
73144                            continue;
73145                        }
73146
73147                        dlg.finished(false);
73148
73149                        return Err(match error {
73150                            Ok(value) => common::Error::BadRequest(value),
73151                            _ => common::Error::Failure(response),
73152                        });
73153                    }
73154                    let response = {
73155                        let bytes = common::to_bytes(body).await.unwrap_or_default();
73156                        let encoded = common::to_string(&bytes);
73157                        match serde_json::from_str(&encoded) {
73158                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
73159                            Err(error) => {
73160                                dlg.response_json_decode_error(&encoded, &error);
73161                                return Err(common::Error::JsonDecodeError(
73162                                    encoded.to_string(),
73163                                    error,
73164                                ));
73165                            }
73166                        }
73167                    };
73168
73169                    dlg.finished(true);
73170                    return Ok(response);
73171                }
73172            }
73173        }
73174    }
73175
73176    ///
73177    /// Sets the *request* property to the given value.
73178    ///
73179    /// Even though the property as already been set when instantiating this call,
73180    /// we provide this method for API completeness.
73181    pub fn request(mut self, new_value: Site) -> SitePatchCall<'a, C> {
73182        self._request = new_value;
73183        self
73184    }
73185    /// User profile ID associated with this request.
73186    ///
73187    /// Sets the *profile id* path property to the given value.
73188    ///
73189    /// Even though the property as already been set when instantiating this call,
73190    /// we provide this method for API completeness.
73191    pub fn profile_id(mut self, new_value: i64) -> SitePatchCall<'a, C> {
73192        self._profile_id = new_value;
73193        self
73194    }
73195    /// Site ID.
73196    ///
73197    /// Sets the *id* query property to the given value.
73198    ///
73199    /// Even though the property as already been set when instantiating this call,
73200    /// we provide this method for API completeness.
73201    pub fn id(mut self, new_value: i64) -> SitePatchCall<'a, C> {
73202        self._id = new_value;
73203        self
73204    }
73205    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
73206    /// while executing the actual API request.
73207    ///
73208    /// ````text
73209    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
73210    /// ````
73211    ///
73212    /// Sets the *delegate* property to the given value.
73213    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> SitePatchCall<'a, C> {
73214        self._delegate = Some(new_value);
73215        self
73216    }
73217
73218    /// Set any additional parameter of the query string used in the request.
73219    /// It should be used to set parameters which are not yet available through their own
73220    /// setters.
73221    ///
73222    /// Please note that this method must not be used to set any of the known parameters
73223    /// which have their own setter method. If done anyway, the request will fail.
73224    ///
73225    /// # Additional Parameters
73226    ///
73227    /// * *$.xgafv* (query-string) - V1 error format.
73228    /// * *access_token* (query-string) - OAuth access token.
73229    /// * *alt* (query-string) - Data format for response.
73230    /// * *callback* (query-string) - JSONP
73231    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
73232    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
73233    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
73234    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
73235    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
73236    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
73237    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
73238    pub fn param<T>(mut self, name: T, value: T) -> SitePatchCall<'a, C>
73239    where
73240        T: AsRef<str>,
73241    {
73242        self._additional_params
73243            .insert(name.as_ref().to_string(), value.as_ref().to_string());
73244        self
73245    }
73246
73247    /// Identifies the authorization scope for the method you are building.
73248    ///
73249    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
73250    /// [`Scope::Dfatrafficking`].
73251    ///
73252    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
73253    /// tokens for more than one scope.
73254    ///
73255    /// Usually there is more than one suitable scope to authorize an operation, some of which may
73256    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
73257    /// sufficient, a read-write scope will do as well.
73258    pub fn add_scope<St>(mut self, scope: St) -> SitePatchCall<'a, C>
73259    where
73260        St: AsRef<str>,
73261    {
73262        self._scopes.insert(String::from(scope.as_ref()));
73263        self
73264    }
73265    /// Identifies the authorization scope(s) for the method you are building.
73266    ///
73267    /// See [`Self::add_scope()`] for details.
73268    pub fn add_scopes<I, St>(mut self, scopes: I) -> SitePatchCall<'a, C>
73269    where
73270        I: IntoIterator<Item = St>,
73271        St: AsRef<str>,
73272    {
73273        self._scopes
73274            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
73275        self
73276    }
73277
73278    /// Removes all scopes, and no default scope will be used either.
73279    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
73280    /// for details).
73281    pub fn clear_scopes(mut self) -> SitePatchCall<'a, C> {
73282        self._scopes.clear();
73283        self
73284    }
73285}
73286
73287/// Updates an existing site.
73288///
73289/// A builder for the *update* method supported by a *site* resource.
73290/// It is not used directly, but through a [`SiteMethods`] instance.
73291///
73292/// # Example
73293///
73294/// Instantiate a resource method builder
73295///
73296/// ```test_harness,no_run
73297/// # extern crate hyper;
73298/// # extern crate hyper_rustls;
73299/// # extern crate google_dfareporting3d3 as dfareporting3d3;
73300/// use dfareporting3d3::api::Site;
73301/// # async fn dox() {
73302/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
73303///
73304/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
73305/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
73306/// #     secret,
73307/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
73308/// # ).build().await.unwrap();
73309///
73310/// # let client = hyper_util::client::legacy::Client::builder(
73311/// #     hyper_util::rt::TokioExecutor::new()
73312/// # )
73313/// # .build(
73314/// #     hyper_rustls::HttpsConnectorBuilder::new()
73315/// #         .with_native_roots()
73316/// #         .unwrap()
73317/// #         .https_or_http()
73318/// #         .enable_http1()
73319/// #         .build()
73320/// # );
73321/// # let mut hub = Dfareporting::new(client, auth);
73322/// // As the method needs a request, you would usually fill it with the desired information
73323/// // into the respective structure. Some of the parts shown here might not be applicable !
73324/// // Values shown here are possibly random and not representative !
73325/// let mut req = Site::default();
73326///
73327/// // You can configure optional parameters by calling the respective setters at will, and
73328/// // execute the final call using `doit()`.
73329/// // Values shown here are possibly random and not representative !
73330/// let result = hub.sites().update(req, -9)
73331///              .doit().await;
73332/// # }
73333/// ```
73334pub struct SiteUpdateCall<'a, C>
73335where
73336    C: 'a,
73337{
73338    hub: &'a Dfareporting<C>,
73339    _request: Site,
73340    _profile_id: i64,
73341    _delegate: Option<&'a mut dyn common::Delegate>,
73342    _additional_params: HashMap<String, String>,
73343    _scopes: BTreeSet<String>,
73344}
73345
73346impl<'a, C> common::CallBuilder for SiteUpdateCall<'a, C> {}
73347
73348impl<'a, C> SiteUpdateCall<'a, C>
73349where
73350    C: common::Connector,
73351{
73352    /// Perform the operation you have build so far.
73353    pub async fn doit(mut self) -> common::Result<(common::Response, Site)> {
73354        use std::borrow::Cow;
73355        use std::io::{Read, Seek};
73356
73357        use common::{url::Params, ToParts};
73358        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
73359
73360        let mut dd = common::DefaultDelegate;
73361        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
73362        dlg.begin(common::MethodInfo {
73363            id: "dfareporting.sites.update",
73364            http_method: hyper::Method::PUT,
73365        });
73366
73367        for &field in ["alt", "profileId"].iter() {
73368            if self._additional_params.contains_key(field) {
73369                dlg.finished(false);
73370                return Err(common::Error::FieldClash(field));
73371            }
73372        }
73373
73374        let mut params = Params::with_capacity(4 + self._additional_params.len());
73375        params.push("profileId", self._profile_id.to_string());
73376
73377        params.extend(self._additional_params.iter());
73378
73379        params.push("alt", "json");
73380        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/sites";
73381        if self._scopes.is_empty() {
73382            self._scopes
73383                .insert(Scope::Dfatrafficking.as_ref().to_string());
73384        }
73385
73386        #[allow(clippy::single_element_loop)]
73387        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
73388            url = params.uri_replacement(url, param_name, find_this, false);
73389        }
73390        {
73391            let to_remove = ["profileId"];
73392            params.remove_params(&to_remove);
73393        }
73394
73395        let url = params.parse_with_url(&url);
73396
73397        let mut json_mime_type = mime::APPLICATION_JSON;
73398        let mut request_value_reader = {
73399            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
73400            common::remove_json_null_values(&mut value);
73401            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
73402            serde_json::to_writer(&mut dst, &value).unwrap();
73403            dst
73404        };
73405        let request_size = request_value_reader
73406            .seek(std::io::SeekFrom::End(0))
73407            .unwrap();
73408        request_value_reader
73409            .seek(std::io::SeekFrom::Start(0))
73410            .unwrap();
73411
73412        loop {
73413            let token = match self
73414                .hub
73415                .auth
73416                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
73417                .await
73418            {
73419                Ok(token) => token,
73420                Err(e) => match dlg.token(e) {
73421                    Ok(token) => token,
73422                    Err(e) => {
73423                        dlg.finished(false);
73424                        return Err(common::Error::MissingToken(e));
73425                    }
73426                },
73427            };
73428            request_value_reader
73429                .seek(std::io::SeekFrom::Start(0))
73430                .unwrap();
73431            let mut req_result = {
73432                let client = &self.hub.client;
73433                dlg.pre_request();
73434                let mut req_builder = hyper::Request::builder()
73435                    .method(hyper::Method::PUT)
73436                    .uri(url.as_str())
73437                    .header(USER_AGENT, self.hub._user_agent.clone());
73438
73439                if let Some(token) = token.as_ref() {
73440                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
73441                }
73442
73443                let request = req_builder
73444                    .header(CONTENT_TYPE, json_mime_type.to_string())
73445                    .header(CONTENT_LENGTH, request_size as u64)
73446                    .body(common::to_body(
73447                        request_value_reader.get_ref().clone().into(),
73448                    ));
73449
73450                client.request(request.unwrap()).await
73451            };
73452
73453            match req_result {
73454                Err(err) => {
73455                    if let common::Retry::After(d) = dlg.http_error(&err) {
73456                        sleep(d).await;
73457                        continue;
73458                    }
73459                    dlg.finished(false);
73460                    return Err(common::Error::HttpError(err));
73461                }
73462                Ok(res) => {
73463                    let (mut parts, body) = res.into_parts();
73464                    let mut body = common::Body::new(body);
73465                    if !parts.status.is_success() {
73466                        let bytes = common::to_bytes(body).await.unwrap_or_default();
73467                        let error = serde_json::from_str(&common::to_string(&bytes));
73468                        let response = common::to_response(parts, bytes.into());
73469
73470                        if let common::Retry::After(d) =
73471                            dlg.http_failure(&response, error.as_ref().ok())
73472                        {
73473                            sleep(d).await;
73474                            continue;
73475                        }
73476
73477                        dlg.finished(false);
73478
73479                        return Err(match error {
73480                            Ok(value) => common::Error::BadRequest(value),
73481                            _ => common::Error::Failure(response),
73482                        });
73483                    }
73484                    let response = {
73485                        let bytes = common::to_bytes(body).await.unwrap_or_default();
73486                        let encoded = common::to_string(&bytes);
73487                        match serde_json::from_str(&encoded) {
73488                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
73489                            Err(error) => {
73490                                dlg.response_json_decode_error(&encoded, &error);
73491                                return Err(common::Error::JsonDecodeError(
73492                                    encoded.to_string(),
73493                                    error,
73494                                ));
73495                            }
73496                        }
73497                    };
73498
73499                    dlg.finished(true);
73500                    return Ok(response);
73501                }
73502            }
73503        }
73504    }
73505
73506    ///
73507    /// Sets the *request* property to the given value.
73508    ///
73509    /// Even though the property as already been set when instantiating this call,
73510    /// we provide this method for API completeness.
73511    pub fn request(mut self, new_value: Site) -> SiteUpdateCall<'a, C> {
73512        self._request = new_value;
73513        self
73514    }
73515    /// User profile ID associated with this request.
73516    ///
73517    /// Sets the *profile id* path property to the given value.
73518    ///
73519    /// Even though the property as already been set when instantiating this call,
73520    /// we provide this method for API completeness.
73521    pub fn profile_id(mut self, new_value: i64) -> SiteUpdateCall<'a, C> {
73522        self._profile_id = new_value;
73523        self
73524    }
73525    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
73526    /// while executing the actual API request.
73527    ///
73528    /// ````text
73529    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
73530    /// ````
73531    ///
73532    /// Sets the *delegate* property to the given value.
73533    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> SiteUpdateCall<'a, C> {
73534        self._delegate = Some(new_value);
73535        self
73536    }
73537
73538    /// Set any additional parameter of the query string used in the request.
73539    /// It should be used to set parameters which are not yet available through their own
73540    /// setters.
73541    ///
73542    /// Please note that this method must not be used to set any of the known parameters
73543    /// which have their own setter method. If done anyway, the request will fail.
73544    ///
73545    /// # Additional Parameters
73546    ///
73547    /// * *$.xgafv* (query-string) - V1 error format.
73548    /// * *access_token* (query-string) - OAuth access token.
73549    /// * *alt* (query-string) - Data format for response.
73550    /// * *callback* (query-string) - JSONP
73551    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
73552    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
73553    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
73554    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
73555    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
73556    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
73557    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
73558    pub fn param<T>(mut self, name: T, value: T) -> SiteUpdateCall<'a, C>
73559    where
73560        T: AsRef<str>,
73561    {
73562        self._additional_params
73563            .insert(name.as_ref().to_string(), value.as_ref().to_string());
73564        self
73565    }
73566
73567    /// Identifies the authorization scope for the method you are building.
73568    ///
73569    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
73570    /// [`Scope::Dfatrafficking`].
73571    ///
73572    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
73573    /// tokens for more than one scope.
73574    ///
73575    /// Usually there is more than one suitable scope to authorize an operation, some of which may
73576    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
73577    /// sufficient, a read-write scope will do as well.
73578    pub fn add_scope<St>(mut self, scope: St) -> SiteUpdateCall<'a, C>
73579    where
73580        St: AsRef<str>,
73581    {
73582        self._scopes.insert(String::from(scope.as_ref()));
73583        self
73584    }
73585    /// Identifies the authorization scope(s) for the method you are building.
73586    ///
73587    /// See [`Self::add_scope()`] for details.
73588    pub fn add_scopes<I, St>(mut self, scopes: I) -> SiteUpdateCall<'a, C>
73589    where
73590        I: IntoIterator<Item = St>,
73591        St: AsRef<str>,
73592    {
73593        self._scopes
73594            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
73595        self
73596    }
73597
73598    /// Removes all scopes, and no default scope will be used either.
73599    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
73600    /// for details).
73601    pub fn clear_scopes(mut self) -> SiteUpdateCall<'a, C> {
73602        self._scopes.clear();
73603        self
73604    }
73605}
73606
73607/// Gets one size by ID.
73608///
73609/// A builder for the *get* method supported by a *size* resource.
73610/// It is not used directly, but through a [`SizeMethods`] instance.
73611///
73612/// # Example
73613///
73614/// Instantiate a resource method builder
73615///
73616/// ```test_harness,no_run
73617/// # extern crate hyper;
73618/// # extern crate hyper_rustls;
73619/// # extern crate google_dfareporting3d3 as dfareporting3d3;
73620/// # async fn dox() {
73621/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
73622///
73623/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
73624/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
73625/// #     secret,
73626/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
73627/// # ).build().await.unwrap();
73628///
73629/// # let client = hyper_util::client::legacy::Client::builder(
73630/// #     hyper_util::rt::TokioExecutor::new()
73631/// # )
73632/// # .build(
73633/// #     hyper_rustls::HttpsConnectorBuilder::new()
73634/// #         .with_native_roots()
73635/// #         .unwrap()
73636/// #         .https_or_http()
73637/// #         .enable_http1()
73638/// #         .build()
73639/// # );
73640/// # let mut hub = Dfareporting::new(client, auth);
73641/// // You can configure optional parameters by calling the respective setters at will, and
73642/// // execute the final call using `doit()`.
73643/// // Values shown here are possibly random and not representative !
73644/// let result = hub.sizes().get(-52, -22)
73645///              .doit().await;
73646/// # }
73647/// ```
73648pub struct SizeGetCall<'a, C>
73649where
73650    C: 'a,
73651{
73652    hub: &'a Dfareporting<C>,
73653    _profile_id: i64,
73654    _id: i64,
73655    _delegate: Option<&'a mut dyn common::Delegate>,
73656    _additional_params: HashMap<String, String>,
73657    _scopes: BTreeSet<String>,
73658}
73659
73660impl<'a, C> common::CallBuilder for SizeGetCall<'a, C> {}
73661
73662impl<'a, C> SizeGetCall<'a, C>
73663where
73664    C: common::Connector,
73665{
73666    /// Perform the operation you have build so far.
73667    pub async fn doit(mut self) -> common::Result<(common::Response, Size)> {
73668        use std::borrow::Cow;
73669        use std::io::{Read, Seek};
73670
73671        use common::{url::Params, ToParts};
73672        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
73673
73674        let mut dd = common::DefaultDelegate;
73675        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
73676        dlg.begin(common::MethodInfo {
73677            id: "dfareporting.sizes.get",
73678            http_method: hyper::Method::GET,
73679        });
73680
73681        for &field in ["alt", "profileId", "id"].iter() {
73682            if self._additional_params.contains_key(field) {
73683                dlg.finished(false);
73684                return Err(common::Error::FieldClash(field));
73685            }
73686        }
73687
73688        let mut params = Params::with_capacity(4 + self._additional_params.len());
73689        params.push("profileId", self._profile_id.to_string());
73690        params.push("id", self._id.to_string());
73691
73692        params.extend(self._additional_params.iter());
73693
73694        params.push("alt", "json");
73695        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/sizes/{id}";
73696        if self._scopes.is_empty() {
73697            self._scopes
73698                .insert(Scope::Dfatrafficking.as_ref().to_string());
73699        }
73700
73701        #[allow(clippy::single_element_loop)]
73702        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
73703            url = params.uri_replacement(url, param_name, find_this, false);
73704        }
73705        {
73706            let to_remove = ["id", "profileId"];
73707            params.remove_params(&to_remove);
73708        }
73709
73710        let url = params.parse_with_url(&url);
73711
73712        loop {
73713            let token = match self
73714                .hub
73715                .auth
73716                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
73717                .await
73718            {
73719                Ok(token) => token,
73720                Err(e) => match dlg.token(e) {
73721                    Ok(token) => token,
73722                    Err(e) => {
73723                        dlg.finished(false);
73724                        return Err(common::Error::MissingToken(e));
73725                    }
73726                },
73727            };
73728            let mut req_result = {
73729                let client = &self.hub.client;
73730                dlg.pre_request();
73731                let mut req_builder = hyper::Request::builder()
73732                    .method(hyper::Method::GET)
73733                    .uri(url.as_str())
73734                    .header(USER_AGENT, self.hub._user_agent.clone());
73735
73736                if let Some(token) = token.as_ref() {
73737                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
73738                }
73739
73740                let request = req_builder
73741                    .header(CONTENT_LENGTH, 0_u64)
73742                    .body(common::to_body::<String>(None));
73743
73744                client.request(request.unwrap()).await
73745            };
73746
73747            match req_result {
73748                Err(err) => {
73749                    if let common::Retry::After(d) = dlg.http_error(&err) {
73750                        sleep(d).await;
73751                        continue;
73752                    }
73753                    dlg.finished(false);
73754                    return Err(common::Error::HttpError(err));
73755                }
73756                Ok(res) => {
73757                    let (mut parts, body) = res.into_parts();
73758                    let mut body = common::Body::new(body);
73759                    if !parts.status.is_success() {
73760                        let bytes = common::to_bytes(body).await.unwrap_or_default();
73761                        let error = serde_json::from_str(&common::to_string(&bytes));
73762                        let response = common::to_response(parts, bytes.into());
73763
73764                        if let common::Retry::After(d) =
73765                            dlg.http_failure(&response, error.as_ref().ok())
73766                        {
73767                            sleep(d).await;
73768                            continue;
73769                        }
73770
73771                        dlg.finished(false);
73772
73773                        return Err(match error {
73774                            Ok(value) => common::Error::BadRequest(value),
73775                            _ => common::Error::Failure(response),
73776                        });
73777                    }
73778                    let response = {
73779                        let bytes = common::to_bytes(body).await.unwrap_or_default();
73780                        let encoded = common::to_string(&bytes);
73781                        match serde_json::from_str(&encoded) {
73782                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
73783                            Err(error) => {
73784                                dlg.response_json_decode_error(&encoded, &error);
73785                                return Err(common::Error::JsonDecodeError(
73786                                    encoded.to_string(),
73787                                    error,
73788                                ));
73789                            }
73790                        }
73791                    };
73792
73793                    dlg.finished(true);
73794                    return Ok(response);
73795                }
73796            }
73797        }
73798    }
73799
73800    /// User profile ID associated with this request.
73801    ///
73802    /// Sets the *profile id* path property to the given value.
73803    ///
73804    /// Even though the property as already been set when instantiating this call,
73805    /// we provide this method for API completeness.
73806    pub fn profile_id(mut self, new_value: i64) -> SizeGetCall<'a, C> {
73807        self._profile_id = new_value;
73808        self
73809    }
73810    /// Size ID.
73811    ///
73812    /// Sets the *id* path property to the given value.
73813    ///
73814    /// Even though the property as already been set when instantiating this call,
73815    /// we provide this method for API completeness.
73816    pub fn id(mut self, new_value: i64) -> SizeGetCall<'a, C> {
73817        self._id = new_value;
73818        self
73819    }
73820    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
73821    /// while executing the actual API request.
73822    ///
73823    /// ````text
73824    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
73825    /// ````
73826    ///
73827    /// Sets the *delegate* property to the given value.
73828    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> SizeGetCall<'a, C> {
73829        self._delegate = Some(new_value);
73830        self
73831    }
73832
73833    /// Set any additional parameter of the query string used in the request.
73834    /// It should be used to set parameters which are not yet available through their own
73835    /// setters.
73836    ///
73837    /// Please note that this method must not be used to set any of the known parameters
73838    /// which have their own setter method. If done anyway, the request will fail.
73839    ///
73840    /// # Additional Parameters
73841    ///
73842    /// * *$.xgafv* (query-string) - V1 error format.
73843    /// * *access_token* (query-string) - OAuth access token.
73844    /// * *alt* (query-string) - Data format for response.
73845    /// * *callback* (query-string) - JSONP
73846    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
73847    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
73848    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
73849    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
73850    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
73851    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
73852    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
73853    pub fn param<T>(mut self, name: T, value: T) -> SizeGetCall<'a, C>
73854    where
73855        T: AsRef<str>,
73856    {
73857        self._additional_params
73858            .insert(name.as_ref().to_string(), value.as_ref().to_string());
73859        self
73860    }
73861
73862    /// Identifies the authorization scope for the method you are building.
73863    ///
73864    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
73865    /// [`Scope::Dfatrafficking`].
73866    ///
73867    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
73868    /// tokens for more than one scope.
73869    ///
73870    /// Usually there is more than one suitable scope to authorize an operation, some of which may
73871    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
73872    /// sufficient, a read-write scope will do as well.
73873    pub fn add_scope<St>(mut self, scope: St) -> SizeGetCall<'a, C>
73874    where
73875        St: AsRef<str>,
73876    {
73877        self._scopes.insert(String::from(scope.as_ref()));
73878        self
73879    }
73880    /// Identifies the authorization scope(s) for the method you are building.
73881    ///
73882    /// See [`Self::add_scope()`] for details.
73883    pub fn add_scopes<I, St>(mut self, scopes: I) -> SizeGetCall<'a, C>
73884    where
73885        I: IntoIterator<Item = St>,
73886        St: AsRef<str>,
73887    {
73888        self._scopes
73889            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
73890        self
73891    }
73892
73893    /// Removes all scopes, and no default scope will be used either.
73894    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
73895    /// for details).
73896    pub fn clear_scopes(mut self) -> SizeGetCall<'a, C> {
73897        self._scopes.clear();
73898        self
73899    }
73900}
73901
73902/// Inserts a new size.
73903///
73904/// A builder for the *insert* method supported by a *size* resource.
73905/// It is not used directly, but through a [`SizeMethods`] instance.
73906///
73907/// # Example
73908///
73909/// Instantiate a resource method builder
73910///
73911/// ```test_harness,no_run
73912/// # extern crate hyper;
73913/// # extern crate hyper_rustls;
73914/// # extern crate google_dfareporting3d3 as dfareporting3d3;
73915/// use dfareporting3d3::api::Size;
73916/// # async fn dox() {
73917/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
73918///
73919/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
73920/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
73921/// #     secret,
73922/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
73923/// # ).build().await.unwrap();
73924///
73925/// # let client = hyper_util::client::legacy::Client::builder(
73926/// #     hyper_util::rt::TokioExecutor::new()
73927/// # )
73928/// # .build(
73929/// #     hyper_rustls::HttpsConnectorBuilder::new()
73930/// #         .with_native_roots()
73931/// #         .unwrap()
73932/// #         .https_or_http()
73933/// #         .enable_http1()
73934/// #         .build()
73935/// # );
73936/// # let mut hub = Dfareporting::new(client, auth);
73937/// // As the method needs a request, you would usually fill it with the desired information
73938/// // into the respective structure. Some of the parts shown here might not be applicable !
73939/// // Values shown here are possibly random and not representative !
73940/// let mut req = Size::default();
73941///
73942/// // You can configure optional parameters by calling the respective setters at will, and
73943/// // execute the final call using `doit()`.
73944/// // Values shown here are possibly random and not representative !
73945/// let result = hub.sizes().insert(req, -36)
73946///              .doit().await;
73947/// # }
73948/// ```
73949pub struct SizeInsertCall<'a, C>
73950where
73951    C: 'a,
73952{
73953    hub: &'a Dfareporting<C>,
73954    _request: Size,
73955    _profile_id: i64,
73956    _delegate: Option<&'a mut dyn common::Delegate>,
73957    _additional_params: HashMap<String, String>,
73958    _scopes: BTreeSet<String>,
73959}
73960
73961impl<'a, C> common::CallBuilder for SizeInsertCall<'a, C> {}
73962
73963impl<'a, C> SizeInsertCall<'a, C>
73964where
73965    C: common::Connector,
73966{
73967    /// Perform the operation you have build so far.
73968    pub async fn doit(mut self) -> common::Result<(common::Response, Size)> {
73969        use std::borrow::Cow;
73970        use std::io::{Read, Seek};
73971
73972        use common::{url::Params, ToParts};
73973        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
73974
73975        let mut dd = common::DefaultDelegate;
73976        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
73977        dlg.begin(common::MethodInfo {
73978            id: "dfareporting.sizes.insert",
73979            http_method: hyper::Method::POST,
73980        });
73981
73982        for &field in ["alt", "profileId"].iter() {
73983            if self._additional_params.contains_key(field) {
73984                dlg.finished(false);
73985                return Err(common::Error::FieldClash(field));
73986            }
73987        }
73988
73989        let mut params = Params::with_capacity(4 + self._additional_params.len());
73990        params.push("profileId", self._profile_id.to_string());
73991
73992        params.extend(self._additional_params.iter());
73993
73994        params.push("alt", "json");
73995        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/sizes";
73996        if self._scopes.is_empty() {
73997            self._scopes
73998                .insert(Scope::Dfatrafficking.as_ref().to_string());
73999        }
74000
74001        #[allow(clippy::single_element_loop)]
74002        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
74003            url = params.uri_replacement(url, param_name, find_this, false);
74004        }
74005        {
74006            let to_remove = ["profileId"];
74007            params.remove_params(&to_remove);
74008        }
74009
74010        let url = params.parse_with_url(&url);
74011
74012        let mut json_mime_type = mime::APPLICATION_JSON;
74013        let mut request_value_reader = {
74014            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
74015            common::remove_json_null_values(&mut value);
74016            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
74017            serde_json::to_writer(&mut dst, &value).unwrap();
74018            dst
74019        };
74020        let request_size = request_value_reader
74021            .seek(std::io::SeekFrom::End(0))
74022            .unwrap();
74023        request_value_reader
74024            .seek(std::io::SeekFrom::Start(0))
74025            .unwrap();
74026
74027        loop {
74028            let token = match self
74029                .hub
74030                .auth
74031                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
74032                .await
74033            {
74034                Ok(token) => token,
74035                Err(e) => match dlg.token(e) {
74036                    Ok(token) => token,
74037                    Err(e) => {
74038                        dlg.finished(false);
74039                        return Err(common::Error::MissingToken(e));
74040                    }
74041                },
74042            };
74043            request_value_reader
74044                .seek(std::io::SeekFrom::Start(0))
74045                .unwrap();
74046            let mut req_result = {
74047                let client = &self.hub.client;
74048                dlg.pre_request();
74049                let mut req_builder = hyper::Request::builder()
74050                    .method(hyper::Method::POST)
74051                    .uri(url.as_str())
74052                    .header(USER_AGENT, self.hub._user_agent.clone());
74053
74054                if let Some(token) = token.as_ref() {
74055                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
74056                }
74057
74058                let request = req_builder
74059                    .header(CONTENT_TYPE, json_mime_type.to_string())
74060                    .header(CONTENT_LENGTH, request_size as u64)
74061                    .body(common::to_body(
74062                        request_value_reader.get_ref().clone().into(),
74063                    ));
74064
74065                client.request(request.unwrap()).await
74066            };
74067
74068            match req_result {
74069                Err(err) => {
74070                    if let common::Retry::After(d) = dlg.http_error(&err) {
74071                        sleep(d).await;
74072                        continue;
74073                    }
74074                    dlg.finished(false);
74075                    return Err(common::Error::HttpError(err));
74076                }
74077                Ok(res) => {
74078                    let (mut parts, body) = res.into_parts();
74079                    let mut body = common::Body::new(body);
74080                    if !parts.status.is_success() {
74081                        let bytes = common::to_bytes(body).await.unwrap_or_default();
74082                        let error = serde_json::from_str(&common::to_string(&bytes));
74083                        let response = common::to_response(parts, bytes.into());
74084
74085                        if let common::Retry::After(d) =
74086                            dlg.http_failure(&response, error.as_ref().ok())
74087                        {
74088                            sleep(d).await;
74089                            continue;
74090                        }
74091
74092                        dlg.finished(false);
74093
74094                        return Err(match error {
74095                            Ok(value) => common::Error::BadRequest(value),
74096                            _ => common::Error::Failure(response),
74097                        });
74098                    }
74099                    let response = {
74100                        let bytes = common::to_bytes(body).await.unwrap_or_default();
74101                        let encoded = common::to_string(&bytes);
74102                        match serde_json::from_str(&encoded) {
74103                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
74104                            Err(error) => {
74105                                dlg.response_json_decode_error(&encoded, &error);
74106                                return Err(common::Error::JsonDecodeError(
74107                                    encoded.to_string(),
74108                                    error,
74109                                ));
74110                            }
74111                        }
74112                    };
74113
74114                    dlg.finished(true);
74115                    return Ok(response);
74116                }
74117            }
74118        }
74119    }
74120
74121    ///
74122    /// Sets the *request* property to the given value.
74123    ///
74124    /// Even though the property as already been set when instantiating this call,
74125    /// we provide this method for API completeness.
74126    pub fn request(mut self, new_value: Size) -> SizeInsertCall<'a, C> {
74127        self._request = new_value;
74128        self
74129    }
74130    /// User profile ID associated with this request.
74131    ///
74132    /// Sets the *profile id* path property to the given value.
74133    ///
74134    /// Even though the property as already been set when instantiating this call,
74135    /// we provide this method for API completeness.
74136    pub fn profile_id(mut self, new_value: i64) -> SizeInsertCall<'a, C> {
74137        self._profile_id = new_value;
74138        self
74139    }
74140    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
74141    /// while executing the actual API request.
74142    ///
74143    /// ````text
74144    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
74145    /// ````
74146    ///
74147    /// Sets the *delegate* property to the given value.
74148    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> SizeInsertCall<'a, C> {
74149        self._delegate = Some(new_value);
74150        self
74151    }
74152
74153    /// Set any additional parameter of the query string used in the request.
74154    /// It should be used to set parameters which are not yet available through their own
74155    /// setters.
74156    ///
74157    /// Please note that this method must not be used to set any of the known parameters
74158    /// which have their own setter method. If done anyway, the request will fail.
74159    ///
74160    /// # Additional Parameters
74161    ///
74162    /// * *$.xgafv* (query-string) - V1 error format.
74163    /// * *access_token* (query-string) - OAuth access token.
74164    /// * *alt* (query-string) - Data format for response.
74165    /// * *callback* (query-string) - JSONP
74166    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
74167    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
74168    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
74169    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
74170    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
74171    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
74172    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
74173    pub fn param<T>(mut self, name: T, value: T) -> SizeInsertCall<'a, C>
74174    where
74175        T: AsRef<str>,
74176    {
74177        self._additional_params
74178            .insert(name.as_ref().to_string(), value.as_ref().to_string());
74179        self
74180    }
74181
74182    /// Identifies the authorization scope for the method you are building.
74183    ///
74184    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
74185    /// [`Scope::Dfatrafficking`].
74186    ///
74187    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
74188    /// tokens for more than one scope.
74189    ///
74190    /// Usually there is more than one suitable scope to authorize an operation, some of which may
74191    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
74192    /// sufficient, a read-write scope will do as well.
74193    pub fn add_scope<St>(mut self, scope: St) -> SizeInsertCall<'a, C>
74194    where
74195        St: AsRef<str>,
74196    {
74197        self._scopes.insert(String::from(scope.as_ref()));
74198        self
74199    }
74200    /// Identifies the authorization scope(s) for the method you are building.
74201    ///
74202    /// See [`Self::add_scope()`] for details.
74203    pub fn add_scopes<I, St>(mut self, scopes: I) -> SizeInsertCall<'a, C>
74204    where
74205        I: IntoIterator<Item = St>,
74206        St: AsRef<str>,
74207    {
74208        self._scopes
74209            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
74210        self
74211    }
74212
74213    /// Removes all scopes, and no default scope will be used either.
74214    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
74215    /// for details).
74216    pub fn clear_scopes(mut self) -> SizeInsertCall<'a, C> {
74217        self._scopes.clear();
74218        self
74219    }
74220}
74221
74222/// Retrieves a list of sizes, possibly filtered. Retrieved sizes are globally unique and may include values not currently in use by your account. Due to this, the list of sizes returned by this method may differ from the list seen in the Trafficking UI.
74223///
74224/// A builder for the *list* method supported by a *size* resource.
74225/// It is not used directly, but through a [`SizeMethods`] instance.
74226///
74227/// # Example
74228///
74229/// Instantiate a resource method builder
74230///
74231/// ```test_harness,no_run
74232/// # extern crate hyper;
74233/// # extern crate hyper_rustls;
74234/// # extern crate google_dfareporting3d3 as dfareporting3d3;
74235/// # async fn dox() {
74236/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
74237///
74238/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
74239/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
74240/// #     secret,
74241/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
74242/// # ).build().await.unwrap();
74243///
74244/// # let client = hyper_util::client::legacy::Client::builder(
74245/// #     hyper_util::rt::TokioExecutor::new()
74246/// # )
74247/// # .build(
74248/// #     hyper_rustls::HttpsConnectorBuilder::new()
74249/// #         .with_native_roots()
74250/// #         .unwrap()
74251/// #         .https_or_http()
74252/// #         .enable_http1()
74253/// #         .build()
74254/// # );
74255/// # let mut hub = Dfareporting::new(client, auth);
74256/// // You can configure optional parameters by calling the respective setters at will, and
74257/// // execute the final call using `doit()`.
74258/// // Values shown here are possibly random and not representative !
74259/// let result = hub.sizes().list(-43)
74260///              .width(-3)
74261///              .add_ids(-98)
74262///              .iab_standard(false)
74263///              .height(-94)
74264///              .doit().await;
74265/// # }
74266/// ```
74267pub struct SizeListCall<'a, C>
74268where
74269    C: 'a,
74270{
74271    hub: &'a Dfareporting<C>,
74272    _profile_id: i64,
74273    _width: Option<i32>,
74274    _ids: Vec<i64>,
74275    _iab_standard: Option<bool>,
74276    _height: Option<i32>,
74277    _delegate: Option<&'a mut dyn common::Delegate>,
74278    _additional_params: HashMap<String, String>,
74279    _scopes: BTreeSet<String>,
74280}
74281
74282impl<'a, C> common::CallBuilder for SizeListCall<'a, C> {}
74283
74284impl<'a, C> SizeListCall<'a, C>
74285where
74286    C: common::Connector,
74287{
74288    /// Perform the operation you have build so far.
74289    pub async fn doit(mut self) -> common::Result<(common::Response, SizesListResponse)> {
74290        use std::borrow::Cow;
74291        use std::io::{Read, Seek};
74292
74293        use common::{url::Params, ToParts};
74294        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
74295
74296        let mut dd = common::DefaultDelegate;
74297        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
74298        dlg.begin(common::MethodInfo {
74299            id: "dfareporting.sizes.list",
74300            http_method: hyper::Method::GET,
74301        });
74302
74303        for &field in ["alt", "profileId", "width", "ids", "iabStandard", "height"].iter() {
74304            if self._additional_params.contains_key(field) {
74305                dlg.finished(false);
74306                return Err(common::Error::FieldClash(field));
74307            }
74308        }
74309
74310        let mut params = Params::with_capacity(7 + self._additional_params.len());
74311        params.push("profileId", self._profile_id.to_string());
74312        if let Some(value) = self._width.as_ref() {
74313            params.push("width", value.to_string());
74314        }
74315        if !self._ids.is_empty() {
74316            for f in self._ids.iter() {
74317                params.push("ids", f.to_string());
74318            }
74319        }
74320        if let Some(value) = self._iab_standard.as_ref() {
74321            params.push("iabStandard", value.to_string());
74322        }
74323        if let Some(value) = self._height.as_ref() {
74324            params.push("height", value.to_string());
74325        }
74326
74327        params.extend(self._additional_params.iter());
74328
74329        params.push("alt", "json");
74330        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/sizes";
74331        if self._scopes.is_empty() {
74332            self._scopes
74333                .insert(Scope::Dfatrafficking.as_ref().to_string());
74334        }
74335
74336        #[allow(clippy::single_element_loop)]
74337        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
74338            url = params.uri_replacement(url, param_name, find_this, false);
74339        }
74340        {
74341            let to_remove = ["profileId"];
74342            params.remove_params(&to_remove);
74343        }
74344
74345        let url = params.parse_with_url(&url);
74346
74347        loop {
74348            let token = match self
74349                .hub
74350                .auth
74351                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
74352                .await
74353            {
74354                Ok(token) => token,
74355                Err(e) => match dlg.token(e) {
74356                    Ok(token) => token,
74357                    Err(e) => {
74358                        dlg.finished(false);
74359                        return Err(common::Error::MissingToken(e));
74360                    }
74361                },
74362            };
74363            let mut req_result = {
74364                let client = &self.hub.client;
74365                dlg.pre_request();
74366                let mut req_builder = hyper::Request::builder()
74367                    .method(hyper::Method::GET)
74368                    .uri(url.as_str())
74369                    .header(USER_AGENT, self.hub._user_agent.clone());
74370
74371                if let Some(token) = token.as_ref() {
74372                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
74373                }
74374
74375                let request = req_builder
74376                    .header(CONTENT_LENGTH, 0_u64)
74377                    .body(common::to_body::<String>(None));
74378
74379                client.request(request.unwrap()).await
74380            };
74381
74382            match req_result {
74383                Err(err) => {
74384                    if let common::Retry::After(d) = dlg.http_error(&err) {
74385                        sleep(d).await;
74386                        continue;
74387                    }
74388                    dlg.finished(false);
74389                    return Err(common::Error::HttpError(err));
74390                }
74391                Ok(res) => {
74392                    let (mut parts, body) = res.into_parts();
74393                    let mut body = common::Body::new(body);
74394                    if !parts.status.is_success() {
74395                        let bytes = common::to_bytes(body).await.unwrap_or_default();
74396                        let error = serde_json::from_str(&common::to_string(&bytes));
74397                        let response = common::to_response(parts, bytes.into());
74398
74399                        if let common::Retry::After(d) =
74400                            dlg.http_failure(&response, error.as_ref().ok())
74401                        {
74402                            sleep(d).await;
74403                            continue;
74404                        }
74405
74406                        dlg.finished(false);
74407
74408                        return Err(match error {
74409                            Ok(value) => common::Error::BadRequest(value),
74410                            _ => common::Error::Failure(response),
74411                        });
74412                    }
74413                    let response = {
74414                        let bytes = common::to_bytes(body).await.unwrap_or_default();
74415                        let encoded = common::to_string(&bytes);
74416                        match serde_json::from_str(&encoded) {
74417                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
74418                            Err(error) => {
74419                                dlg.response_json_decode_error(&encoded, &error);
74420                                return Err(common::Error::JsonDecodeError(
74421                                    encoded.to_string(),
74422                                    error,
74423                                ));
74424                            }
74425                        }
74426                    };
74427
74428                    dlg.finished(true);
74429                    return Ok(response);
74430                }
74431            }
74432        }
74433    }
74434
74435    /// User profile ID associated with this request.
74436    ///
74437    /// Sets the *profile id* path property to the given value.
74438    ///
74439    /// Even though the property as already been set when instantiating this call,
74440    /// we provide this method for API completeness.
74441    pub fn profile_id(mut self, new_value: i64) -> SizeListCall<'a, C> {
74442        self._profile_id = new_value;
74443        self
74444    }
74445    /// Select only sizes with this width.
74446    ///
74447    /// Sets the *width* query property to the given value.
74448    pub fn width(mut self, new_value: i32) -> SizeListCall<'a, C> {
74449        self._width = Some(new_value);
74450        self
74451    }
74452    /// Select only sizes with these IDs.
74453    ///
74454    /// Append the given value to the *ids* query property.
74455    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
74456    pub fn add_ids(mut self, new_value: i64) -> SizeListCall<'a, C> {
74457        self._ids.push(new_value);
74458        self
74459    }
74460    /// Select only IAB standard sizes.
74461    ///
74462    /// Sets the *iab standard* query property to the given value.
74463    pub fn iab_standard(mut self, new_value: bool) -> SizeListCall<'a, C> {
74464        self._iab_standard = Some(new_value);
74465        self
74466    }
74467    /// Select only sizes with this height.
74468    ///
74469    /// Sets the *height* query property to the given value.
74470    pub fn height(mut self, new_value: i32) -> SizeListCall<'a, C> {
74471        self._height = Some(new_value);
74472        self
74473    }
74474    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
74475    /// while executing the actual API request.
74476    ///
74477    /// ````text
74478    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
74479    /// ````
74480    ///
74481    /// Sets the *delegate* property to the given value.
74482    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> SizeListCall<'a, C> {
74483        self._delegate = Some(new_value);
74484        self
74485    }
74486
74487    /// Set any additional parameter of the query string used in the request.
74488    /// It should be used to set parameters which are not yet available through their own
74489    /// setters.
74490    ///
74491    /// Please note that this method must not be used to set any of the known parameters
74492    /// which have their own setter method. If done anyway, the request will fail.
74493    ///
74494    /// # Additional Parameters
74495    ///
74496    /// * *$.xgafv* (query-string) - V1 error format.
74497    /// * *access_token* (query-string) - OAuth access token.
74498    /// * *alt* (query-string) - Data format for response.
74499    /// * *callback* (query-string) - JSONP
74500    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
74501    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
74502    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
74503    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
74504    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
74505    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
74506    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
74507    pub fn param<T>(mut self, name: T, value: T) -> SizeListCall<'a, C>
74508    where
74509        T: AsRef<str>,
74510    {
74511        self._additional_params
74512            .insert(name.as_ref().to_string(), value.as_ref().to_string());
74513        self
74514    }
74515
74516    /// Identifies the authorization scope for the method you are building.
74517    ///
74518    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
74519    /// [`Scope::Dfatrafficking`].
74520    ///
74521    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
74522    /// tokens for more than one scope.
74523    ///
74524    /// Usually there is more than one suitable scope to authorize an operation, some of which may
74525    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
74526    /// sufficient, a read-write scope will do as well.
74527    pub fn add_scope<St>(mut self, scope: St) -> SizeListCall<'a, C>
74528    where
74529        St: AsRef<str>,
74530    {
74531        self._scopes.insert(String::from(scope.as_ref()));
74532        self
74533    }
74534    /// Identifies the authorization scope(s) for the method you are building.
74535    ///
74536    /// See [`Self::add_scope()`] for details.
74537    pub fn add_scopes<I, St>(mut self, scopes: I) -> SizeListCall<'a, C>
74538    where
74539        I: IntoIterator<Item = St>,
74540        St: AsRef<str>,
74541    {
74542        self._scopes
74543            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
74544        self
74545    }
74546
74547    /// Removes all scopes, and no default scope will be used either.
74548    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
74549    /// for details).
74550    pub fn clear_scopes(mut self) -> SizeListCall<'a, C> {
74551        self._scopes.clear();
74552        self
74553    }
74554}
74555
74556/// Gets one subaccount by ID.
74557///
74558/// A builder for the *get* method supported by a *subaccount* resource.
74559/// It is not used directly, but through a [`SubaccountMethods`] instance.
74560///
74561/// # Example
74562///
74563/// Instantiate a resource method builder
74564///
74565/// ```test_harness,no_run
74566/// # extern crate hyper;
74567/// # extern crate hyper_rustls;
74568/// # extern crate google_dfareporting3d3 as dfareporting3d3;
74569/// # async fn dox() {
74570/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
74571///
74572/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
74573/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
74574/// #     secret,
74575/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
74576/// # ).build().await.unwrap();
74577///
74578/// # let client = hyper_util::client::legacy::Client::builder(
74579/// #     hyper_util::rt::TokioExecutor::new()
74580/// # )
74581/// # .build(
74582/// #     hyper_rustls::HttpsConnectorBuilder::new()
74583/// #         .with_native_roots()
74584/// #         .unwrap()
74585/// #         .https_or_http()
74586/// #         .enable_http1()
74587/// #         .build()
74588/// # );
74589/// # let mut hub = Dfareporting::new(client, auth);
74590/// // You can configure optional parameters by calling the respective setters at will, and
74591/// // execute the final call using `doit()`.
74592/// // Values shown here are possibly random and not representative !
74593/// let result = hub.subaccounts().get(-28, -71)
74594///              .doit().await;
74595/// # }
74596/// ```
74597pub struct SubaccountGetCall<'a, C>
74598where
74599    C: 'a,
74600{
74601    hub: &'a Dfareporting<C>,
74602    _profile_id: i64,
74603    _id: i64,
74604    _delegate: Option<&'a mut dyn common::Delegate>,
74605    _additional_params: HashMap<String, String>,
74606    _scopes: BTreeSet<String>,
74607}
74608
74609impl<'a, C> common::CallBuilder for SubaccountGetCall<'a, C> {}
74610
74611impl<'a, C> SubaccountGetCall<'a, C>
74612where
74613    C: common::Connector,
74614{
74615    /// Perform the operation you have build so far.
74616    pub async fn doit(mut self) -> common::Result<(common::Response, Subaccount)> {
74617        use std::borrow::Cow;
74618        use std::io::{Read, Seek};
74619
74620        use common::{url::Params, ToParts};
74621        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
74622
74623        let mut dd = common::DefaultDelegate;
74624        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
74625        dlg.begin(common::MethodInfo {
74626            id: "dfareporting.subaccounts.get",
74627            http_method: hyper::Method::GET,
74628        });
74629
74630        for &field in ["alt", "profileId", "id"].iter() {
74631            if self._additional_params.contains_key(field) {
74632                dlg.finished(false);
74633                return Err(common::Error::FieldClash(field));
74634            }
74635        }
74636
74637        let mut params = Params::with_capacity(4 + self._additional_params.len());
74638        params.push("profileId", self._profile_id.to_string());
74639        params.push("id", self._id.to_string());
74640
74641        params.extend(self._additional_params.iter());
74642
74643        params.push("alt", "json");
74644        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/subaccounts/{id}";
74645        if self._scopes.is_empty() {
74646            self._scopes
74647                .insert(Scope::Dfatrafficking.as_ref().to_string());
74648        }
74649
74650        #[allow(clippy::single_element_loop)]
74651        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
74652            url = params.uri_replacement(url, param_name, find_this, false);
74653        }
74654        {
74655            let to_remove = ["id", "profileId"];
74656            params.remove_params(&to_remove);
74657        }
74658
74659        let url = params.parse_with_url(&url);
74660
74661        loop {
74662            let token = match self
74663                .hub
74664                .auth
74665                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
74666                .await
74667            {
74668                Ok(token) => token,
74669                Err(e) => match dlg.token(e) {
74670                    Ok(token) => token,
74671                    Err(e) => {
74672                        dlg.finished(false);
74673                        return Err(common::Error::MissingToken(e));
74674                    }
74675                },
74676            };
74677            let mut req_result = {
74678                let client = &self.hub.client;
74679                dlg.pre_request();
74680                let mut req_builder = hyper::Request::builder()
74681                    .method(hyper::Method::GET)
74682                    .uri(url.as_str())
74683                    .header(USER_AGENT, self.hub._user_agent.clone());
74684
74685                if let Some(token) = token.as_ref() {
74686                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
74687                }
74688
74689                let request = req_builder
74690                    .header(CONTENT_LENGTH, 0_u64)
74691                    .body(common::to_body::<String>(None));
74692
74693                client.request(request.unwrap()).await
74694            };
74695
74696            match req_result {
74697                Err(err) => {
74698                    if let common::Retry::After(d) = dlg.http_error(&err) {
74699                        sleep(d).await;
74700                        continue;
74701                    }
74702                    dlg.finished(false);
74703                    return Err(common::Error::HttpError(err));
74704                }
74705                Ok(res) => {
74706                    let (mut parts, body) = res.into_parts();
74707                    let mut body = common::Body::new(body);
74708                    if !parts.status.is_success() {
74709                        let bytes = common::to_bytes(body).await.unwrap_or_default();
74710                        let error = serde_json::from_str(&common::to_string(&bytes));
74711                        let response = common::to_response(parts, bytes.into());
74712
74713                        if let common::Retry::After(d) =
74714                            dlg.http_failure(&response, error.as_ref().ok())
74715                        {
74716                            sleep(d).await;
74717                            continue;
74718                        }
74719
74720                        dlg.finished(false);
74721
74722                        return Err(match error {
74723                            Ok(value) => common::Error::BadRequest(value),
74724                            _ => common::Error::Failure(response),
74725                        });
74726                    }
74727                    let response = {
74728                        let bytes = common::to_bytes(body).await.unwrap_or_default();
74729                        let encoded = common::to_string(&bytes);
74730                        match serde_json::from_str(&encoded) {
74731                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
74732                            Err(error) => {
74733                                dlg.response_json_decode_error(&encoded, &error);
74734                                return Err(common::Error::JsonDecodeError(
74735                                    encoded.to_string(),
74736                                    error,
74737                                ));
74738                            }
74739                        }
74740                    };
74741
74742                    dlg.finished(true);
74743                    return Ok(response);
74744                }
74745            }
74746        }
74747    }
74748
74749    /// User profile ID associated with this request.
74750    ///
74751    /// Sets the *profile id* path property to the given value.
74752    ///
74753    /// Even though the property as already been set when instantiating this call,
74754    /// we provide this method for API completeness.
74755    pub fn profile_id(mut self, new_value: i64) -> SubaccountGetCall<'a, C> {
74756        self._profile_id = new_value;
74757        self
74758    }
74759    /// Subaccount ID.
74760    ///
74761    /// Sets the *id* path property to the given value.
74762    ///
74763    /// Even though the property as already been set when instantiating this call,
74764    /// we provide this method for API completeness.
74765    pub fn id(mut self, new_value: i64) -> SubaccountGetCall<'a, C> {
74766        self._id = new_value;
74767        self
74768    }
74769    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
74770    /// while executing the actual API request.
74771    ///
74772    /// ````text
74773    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
74774    /// ````
74775    ///
74776    /// Sets the *delegate* property to the given value.
74777    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> SubaccountGetCall<'a, C> {
74778        self._delegate = Some(new_value);
74779        self
74780    }
74781
74782    /// Set any additional parameter of the query string used in the request.
74783    /// It should be used to set parameters which are not yet available through their own
74784    /// setters.
74785    ///
74786    /// Please note that this method must not be used to set any of the known parameters
74787    /// which have their own setter method. If done anyway, the request will fail.
74788    ///
74789    /// # Additional Parameters
74790    ///
74791    /// * *$.xgafv* (query-string) - V1 error format.
74792    /// * *access_token* (query-string) - OAuth access token.
74793    /// * *alt* (query-string) - Data format for response.
74794    /// * *callback* (query-string) - JSONP
74795    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
74796    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
74797    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
74798    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
74799    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
74800    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
74801    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
74802    pub fn param<T>(mut self, name: T, value: T) -> SubaccountGetCall<'a, C>
74803    where
74804        T: AsRef<str>,
74805    {
74806        self._additional_params
74807            .insert(name.as_ref().to_string(), value.as_ref().to_string());
74808        self
74809    }
74810
74811    /// Identifies the authorization scope for the method you are building.
74812    ///
74813    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
74814    /// [`Scope::Dfatrafficking`].
74815    ///
74816    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
74817    /// tokens for more than one scope.
74818    ///
74819    /// Usually there is more than one suitable scope to authorize an operation, some of which may
74820    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
74821    /// sufficient, a read-write scope will do as well.
74822    pub fn add_scope<St>(mut self, scope: St) -> SubaccountGetCall<'a, C>
74823    where
74824        St: AsRef<str>,
74825    {
74826        self._scopes.insert(String::from(scope.as_ref()));
74827        self
74828    }
74829    /// Identifies the authorization scope(s) for the method you are building.
74830    ///
74831    /// See [`Self::add_scope()`] for details.
74832    pub fn add_scopes<I, St>(mut self, scopes: I) -> SubaccountGetCall<'a, C>
74833    where
74834        I: IntoIterator<Item = St>,
74835        St: AsRef<str>,
74836    {
74837        self._scopes
74838            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
74839        self
74840    }
74841
74842    /// Removes all scopes, and no default scope will be used either.
74843    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
74844    /// for details).
74845    pub fn clear_scopes(mut self) -> SubaccountGetCall<'a, C> {
74846        self._scopes.clear();
74847        self
74848    }
74849}
74850
74851/// Inserts a new subaccount.
74852///
74853/// A builder for the *insert* method supported by a *subaccount* resource.
74854/// It is not used directly, but through a [`SubaccountMethods`] instance.
74855///
74856/// # Example
74857///
74858/// Instantiate a resource method builder
74859///
74860/// ```test_harness,no_run
74861/// # extern crate hyper;
74862/// # extern crate hyper_rustls;
74863/// # extern crate google_dfareporting3d3 as dfareporting3d3;
74864/// use dfareporting3d3::api::Subaccount;
74865/// # async fn dox() {
74866/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
74867///
74868/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
74869/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
74870/// #     secret,
74871/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
74872/// # ).build().await.unwrap();
74873///
74874/// # let client = hyper_util::client::legacy::Client::builder(
74875/// #     hyper_util::rt::TokioExecutor::new()
74876/// # )
74877/// # .build(
74878/// #     hyper_rustls::HttpsConnectorBuilder::new()
74879/// #         .with_native_roots()
74880/// #         .unwrap()
74881/// #         .https_or_http()
74882/// #         .enable_http1()
74883/// #         .build()
74884/// # );
74885/// # let mut hub = Dfareporting::new(client, auth);
74886/// // As the method needs a request, you would usually fill it with the desired information
74887/// // into the respective structure. Some of the parts shown here might not be applicable !
74888/// // Values shown here are possibly random and not representative !
74889/// let mut req = Subaccount::default();
74890///
74891/// // You can configure optional parameters by calling the respective setters at will, and
74892/// // execute the final call using `doit()`.
74893/// // Values shown here are possibly random and not representative !
74894/// let result = hub.subaccounts().insert(req, -2)
74895///              .doit().await;
74896/// # }
74897/// ```
74898pub struct SubaccountInsertCall<'a, C>
74899where
74900    C: 'a,
74901{
74902    hub: &'a Dfareporting<C>,
74903    _request: Subaccount,
74904    _profile_id: i64,
74905    _delegate: Option<&'a mut dyn common::Delegate>,
74906    _additional_params: HashMap<String, String>,
74907    _scopes: BTreeSet<String>,
74908}
74909
74910impl<'a, C> common::CallBuilder for SubaccountInsertCall<'a, C> {}
74911
74912impl<'a, C> SubaccountInsertCall<'a, C>
74913where
74914    C: common::Connector,
74915{
74916    /// Perform the operation you have build so far.
74917    pub async fn doit(mut self) -> common::Result<(common::Response, Subaccount)> {
74918        use std::borrow::Cow;
74919        use std::io::{Read, Seek};
74920
74921        use common::{url::Params, ToParts};
74922        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
74923
74924        let mut dd = common::DefaultDelegate;
74925        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
74926        dlg.begin(common::MethodInfo {
74927            id: "dfareporting.subaccounts.insert",
74928            http_method: hyper::Method::POST,
74929        });
74930
74931        for &field in ["alt", "profileId"].iter() {
74932            if self._additional_params.contains_key(field) {
74933                dlg.finished(false);
74934                return Err(common::Error::FieldClash(field));
74935            }
74936        }
74937
74938        let mut params = Params::with_capacity(4 + self._additional_params.len());
74939        params.push("profileId", self._profile_id.to_string());
74940
74941        params.extend(self._additional_params.iter());
74942
74943        params.push("alt", "json");
74944        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/subaccounts";
74945        if self._scopes.is_empty() {
74946            self._scopes
74947                .insert(Scope::Dfatrafficking.as_ref().to_string());
74948        }
74949
74950        #[allow(clippy::single_element_loop)]
74951        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
74952            url = params.uri_replacement(url, param_name, find_this, false);
74953        }
74954        {
74955            let to_remove = ["profileId"];
74956            params.remove_params(&to_remove);
74957        }
74958
74959        let url = params.parse_with_url(&url);
74960
74961        let mut json_mime_type = mime::APPLICATION_JSON;
74962        let mut request_value_reader = {
74963            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
74964            common::remove_json_null_values(&mut value);
74965            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
74966            serde_json::to_writer(&mut dst, &value).unwrap();
74967            dst
74968        };
74969        let request_size = request_value_reader
74970            .seek(std::io::SeekFrom::End(0))
74971            .unwrap();
74972        request_value_reader
74973            .seek(std::io::SeekFrom::Start(0))
74974            .unwrap();
74975
74976        loop {
74977            let token = match self
74978                .hub
74979                .auth
74980                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
74981                .await
74982            {
74983                Ok(token) => token,
74984                Err(e) => match dlg.token(e) {
74985                    Ok(token) => token,
74986                    Err(e) => {
74987                        dlg.finished(false);
74988                        return Err(common::Error::MissingToken(e));
74989                    }
74990                },
74991            };
74992            request_value_reader
74993                .seek(std::io::SeekFrom::Start(0))
74994                .unwrap();
74995            let mut req_result = {
74996                let client = &self.hub.client;
74997                dlg.pre_request();
74998                let mut req_builder = hyper::Request::builder()
74999                    .method(hyper::Method::POST)
75000                    .uri(url.as_str())
75001                    .header(USER_AGENT, self.hub._user_agent.clone());
75002
75003                if let Some(token) = token.as_ref() {
75004                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
75005                }
75006
75007                let request = req_builder
75008                    .header(CONTENT_TYPE, json_mime_type.to_string())
75009                    .header(CONTENT_LENGTH, request_size as u64)
75010                    .body(common::to_body(
75011                        request_value_reader.get_ref().clone().into(),
75012                    ));
75013
75014                client.request(request.unwrap()).await
75015            };
75016
75017            match req_result {
75018                Err(err) => {
75019                    if let common::Retry::After(d) = dlg.http_error(&err) {
75020                        sleep(d).await;
75021                        continue;
75022                    }
75023                    dlg.finished(false);
75024                    return Err(common::Error::HttpError(err));
75025                }
75026                Ok(res) => {
75027                    let (mut parts, body) = res.into_parts();
75028                    let mut body = common::Body::new(body);
75029                    if !parts.status.is_success() {
75030                        let bytes = common::to_bytes(body).await.unwrap_or_default();
75031                        let error = serde_json::from_str(&common::to_string(&bytes));
75032                        let response = common::to_response(parts, bytes.into());
75033
75034                        if let common::Retry::After(d) =
75035                            dlg.http_failure(&response, error.as_ref().ok())
75036                        {
75037                            sleep(d).await;
75038                            continue;
75039                        }
75040
75041                        dlg.finished(false);
75042
75043                        return Err(match error {
75044                            Ok(value) => common::Error::BadRequest(value),
75045                            _ => common::Error::Failure(response),
75046                        });
75047                    }
75048                    let response = {
75049                        let bytes = common::to_bytes(body).await.unwrap_or_default();
75050                        let encoded = common::to_string(&bytes);
75051                        match serde_json::from_str(&encoded) {
75052                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
75053                            Err(error) => {
75054                                dlg.response_json_decode_error(&encoded, &error);
75055                                return Err(common::Error::JsonDecodeError(
75056                                    encoded.to_string(),
75057                                    error,
75058                                ));
75059                            }
75060                        }
75061                    };
75062
75063                    dlg.finished(true);
75064                    return Ok(response);
75065                }
75066            }
75067        }
75068    }
75069
75070    ///
75071    /// Sets the *request* property to the given value.
75072    ///
75073    /// Even though the property as already been set when instantiating this call,
75074    /// we provide this method for API completeness.
75075    pub fn request(mut self, new_value: Subaccount) -> SubaccountInsertCall<'a, C> {
75076        self._request = new_value;
75077        self
75078    }
75079    /// User profile ID associated with this request.
75080    ///
75081    /// Sets the *profile id* path property to the given value.
75082    ///
75083    /// Even though the property as already been set when instantiating this call,
75084    /// we provide this method for API completeness.
75085    pub fn profile_id(mut self, new_value: i64) -> SubaccountInsertCall<'a, C> {
75086        self._profile_id = new_value;
75087        self
75088    }
75089    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
75090    /// while executing the actual API request.
75091    ///
75092    /// ````text
75093    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
75094    /// ````
75095    ///
75096    /// Sets the *delegate* property to the given value.
75097    pub fn delegate(
75098        mut self,
75099        new_value: &'a mut dyn common::Delegate,
75100    ) -> SubaccountInsertCall<'a, C> {
75101        self._delegate = Some(new_value);
75102        self
75103    }
75104
75105    /// Set any additional parameter of the query string used in the request.
75106    /// It should be used to set parameters which are not yet available through their own
75107    /// setters.
75108    ///
75109    /// Please note that this method must not be used to set any of the known parameters
75110    /// which have their own setter method. If done anyway, the request will fail.
75111    ///
75112    /// # Additional Parameters
75113    ///
75114    /// * *$.xgafv* (query-string) - V1 error format.
75115    /// * *access_token* (query-string) - OAuth access token.
75116    /// * *alt* (query-string) - Data format for response.
75117    /// * *callback* (query-string) - JSONP
75118    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
75119    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
75120    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
75121    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
75122    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
75123    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
75124    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
75125    pub fn param<T>(mut self, name: T, value: T) -> SubaccountInsertCall<'a, C>
75126    where
75127        T: AsRef<str>,
75128    {
75129        self._additional_params
75130            .insert(name.as_ref().to_string(), value.as_ref().to_string());
75131        self
75132    }
75133
75134    /// Identifies the authorization scope for the method you are building.
75135    ///
75136    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
75137    /// [`Scope::Dfatrafficking`].
75138    ///
75139    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
75140    /// tokens for more than one scope.
75141    ///
75142    /// Usually there is more than one suitable scope to authorize an operation, some of which may
75143    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
75144    /// sufficient, a read-write scope will do as well.
75145    pub fn add_scope<St>(mut self, scope: St) -> SubaccountInsertCall<'a, C>
75146    where
75147        St: AsRef<str>,
75148    {
75149        self._scopes.insert(String::from(scope.as_ref()));
75150        self
75151    }
75152    /// Identifies the authorization scope(s) for the method you are building.
75153    ///
75154    /// See [`Self::add_scope()`] for details.
75155    pub fn add_scopes<I, St>(mut self, scopes: I) -> SubaccountInsertCall<'a, C>
75156    where
75157        I: IntoIterator<Item = St>,
75158        St: AsRef<str>,
75159    {
75160        self._scopes
75161            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
75162        self
75163    }
75164
75165    /// Removes all scopes, and no default scope will be used either.
75166    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
75167    /// for details).
75168    pub fn clear_scopes(mut self) -> SubaccountInsertCall<'a, C> {
75169        self._scopes.clear();
75170        self
75171    }
75172}
75173
75174/// Gets a list of subaccounts, possibly filtered. This method supports paging.
75175///
75176/// A builder for the *list* method supported by a *subaccount* resource.
75177/// It is not used directly, but through a [`SubaccountMethods`] instance.
75178///
75179/// # Example
75180///
75181/// Instantiate a resource method builder
75182///
75183/// ```test_harness,no_run
75184/// # extern crate hyper;
75185/// # extern crate hyper_rustls;
75186/// # extern crate google_dfareporting3d3 as dfareporting3d3;
75187/// # async fn dox() {
75188/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
75189///
75190/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
75191/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
75192/// #     secret,
75193/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
75194/// # ).build().await.unwrap();
75195///
75196/// # let client = hyper_util::client::legacy::Client::builder(
75197/// #     hyper_util::rt::TokioExecutor::new()
75198/// # )
75199/// # .build(
75200/// #     hyper_rustls::HttpsConnectorBuilder::new()
75201/// #         .with_native_roots()
75202/// #         .unwrap()
75203/// #         .https_or_http()
75204/// #         .enable_http1()
75205/// #         .build()
75206/// # );
75207/// # let mut hub = Dfareporting::new(client, auth);
75208/// // You can configure optional parameters by calling the respective setters at will, and
75209/// // execute the final call using `doit()`.
75210/// // Values shown here are possibly random and not representative !
75211/// let result = hub.subaccounts().list(-82)
75212///              .sort_order("et")
75213///              .sort_field("gubergren")
75214///              .search_string("sed")
75215///              .page_token("no")
75216///              .max_results(-98)
75217///              .add_ids(-7)
75218///              .doit().await;
75219/// # }
75220/// ```
75221pub struct SubaccountListCall<'a, C>
75222where
75223    C: 'a,
75224{
75225    hub: &'a Dfareporting<C>,
75226    _profile_id: i64,
75227    _sort_order: Option<String>,
75228    _sort_field: Option<String>,
75229    _search_string: Option<String>,
75230    _page_token: Option<String>,
75231    _max_results: Option<i32>,
75232    _ids: Vec<i64>,
75233    _delegate: Option<&'a mut dyn common::Delegate>,
75234    _additional_params: HashMap<String, String>,
75235    _scopes: BTreeSet<String>,
75236}
75237
75238impl<'a, C> common::CallBuilder for SubaccountListCall<'a, C> {}
75239
75240impl<'a, C> SubaccountListCall<'a, C>
75241where
75242    C: common::Connector,
75243{
75244    /// Perform the operation you have build so far.
75245    pub async fn doit(mut self) -> common::Result<(common::Response, SubaccountsListResponse)> {
75246        use std::borrow::Cow;
75247        use std::io::{Read, Seek};
75248
75249        use common::{url::Params, ToParts};
75250        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
75251
75252        let mut dd = common::DefaultDelegate;
75253        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
75254        dlg.begin(common::MethodInfo {
75255            id: "dfareporting.subaccounts.list",
75256            http_method: hyper::Method::GET,
75257        });
75258
75259        for &field in [
75260            "alt",
75261            "profileId",
75262            "sortOrder",
75263            "sortField",
75264            "searchString",
75265            "pageToken",
75266            "maxResults",
75267            "ids",
75268        ]
75269        .iter()
75270        {
75271            if self._additional_params.contains_key(field) {
75272                dlg.finished(false);
75273                return Err(common::Error::FieldClash(field));
75274            }
75275        }
75276
75277        let mut params = Params::with_capacity(9 + self._additional_params.len());
75278        params.push("profileId", self._profile_id.to_string());
75279        if let Some(value) = self._sort_order.as_ref() {
75280            params.push("sortOrder", value);
75281        }
75282        if let Some(value) = self._sort_field.as_ref() {
75283            params.push("sortField", value);
75284        }
75285        if let Some(value) = self._search_string.as_ref() {
75286            params.push("searchString", value);
75287        }
75288        if let Some(value) = self._page_token.as_ref() {
75289            params.push("pageToken", value);
75290        }
75291        if let Some(value) = self._max_results.as_ref() {
75292            params.push("maxResults", value.to_string());
75293        }
75294        if !self._ids.is_empty() {
75295            for f in self._ids.iter() {
75296                params.push("ids", f.to_string());
75297            }
75298        }
75299
75300        params.extend(self._additional_params.iter());
75301
75302        params.push("alt", "json");
75303        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/subaccounts";
75304        if self._scopes.is_empty() {
75305            self._scopes
75306                .insert(Scope::Dfatrafficking.as_ref().to_string());
75307        }
75308
75309        #[allow(clippy::single_element_loop)]
75310        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
75311            url = params.uri_replacement(url, param_name, find_this, false);
75312        }
75313        {
75314            let to_remove = ["profileId"];
75315            params.remove_params(&to_remove);
75316        }
75317
75318        let url = params.parse_with_url(&url);
75319
75320        loop {
75321            let token = match self
75322                .hub
75323                .auth
75324                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
75325                .await
75326            {
75327                Ok(token) => token,
75328                Err(e) => match dlg.token(e) {
75329                    Ok(token) => token,
75330                    Err(e) => {
75331                        dlg.finished(false);
75332                        return Err(common::Error::MissingToken(e));
75333                    }
75334                },
75335            };
75336            let mut req_result = {
75337                let client = &self.hub.client;
75338                dlg.pre_request();
75339                let mut req_builder = hyper::Request::builder()
75340                    .method(hyper::Method::GET)
75341                    .uri(url.as_str())
75342                    .header(USER_AGENT, self.hub._user_agent.clone());
75343
75344                if let Some(token) = token.as_ref() {
75345                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
75346                }
75347
75348                let request = req_builder
75349                    .header(CONTENT_LENGTH, 0_u64)
75350                    .body(common::to_body::<String>(None));
75351
75352                client.request(request.unwrap()).await
75353            };
75354
75355            match req_result {
75356                Err(err) => {
75357                    if let common::Retry::After(d) = dlg.http_error(&err) {
75358                        sleep(d).await;
75359                        continue;
75360                    }
75361                    dlg.finished(false);
75362                    return Err(common::Error::HttpError(err));
75363                }
75364                Ok(res) => {
75365                    let (mut parts, body) = res.into_parts();
75366                    let mut body = common::Body::new(body);
75367                    if !parts.status.is_success() {
75368                        let bytes = common::to_bytes(body).await.unwrap_or_default();
75369                        let error = serde_json::from_str(&common::to_string(&bytes));
75370                        let response = common::to_response(parts, bytes.into());
75371
75372                        if let common::Retry::After(d) =
75373                            dlg.http_failure(&response, error.as_ref().ok())
75374                        {
75375                            sleep(d).await;
75376                            continue;
75377                        }
75378
75379                        dlg.finished(false);
75380
75381                        return Err(match error {
75382                            Ok(value) => common::Error::BadRequest(value),
75383                            _ => common::Error::Failure(response),
75384                        });
75385                    }
75386                    let response = {
75387                        let bytes = common::to_bytes(body).await.unwrap_or_default();
75388                        let encoded = common::to_string(&bytes);
75389                        match serde_json::from_str(&encoded) {
75390                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
75391                            Err(error) => {
75392                                dlg.response_json_decode_error(&encoded, &error);
75393                                return Err(common::Error::JsonDecodeError(
75394                                    encoded.to_string(),
75395                                    error,
75396                                ));
75397                            }
75398                        }
75399                    };
75400
75401                    dlg.finished(true);
75402                    return Ok(response);
75403                }
75404            }
75405        }
75406    }
75407
75408    /// User profile ID associated with this request.
75409    ///
75410    /// Sets the *profile id* path property to the given value.
75411    ///
75412    /// Even though the property as already been set when instantiating this call,
75413    /// we provide this method for API completeness.
75414    pub fn profile_id(mut self, new_value: i64) -> SubaccountListCall<'a, C> {
75415        self._profile_id = new_value;
75416        self
75417    }
75418    /// Order of sorted results.
75419    ///
75420    /// Sets the *sort order* query property to the given value.
75421    pub fn sort_order(mut self, new_value: &str) -> SubaccountListCall<'a, C> {
75422        self._sort_order = Some(new_value.to_string());
75423        self
75424    }
75425    /// Field by which to sort the list.
75426    ///
75427    /// Sets the *sort field* query property to the given value.
75428    pub fn sort_field(mut self, new_value: &str) -> SubaccountListCall<'a, C> {
75429        self._sort_field = Some(new_value.to_string());
75430        self
75431    }
75432    /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "subaccount*2015" will return objects with names like "subaccount June 2015", "subaccount April 2015", or simply "subaccount 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "subaccount" will match objects with name "my subaccount", "subaccount 2015", or simply "subaccount" .
75433    ///
75434    /// Sets the *search string* query property to the given value.
75435    pub fn search_string(mut self, new_value: &str) -> SubaccountListCall<'a, C> {
75436        self._search_string = Some(new_value.to_string());
75437        self
75438    }
75439    /// Value of the nextPageToken from the previous result page.
75440    ///
75441    /// Sets the *page token* query property to the given value.
75442    pub fn page_token(mut self, new_value: &str) -> SubaccountListCall<'a, C> {
75443        self._page_token = Some(new_value.to_string());
75444        self
75445    }
75446    /// Maximum number of results to return.
75447    ///
75448    /// Sets the *max results* query property to the given value.
75449    pub fn max_results(mut self, new_value: i32) -> SubaccountListCall<'a, C> {
75450        self._max_results = Some(new_value);
75451        self
75452    }
75453    /// Select only subaccounts with these IDs.
75454    ///
75455    /// Append the given value to the *ids* query property.
75456    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
75457    pub fn add_ids(mut self, new_value: i64) -> SubaccountListCall<'a, C> {
75458        self._ids.push(new_value);
75459        self
75460    }
75461    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
75462    /// while executing the actual API request.
75463    ///
75464    /// ````text
75465    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
75466    /// ````
75467    ///
75468    /// Sets the *delegate* property to the given value.
75469    pub fn delegate(
75470        mut self,
75471        new_value: &'a mut dyn common::Delegate,
75472    ) -> SubaccountListCall<'a, C> {
75473        self._delegate = Some(new_value);
75474        self
75475    }
75476
75477    /// Set any additional parameter of the query string used in the request.
75478    /// It should be used to set parameters which are not yet available through their own
75479    /// setters.
75480    ///
75481    /// Please note that this method must not be used to set any of the known parameters
75482    /// which have their own setter method. If done anyway, the request will fail.
75483    ///
75484    /// # Additional Parameters
75485    ///
75486    /// * *$.xgafv* (query-string) - V1 error format.
75487    /// * *access_token* (query-string) - OAuth access token.
75488    /// * *alt* (query-string) - Data format for response.
75489    /// * *callback* (query-string) - JSONP
75490    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
75491    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
75492    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
75493    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
75494    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
75495    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
75496    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
75497    pub fn param<T>(mut self, name: T, value: T) -> SubaccountListCall<'a, C>
75498    where
75499        T: AsRef<str>,
75500    {
75501        self._additional_params
75502            .insert(name.as_ref().to_string(), value.as_ref().to_string());
75503        self
75504    }
75505
75506    /// Identifies the authorization scope for the method you are building.
75507    ///
75508    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
75509    /// [`Scope::Dfatrafficking`].
75510    ///
75511    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
75512    /// tokens for more than one scope.
75513    ///
75514    /// Usually there is more than one suitable scope to authorize an operation, some of which may
75515    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
75516    /// sufficient, a read-write scope will do as well.
75517    pub fn add_scope<St>(mut self, scope: St) -> SubaccountListCall<'a, C>
75518    where
75519        St: AsRef<str>,
75520    {
75521        self._scopes.insert(String::from(scope.as_ref()));
75522        self
75523    }
75524    /// Identifies the authorization scope(s) for the method you are building.
75525    ///
75526    /// See [`Self::add_scope()`] for details.
75527    pub fn add_scopes<I, St>(mut self, scopes: I) -> SubaccountListCall<'a, C>
75528    where
75529        I: IntoIterator<Item = St>,
75530        St: AsRef<str>,
75531    {
75532        self._scopes
75533            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
75534        self
75535    }
75536
75537    /// Removes all scopes, and no default scope will be used either.
75538    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
75539    /// for details).
75540    pub fn clear_scopes(mut self) -> SubaccountListCall<'a, C> {
75541        self._scopes.clear();
75542        self
75543    }
75544}
75545
75546/// Updates an existing subaccount. This method supports patch semantics.
75547///
75548/// A builder for the *patch* method supported by a *subaccount* resource.
75549/// It is not used directly, but through a [`SubaccountMethods`] instance.
75550///
75551/// # Example
75552///
75553/// Instantiate a resource method builder
75554///
75555/// ```test_harness,no_run
75556/// # extern crate hyper;
75557/// # extern crate hyper_rustls;
75558/// # extern crate google_dfareporting3d3 as dfareporting3d3;
75559/// use dfareporting3d3::api::Subaccount;
75560/// # async fn dox() {
75561/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
75562///
75563/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
75564/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
75565/// #     secret,
75566/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
75567/// # ).build().await.unwrap();
75568///
75569/// # let client = hyper_util::client::legacy::Client::builder(
75570/// #     hyper_util::rt::TokioExecutor::new()
75571/// # )
75572/// # .build(
75573/// #     hyper_rustls::HttpsConnectorBuilder::new()
75574/// #         .with_native_roots()
75575/// #         .unwrap()
75576/// #         .https_or_http()
75577/// #         .enable_http1()
75578/// #         .build()
75579/// # );
75580/// # let mut hub = Dfareporting::new(client, auth);
75581/// // As the method needs a request, you would usually fill it with the desired information
75582/// // into the respective structure. Some of the parts shown here might not be applicable !
75583/// // Values shown here are possibly random and not representative !
75584/// let mut req = Subaccount::default();
75585///
75586/// // You can configure optional parameters by calling the respective setters at will, and
75587/// // execute the final call using `doit()`.
75588/// // Values shown here are possibly random and not representative !
75589/// let result = hub.subaccounts().patch(req, -94, -22)
75590///              .doit().await;
75591/// # }
75592/// ```
75593pub struct SubaccountPatchCall<'a, C>
75594where
75595    C: 'a,
75596{
75597    hub: &'a Dfareporting<C>,
75598    _request: Subaccount,
75599    _profile_id: i64,
75600    _id: i64,
75601    _delegate: Option<&'a mut dyn common::Delegate>,
75602    _additional_params: HashMap<String, String>,
75603    _scopes: BTreeSet<String>,
75604}
75605
75606impl<'a, C> common::CallBuilder for SubaccountPatchCall<'a, C> {}
75607
75608impl<'a, C> SubaccountPatchCall<'a, C>
75609where
75610    C: common::Connector,
75611{
75612    /// Perform the operation you have build so far.
75613    pub async fn doit(mut self) -> common::Result<(common::Response, Subaccount)> {
75614        use std::borrow::Cow;
75615        use std::io::{Read, Seek};
75616
75617        use common::{url::Params, ToParts};
75618        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
75619
75620        let mut dd = common::DefaultDelegate;
75621        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
75622        dlg.begin(common::MethodInfo {
75623            id: "dfareporting.subaccounts.patch",
75624            http_method: hyper::Method::PATCH,
75625        });
75626
75627        for &field in ["alt", "profileId", "id"].iter() {
75628            if self._additional_params.contains_key(field) {
75629                dlg.finished(false);
75630                return Err(common::Error::FieldClash(field));
75631            }
75632        }
75633
75634        let mut params = Params::with_capacity(5 + self._additional_params.len());
75635        params.push("profileId", self._profile_id.to_string());
75636        params.push("id", self._id.to_string());
75637
75638        params.extend(self._additional_params.iter());
75639
75640        params.push("alt", "json");
75641        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/subaccounts";
75642        if self._scopes.is_empty() {
75643            self._scopes
75644                .insert(Scope::Dfatrafficking.as_ref().to_string());
75645        }
75646
75647        #[allow(clippy::single_element_loop)]
75648        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
75649            url = params.uri_replacement(url, param_name, find_this, false);
75650        }
75651        {
75652            let to_remove = ["profileId"];
75653            params.remove_params(&to_remove);
75654        }
75655
75656        let url = params.parse_with_url(&url);
75657
75658        let mut json_mime_type = mime::APPLICATION_JSON;
75659        let mut request_value_reader = {
75660            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
75661            common::remove_json_null_values(&mut value);
75662            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
75663            serde_json::to_writer(&mut dst, &value).unwrap();
75664            dst
75665        };
75666        let request_size = request_value_reader
75667            .seek(std::io::SeekFrom::End(0))
75668            .unwrap();
75669        request_value_reader
75670            .seek(std::io::SeekFrom::Start(0))
75671            .unwrap();
75672
75673        loop {
75674            let token = match self
75675                .hub
75676                .auth
75677                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
75678                .await
75679            {
75680                Ok(token) => token,
75681                Err(e) => match dlg.token(e) {
75682                    Ok(token) => token,
75683                    Err(e) => {
75684                        dlg.finished(false);
75685                        return Err(common::Error::MissingToken(e));
75686                    }
75687                },
75688            };
75689            request_value_reader
75690                .seek(std::io::SeekFrom::Start(0))
75691                .unwrap();
75692            let mut req_result = {
75693                let client = &self.hub.client;
75694                dlg.pre_request();
75695                let mut req_builder = hyper::Request::builder()
75696                    .method(hyper::Method::PATCH)
75697                    .uri(url.as_str())
75698                    .header(USER_AGENT, self.hub._user_agent.clone());
75699
75700                if let Some(token) = token.as_ref() {
75701                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
75702                }
75703
75704                let request = req_builder
75705                    .header(CONTENT_TYPE, json_mime_type.to_string())
75706                    .header(CONTENT_LENGTH, request_size as u64)
75707                    .body(common::to_body(
75708                        request_value_reader.get_ref().clone().into(),
75709                    ));
75710
75711                client.request(request.unwrap()).await
75712            };
75713
75714            match req_result {
75715                Err(err) => {
75716                    if let common::Retry::After(d) = dlg.http_error(&err) {
75717                        sleep(d).await;
75718                        continue;
75719                    }
75720                    dlg.finished(false);
75721                    return Err(common::Error::HttpError(err));
75722                }
75723                Ok(res) => {
75724                    let (mut parts, body) = res.into_parts();
75725                    let mut body = common::Body::new(body);
75726                    if !parts.status.is_success() {
75727                        let bytes = common::to_bytes(body).await.unwrap_or_default();
75728                        let error = serde_json::from_str(&common::to_string(&bytes));
75729                        let response = common::to_response(parts, bytes.into());
75730
75731                        if let common::Retry::After(d) =
75732                            dlg.http_failure(&response, error.as_ref().ok())
75733                        {
75734                            sleep(d).await;
75735                            continue;
75736                        }
75737
75738                        dlg.finished(false);
75739
75740                        return Err(match error {
75741                            Ok(value) => common::Error::BadRequest(value),
75742                            _ => common::Error::Failure(response),
75743                        });
75744                    }
75745                    let response = {
75746                        let bytes = common::to_bytes(body).await.unwrap_or_default();
75747                        let encoded = common::to_string(&bytes);
75748                        match serde_json::from_str(&encoded) {
75749                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
75750                            Err(error) => {
75751                                dlg.response_json_decode_error(&encoded, &error);
75752                                return Err(common::Error::JsonDecodeError(
75753                                    encoded.to_string(),
75754                                    error,
75755                                ));
75756                            }
75757                        }
75758                    };
75759
75760                    dlg.finished(true);
75761                    return Ok(response);
75762                }
75763            }
75764        }
75765    }
75766
75767    ///
75768    /// Sets the *request* property to the given value.
75769    ///
75770    /// Even though the property as already been set when instantiating this call,
75771    /// we provide this method for API completeness.
75772    pub fn request(mut self, new_value: Subaccount) -> SubaccountPatchCall<'a, C> {
75773        self._request = new_value;
75774        self
75775    }
75776    /// User profile ID associated with this request.
75777    ///
75778    /// Sets the *profile id* path property to the given value.
75779    ///
75780    /// Even though the property as already been set when instantiating this call,
75781    /// we provide this method for API completeness.
75782    pub fn profile_id(mut self, new_value: i64) -> SubaccountPatchCall<'a, C> {
75783        self._profile_id = new_value;
75784        self
75785    }
75786    /// Subaccount ID.
75787    ///
75788    /// Sets the *id* query property to the given value.
75789    ///
75790    /// Even though the property as already been set when instantiating this call,
75791    /// we provide this method for API completeness.
75792    pub fn id(mut self, new_value: i64) -> SubaccountPatchCall<'a, C> {
75793        self._id = new_value;
75794        self
75795    }
75796    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
75797    /// while executing the actual API request.
75798    ///
75799    /// ````text
75800    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
75801    /// ````
75802    ///
75803    /// Sets the *delegate* property to the given value.
75804    pub fn delegate(
75805        mut self,
75806        new_value: &'a mut dyn common::Delegate,
75807    ) -> SubaccountPatchCall<'a, C> {
75808        self._delegate = Some(new_value);
75809        self
75810    }
75811
75812    /// Set any additional parameter of the query string used in the request.
75813    /// It should be used to set parameters which are not yet available through their own
75814    /// setters.
75815    ///
75816    /// Please note that this method must not be used to set any of the known parameters
75817    /// which have their own setter method. If done anyway, the request will fail.
75818    ///
75819    /// # Additional Parameters
75820    ///
75821    /// * *$.xgafv* (query-string) - V1 error format.
75822    /// * *access_token* (query-string) - OAuth access token.
75823    /// * *alt* (query-string) - Data format for response.
75824    /// * *callback* (query-string) - JSONP
75825    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
75826    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
75827    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
75828    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
75829    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
75830    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
75831    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
75832    pub fn param<T>(mut self, name: T, value: T) -> SubaccountPatchCall<'a, C>
75833    where
75834        T: AsRef<str>,
75835    {
75836        self._additional_params
75837            .insert(name.as_ref().to_string(), value.as_ref().to_string());
75838        self
75839    }
75840
75841    /// Identifies the authorization scope for the method you are building.
75842    ///
75843    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
75844    /// [`Scope::Dfatrafficking`].
75845    ///
75846    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
75847    /// tokens for more than one scope.
75848    ///
75849    /// Usually there is more than one suitable scope to authorize an operation, some of which may
75850    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
75851    /// sufficient, a read-write scope will do as well.
75852    pub fn add_scope<St>(mut self, scope: St) -> SubaccountPatchCall<'a, C>
75853    where
75854        St: AsRef<str>,
75855    {
75856        self._scopes.insert(String::from(scope.as_ref()));
75857        self
75858    }
75859    /// Identifies the authorization scope(s) for the method you are building.
75860    ///
75861    /// See [`Self::add_scope()`] for details.
75862    pub fn add_scopes<I, St>(mut self, scopes: I) -> SubaccountPatchCall<'a, C>
75863    where
75864        I: IntoIterator<Item = St>,
75865        St: AsRef<str>,
75866    {
75867        self._scopes
75868            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
75869        self
75870    }
75871
75872    /// Removes all scopes, and no default scope will be used either.
75873    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
75874    /// for details).
75875    pub fn clear_scopes(mut self) -> SubaccountPatchCall<'a, C> {
75876        self._scopes.clear();
75877        self
75878    }
75879}
75880
75881/// Updates an existing subaccount.
75882///
75883/// A builder for the *update* method supported by a *subaccount* resource.
75884/// It is not used directly, but through a [`SubaccountMethods`] instance.
75885///
75886/// # Example
75887///
75888/// Instantiate a resource method builder
75889///
75890/// ```test_harness,no_run
75891/// # extern crate hyper;
75892/// # extern crate hyper_rustls;
75893/// # extern crate google_dfareporting3d3 as dfareporting3d3;
75894/// use dfareporting3d3::api::Subaccount;
75895/// # async fn dox() {
75896/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
75897///
75898/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
75899/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
75900/// #     secret,
75901/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
75902/// # ).build().await.unwrap();
75903///
75904/// # let client = hyper_util::client::legacy::Client::builder(
75905/// #     hyper_util::rt::TokioExecutor::new()
75906/// # )
75907/// # .build(
75908/// #     hyper_rustls::HttpsConnectorBuilder::new()
75909/// #         .with_native_roots()
75910/// #         .unwrap()
75911/// #         .https_or_http()
75912/// #         .enable_http1()
75913/// #         .build()
75914/// # );
75915/// # let mut hub = Dfareporting::new(client, auth);
75916/// // As the method needs a request, you would usually fill it with the desired information
75917/// // into the respective structure. Some of the parts shown here might not be applicable !
75918/// // Values shown here are possibly random and not representative !
75919/// let mut req = Subaccount::default();
75920///
75921/// // You can configure optional parameters by calling the respective setters at will, and
75922/// // execute the final call using `doit()`.
75923/// // Values shown here are possibly random and not representative !
75924/// let result = hub.subaccounts().update(req, -96)
75925///              .doit().await;
75926/// # }
75927/// ```
75928pub struct SubaccountUpdateCall<'a, C>
75929where
75930    C: 'a,
75931{
75932    hub: &'a Dfareporting<C>,
75933    _request: Subaccount,
75934    _profile_id: i64,
75935    _delegate: Option<&'a mut dyn common::Delegate>,
75936    _additional_params: HashMap<String, String>,
75937    _scopes: BTreeSet<String>,
75938}
75939
75940impl<'a, C> common::CallBuilder for SubaccountUpdateCall<'a, C> {}
75941
75942impl<'a, C> SubaccountUpdateCall<'a, C>
75943where
75944    C: common::Connector,
75945{
75946    /// Perform the operation you have build so far.
75947    pub async fn doit(mut self) -> common::Result<(common::Response, Subaccount)> {
75948        use std::borrow::Cow;
75949        use std::io::{Read, Seek};
75950
75951        use common::{url::Params, ToParts};
75952        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
75953
75954        let mut dd = common::DefaultDelegate;
75955        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
75956        dlg.begin(common::MethodInfo {
75957            id: "dfareporting.subaccounts.update",
75958            http_method: hyper::Method::PUT,
75959        });
75960
75961        for &field in ["alt", "profileId"].iter() {
75962            if self._additional_params.contains_key(field) {
75963                dlg.finished(false);
75964                return Err(common::Error::FieldClash(field));
75965            }
75966        }
75967
75968        let mut params = Params::with_capacity(4 + self._additional_params.len());
75969        params.push("profileId", self._profile_id.to_string());
75970
75971        params.extend(self._additional_params.iter());
75972
75973        params.push("alt", "json");
75974        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/subaccounts";
75975        if self._scopes.is_empty() {
75976            self._scopes
75977                .insert(Scope::Dfatrafficking.as_ref().to_string());
75978        }
75979
75980        #[allow(clippy::single_element_loop)]
75981        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
75982            url = params.uri_replacement(url, param_name, find_this, false);
75983        }
75984        {
75985            let to_remove = ["profileId"];
75986            params.remove_params(&to_remove);
75987        }
75988
75989        let url = params.parse_with_url(&url);
75990
75991        let mut json_mime_type = mime::APPLICATION_JSON;
75992        let mut request_value_reader = {
75993            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
75994            common::remove_json_null_values(&mut value);
75995            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
75996            serde_json::to_writer(&mut dst, &value).unwrap();
75997            dst
75998        };
75999        let request_size = request_value_reader
76000            .seek(std::io::SeekFrom::End(0))
76001            .unwrap();
76002        request_value_reader
76003            .seek(std::io::SeekFrom::Start(0))
76004            .unwrap();
76005
76006        loop {
76007            let token = match self
76008                .hub
76009                .auth
76010                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
76011                .await
76012            {
76013                Ok(token) => token,
76014                Err(e) => match dlg.token(e) {
76015                    Ok(token) => token,
76016                    Err(e) => {
76017                        dlg.finished(false);
76018                        return Err(common::Error::MissingToken(e));
76019                    }
76020                },
76021            };
76022            request_value_reader
76023                .seek(std::io::SeekFrom::Start(0))
76024                .unwrap();
76025            let mut req_result = {
76026                let client = &self.hub.client;
76027                dlg.pre_request();
76028                let mut req_builder = hyper::Request::builder()
76029                    .method(hyper::Method::PUT)
76030                    .uri(url.as_str())
76031                    .header(USER_AGENT, self.hub._user_agent.clone());
76032
76033                if let Some(token) = token.as_ref() {
76034                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
76035                }
76036
76037                let request = req_builder
76038                    .header(CONTENT_TYPE, json_mime_type.to_string())
76039                    .header(CONTENT_LENGTH, request_size as u64)
76040                    .body(common::to_body(
76041                        request_value_reader.get_ref().clone().into(),
76042                    ));
76043
76044                client.request(request.unwrap()).await
76045            };
76046
76047            match req_result {
76048                Err(err) => {
76049                    if let common::Retry::After(d) = dlg.http_error(&err) {
76050                        sleep(d).await;
76051                        continue;
76052                    }
76053                    dlg.finished(false);
76054                    return Err(common::Error::HttpError(err));
76055                }
76056                Ok(res) => {
76057                    let (mut parts, body) = res.into_parts();
76058                    let mut body = common::Body::new(body);
76059                    if !parts.status.is_success() {
76060                        let bytes = common::to_bytes(body).await.unwrap_or_default();
76061                        let error = serde_json::from_str(&common::to_string(&bytes));
76062                        let response = common::to_response(parts, bytes.into());
76063
76064                        if let common::Retry::After(d) =
76065                            dlg.http_failure(&response, error.as_ref().ok())
76066                        {
76067                            sleep(d).await;
76068                            continue;
76069                        }
76070
76071                        dlg.finished(false);
76072
76073                        return Err(match error {
76074                            Ok(value) => common::Error::BadRequest(value),
76075                            _ => common::Error::Failure(response),
76076                        });
76077                    }
76078                    let response = {
76079                        let bytes = common::to_bytes(body).await.unwrap_or_default();
76080                        let encoded = common::to_string(&bytes);
76081                        match serde_json::from_str(&encoded) {
76082                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
76083                            Err(error) => {
76084                                dlg.response_json_decode_error(&encoded, &error);
76085                                return Err(common::Error::JsonDecodeError(
76086                                    encoded.to_string(),
76087                                    error,
76088                                ));
76089                            }
76090                        }
76091                    };
76092
76093                    dlg.finished(true);
76094                    return Ok(response);
76095                }
76096            }
76097        }
76098    }
76099
76100    ///
76101    /// Sets the *request* property to the given value.
76102    ///
76103    /// Even though the property as already been set when instantiating this call,
76104    /// we provide this method for API completeness.
76105    pub fn request(mut self, new_value: Subaccount) -> SubaccountUpdateCall<'a, C> {
76106        self._request = new_value;
76107        self
76108    }
76109    /// User profile ID associated with this request.
76110    ///
76111    /// Sets the *profile id* path property to the given value.
76112    ///
76113    /// Even though the property as already been set when instantiating this call,
76114    /// we provide this method for API completeness.
76115    pub fn profile_id(mut self, new_value: i64) -> SubaccountUpdateCall<'a, C> {
76116        self._profile_id = new_value;
76117        self
76118    }
76119    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
76120    /// while executing the actual API request.
76121    ///
76122    /// ````text
76123    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
76124    /// ````
76125    ///
76126    /// Sets the *delegate* property to the given value.
76127    pub fn delegate(
76128        mut self,
76129        new_value: &'a mut dyn common::Delegate,
76130    ) -> SubaccountUpdateCall<'a, C> {
76131        self._delegate = Some(new_value);
76132        self
76133    }
76134
76135    /// Set any additional parameter of the query string used in the request.
76136    /// It should be used to set parameters which are not yet available through their own
76137    /// setters.
76138    ///
76139    /// Please note that this method must not be used to set any of the known parameters
76140    /// which have their own setter method. If done anyway, the request will fail.
76141    ///
76142    /// # Additional Parameters
76143    ///
76144    /// * *$.xgafv* (query-string) - V1 error format.
76145    /// * *access_token* (query-string) - OAuth access token.
76146    /// * *alt* (query-string) - Data format for response.
76147    /// * *callback* (query-string) - JSONP
76148    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
76149    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
76150    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
76151    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
76152    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
76153    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
76154    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
76155    pub fn param<T>(mut self, name: T, value: T) -> SubaccountUpdateCall<'a, C>
76156    where
76157        T: AsRef<str>,
76158    {
76159        self._additional_params
76160            .insert(name.as_ref().to_string(), value.as_ref().to_string());
76161        self
76162    }
76163
76164    /// Identifies the authorization scope for the method you are building.
76165    ///
76166    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
76167    /// [`Scope::Dfatrafficking`].
76168    ///
76169    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
76170    /// tokens for more than one scope.
76171    ///
76172    /// Usually there is more than one suitable scope to authorize an operation, some of which may
76173    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
76174    /// sufficient, a read-write scope will do as well.
76175    pub fn add_scope<St>(mut self, scope: St) -> SubaccountUpdateCall<'a, C>
76176    where
76177        St: AsRef<str>,
76178    {
76179        self._scopes.insert(String::from(scope.as_ref()));
76180        self
76181    }
76182    /// Identifies the authorization scope(s) for the method you are building.
76183    ///
76184    /// See [`Self::add_scope()`] for details.
76185    pub fn add_scopes<I, St>(mut self, scopes: I) -> SubaccountUpdateCall<'a, C>
76186    where
76187        I: IntoIterator<Item = St>,
76188        St: AsRef<str>,
76189    {
76190        self._scopes
76191            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
76192        self
76193    }
76194
76195    /// Removes all scopes, and no default scope will be used either.
76196    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
76197    /// for details).
76198    pub fn clear_scopes(mut self) -> SubaccountUpdateCall<'a, C> {
76199        self._scopes.clear();
76200        self
76201    }
76202}
76203
76204/// Gets one remarketing list by ID.
76205///
76206/// A builder for the *get* method supported by a *targetableRemarketingList* resource.
76207/// It is not used directly, but through a [`TargetableRemarketingListMethods`] instance.
76208///
76209/// # Example
76210///
76211/// Instantiate a resource method builder
76212///
76213/// ```test_harness,no_run
76214/// # extern crate hyper;
76215/// # extern crate hyper_rustls;
76216/// # extern crate google_dfareporting3d3 as dfareporting3d3;
76217/// # async fn dox() {
76218/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
76219///
76220/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
76221/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
76222/// #     secret,
76223/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
76224/// # ).build().await.unwrap();
76225///
76226/// # let client = hyper_util::client::legacy::Client::builder(
76227/// #     hyper_util::rt::TokioExecutor::new()
76228/// # )
76229/// # .build(
76230/// #     hyper_rustls::HttpsConnectorBuilder::new()
76231/// #         .with_native_roots()
76232/// #         .unwrap()
76233/// #         .https_or_http()
76234/// #         .enable_http1()
76235/// #         .build()
76236/// # );
76237/// # let mut hub = Dfareporting::new(client, auth);
76238/// // You can configure optional parameters by calling the respective setters at will, and
76239/// // execute the final call using `doit()`.
76240/// // Values shown here are possibly random and not representative !
76241/// let result = hub.targetable_remarketing_lists().get(-27, -35)
76242///              .doit().await;
76243/// # }
76244/// ```
76245pub struct TargetableRemarketingListGetCall<'a, C>
76246where
76247    C: 'a,
76248{
76249    hub: &'a Dfareporting<C>,
76250    _profile_id: i64,
76251    _id: i64,
76252    _delegate: Option<&'a mut dyn common::Delegate>,
76253    _additional_params: HashMap<String, String>,
76254    _scopes: BTreeSet<String>,
76255}
76256
76257impl<'a, C> common::CallBuilder for TargetableRemarketingListGetCall<'a, C> {}
76258
76259impl<'a, C> TargetableRemarketingListGetCall<'a, C>
76260where
76261    C: common::Connector,
76262{
76263    /// Perform the operation you have build so far.
76264    pub async fn doit(mut self) -> common::Result<(common::Response, TargetableRemarketingList)> {
76265        use std::borrow::Cow;
76266        use std::io::{Read, Seek};
76267
76268        use common::{url::Params, ToParts};
76269        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
76270
76271        let mut dd = common::DefaultDelegate;
76272        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
76273        dlg.begin(common::MethodInfo {
76274            id: "dfareporting.targetableRemarketingLists.get",
76275            http_method: hyper::Method::GET,
76276        });
76277
76278        for &field in ["alt", "profileId", "id"].iter() {
76279            if self._additional_params.contains_key(field) {
76280                dlg.finished(false);
76281                return Err(common::Error::FieldClash(field));
76282            }
76283        }
76284
76285        let mut params = Params::with_capacity(4 + self._additional_params.len());
76286        params.push("profileId", self._profile_id.to_string());
76287        params.push("id", self._id.to_string());
76288
76289        params.extend(self._additional_params.iter());
76290
76291        params.push("alt", "json");
76292        let mut url =
76293            self.hub._base_url.clone() + "userprofiles/{profileId}/targetableRemarketingLists/{id}";
76294        if self._scopes.is_empty() {
76295            self._scopes
76296                .insert(Scope::Dfatrafficking.as_ref().to_string());
76297        }
76298
76299        #[allow(clippy::single_element_loop)]
76300        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
76301            url = params.uri_replacement(url, param_name, find_this, false);
76302        }
76303        {
76304            let to_remove = ["id", "profileId"];
76305            params.remove_params(&to_remove);
76306        }
76307
76308        let url = params.parse_with_url(&url);
76309
76310        loop {
76311            let token = match self
76312                .hub
76313                .auth
76314                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
76315                .await
76316            {
76317                Ok(token) => token,
76318                Err(e) => match dlg.token(e) {
76319                    Ok(token) => token,
76320                    Err(e) => {
76321                        dlg.finished(false);
76322                        return Err(common::Error::MissingToken(e));
76323                    }
76324                },
76325            };
76326            let mut req_result = {
76327                let client = &self.hub.client;
76328                dlg.pre_request();
76329                let mut req_builder = hyper::Request::builder()
76330                    .method(hyper::Method::GET)
76331                    .uri(url.as_str())
76332                    .header(USER_AGENT, self.hub._user_agent.clone());
76333
76334                if let Some(token) = token.as_ref() {
76335                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
76336                }
76337
76338                let request = req_builder
76339                    .header(CONTENT_LENGTH, 0_u64)
76340                    .body(common::to_body::<String>(None));
76341
76342                client.request(request.unwrap()).await
76343            };
76344
76345            match req_result {
76346                Err(err) => {
76347                    if let common::Retry::After(d) = dlg.http_error(&err) {
76348                        sleep(d).await;
76349                        continue;
76350                    }
76351                    dlg.finished(false);
76352                    return Err(common::Error::HttpError(err));
76353                }
76354                Ok(res) => {
76355                    let (mut parts, body) = res.into_parts();
76356                    let mut body = common::Body::new(body);
76357                    if !parts.status.is_success() {
76358                        let bytes = common::to_bytes(body).await.unwrap_or_default();
76359                        let error = serde_json::from_str(&common::to_string(&bytes));
76360                        let response = common::to_response(parts, bytes.into());
76361
76362                        if let common::Retry::After(d) =
76363                            dlg.http_failure(&response, error.as_ref().ok())
76364                        {
76365                            sleep(d).await;
76366                            continue;
76367                        }
76368
76369                        dlg.finished(false);
76370
76371                        return Err(match error {
76372                            Ok(value) => common::Error::BadRequest(value),
76373                            _ => common::Error::Failure(response),
76374                        });
76375                    }
76376                    let response = {
76377                        let bytes = common::to_bytes(body).await.unwrap_or_default();
76378                        let encoded = common::to_string(&bytes);
76379                        match serde_json::from_str(&encoded) {
76380                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
76381                            Err(error) => {
76382                                dlg.response_json_decode_error(&encoded, &error);
76383                                return Err(common::Error::JsonDecodeError(
76384                                    encoded.to_string(),
76385                                    error,
76386                                ));
76387                            }
76388                        }
76389                    };
76390
76391                    dlg.finished(true);
76392                    return Ok(response);
76393                }
76394            }
76395        }
76396    }
76397
76398    /// User profile ID associated with this request.
76399    ///
76400    /// Sets the *profile id* path property to the given value.
76401    ///
76402    /// Even though the property as already been set when instantiating this call,
76403    /// we provide this method for API completeness.
76404    pub fn profile_id(mut self, new_value: i64) -> TargetableRemarketingListGetCall<'a, C> {
76405        self._profile_id = new_value;
76406        self
76407    }
76408    /// Remarketing list ID.
76409    ///
76410    /// Sets the *id* path property to the given value.
76411    ///
76412    /// Even though the property as already been set when instantiating this call,
76413    /// we provide this method for API completeness.
76414    pub fn id(mut self, new_value: i64) -> TargetableRemarketingListGetCall<'a, C> {
76415        self._id = new_value;
76416        self
76417    }
76418    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
76419    /// while executing the actual API request.
76420    ///
76421    /// ````text
76422    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
76423    /// ````
76424    ///
76425    /// Sets the *delegate* property to the given value.
76426    pub fn delegate(
76427        mut self,
76428        new_value: &'a mut dyn common::Delegate,
76429    ) -> TargetableRemarketingListGetCall<'a, C> {
76430        self._delegate = Some(new_value);
76431        self
76432    }
76433
76434    /// Set any additional parameter of the query string used in the request.
76435    /// It should be used to set parameters which are not yet available through their own
76436    /// setters.
76437    ///
76438    /// Please note that this method must not be used to set any of the known parameters
76439    /// which have their own setter method. If done anyway, the request will fail.
76440    ///
76441    /// # Additional Parameters
76442    ///
76443    /// * *$.xgafv* (query-string) - V1 error format.
76444    /// * *access_token* (query-string) - OAuth access token.
76445    /// * *alt* (query-string) - Data format for response.
76446    /// * *callback* (query-string) - JSONP
76447    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
76448    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
76449    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
76450    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
76451    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
76452    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
76453    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
76454    pub fn param<T>(mut self, name: T, value: T) -> TargetableRemarketingListGetCall<'a, C>
76455    where
76456        T: AsRef<str>,
76457    {
76458        self._additional_params
76459            .insert(name.as_ref().to_string(), value.as_ref().to_string());
76460        self
76461    }
76462
76463    /// Identifies the authorization scope for the method you are building.
76464    ///
76465    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
76466    /// [`Scope::Dfatrafficking`].
76467    ///
76468    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
76469    /// tokens for more than one scope.
76470    ///
76471    /// Usually there is more than one suitable scope to authorize an operation, some of which may
76472    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
76473    /// sufficient, a read-write scope will do as well.
76474    pub fn add_scope<St>(mut self, scope: St) -> TargetableRemarketingListGetCall<'a, C>
76475    where
76476        St: AsRef<str>,
76477    {
76478        self._scopes.insert(String::from(scope.as_ref()));
76479        self
76480    }
76481    /// Identifies the authorization scope(s) for the method you are building.
76482    ///
76483    /// See [`Self::add_scope()`] for details.
76484    pub fn add_scopes<I, St>(mut self, scopes: I) -> TargetableRemarketingListGetCall<'a, C>
76485    where
76486        I: IntoIterator<Item = St>,
76487        St: AsRef<str>,
76488    {
76489        self._scopes
76490            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
76491        self
76492    }
76493
76494    /// Removes all scopes, and no default scope will be used either.
76495    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
76496    /// for details).
76497    pub fn clear_scopes(mut self) -> TargetableRemarketingListGetCall<'a, C> {
76498        self._scopes.clear();
76499        self
76500    }
76501}
76502
76503/// Retrieves a list of targetable remarketing lists, possibly filtered. This method supports paging.
76504///
76505/// A builder for the *list* method supported by a *targetableRemarketingList* resource.
76506/// It is not used directly, but through a [`TargetableRemarketingListMethods`] instance.
76507///
76508/// # Example
76509///
76510/// Instantiate a resource method builder
76511///
76512/// ```test_harness,no_run
76513/// # extern crate hyper;
76514/// # extern crate hyper_rustls;
76515/// # extern crate google_dfareporting3d3 as dfareporting3d3;
76516/// # async fn dox() {
76517/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
76518///
76519/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
76520/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
76521/// #     secret,
76522/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
76523/// # ).build().await.unwrap();
76524///
76525/// # let client = hyper_util::client::legacy::Client::builder(
76526/// #     hyper_util::rt::TokioExecutor::new()
76527/// # )
76528/// # .build(
76529/// #     hyper_rustls::HttpsConnectorBuilder::new()
76530/// #         .with_native_roots()
76531/// #         .unwrap()
76532/// #         .https_or_http()
76533/// #         .enable_http1()
76534/// #         .build()
76535/// # );
76536/// # let mut hub = Dfareporting::new(client, auth);
76537/// // You can configure optional parameters by calling the respective setters at will, and
76538/// // execute the final call using `doit()`.
76539/// // Values shown here are possibly random and not representative !
76540/// let result = hub.targetable_remarketing_lists().list(-23, -98)
76541///              .sort_order("voluptua.")
76542///              .sort_field("kasd")
76543///              .page_token("no")
76544///              .name("amet.")
76545///              .max_results(-82)
76546///              .active(true)
76547///              .doit().await;
76548/// # }
76549/// ```
76550pub struct TargetableRemarketingListListCall<'a, C>
76551where
76552    C: 'a,
76553{
76554    hub: &'a Dfareporting<C>,
76555    _profile_id: i64,
76556    _advertiser_id: i64,
76557    _sort_order: Option<String>,
76558    _sort_field: Option<String>,
76559    _page_token: Option<String>,
76560    _name: Option<String>,
76561    _max_results: Option<i32>,
76562    _active: Option<bool>,
76563    _delegate: Option<&'a mut dyn common::Delegate>,
76564    _additional_params: HashMap<String, String>,
76565    _scopes: BTreeSet<String>,
76566}
76567
76568impl<'a, C> common::CallBuilder for TargetableRemarketingListListCall<'a, C> {}
76569
76570impl<'a, C> TargetableRemarketingListListCall<'a, C>
76571where
76572    C: common::Connector,
76573{
76574    /// Perform the operation you have build so far.
76575    pub async fn doit(
76576        mut self,
76577    ) -> common::Result<(common::Response, TargetableRemarketingListsListResponse)> {
76578        use std::borrow::Cow;
76579        use std::io::{Read, Seek};
76580
76581        use common::{url::Params, ToParts};
76582        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
76583
76584        let mut dd = common::DefaultDelegate;
76585        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
76586        dlg.begin(common::MethodInfo {
76587            id: "dfareporting.targetableRemarketingLists.list",
76588            http_method: hyper::Method::GET,
76589        });
76590
76591        for &field in [
76592            "alt",
76593            "profileId",
76594            "advertiserId",
76595            "sortOrder",
76596            "sortField",
76597            "pageToken",
76598            "name",
76599            "maxResults",
76600            "active",
76601        ]
76602        .iter()
76603        {
76604            if self._additional_params.contains_key(field) {
76605                dlg.finished(false);
76606                return Err(common::Error::FieldClash(field));
76607            }
76608        }
76609
76610        let mut params = Params::with_capacity(10 + self._additional_params.len());
76611        params.push("profileId", self._profile_id.to_string());
76612        params.push("advertiserId", self._advertiser_id.to_string());
76613        if let Some(value) = self._sort_order.as_ref() {
76614            params.push("sortOrder", value);
76615        }
76616        if let Some(value) = self._sort_field.as_ref() {
76617            params.push("sortField", value);
76618        }
76619        if let Some(value) = self._page_token.as_ref() {
76620            params.push("pageToken", value);
76621        }
76622        if let Some(value) = self._name.as_ref() {
76623            params.push("name", value);
76624        }
76625        if let Some(value) = self._max_results.as_ref() {
76626            params.push("maxResults", value.to_string());
76627        }
76628        if let Some(value) = self._active.as_ref() {
76629            params.push("active", value.to_string());
76630        }
76631
76632        params.extend(self._additional_params.iter());
76633
76634        params.push("alt", "json");
76635        let mut url =
76636            self.hub._base_url.clone() + "userprofiles/{profileId}/targetableRemarketingLists";
76637        if self._scopes.is_empty() {
76638            self._scopes
76639                .insert(Scope::Dfatrafficking.as_ref().to_string());
76640        }
76641
76642        #[allow(clippy::single_element_loop)]
76643        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
76644            url = params.uri_replacement(url, param_name, find_this, false);
76645        }
76646        {
76647            let to_remove = ["profileId"];
76648            params.remove_params(&to_remove);
76649        }
76650
76651        let url = params.parse_with_url(&url);
76652
76653        loop {
76654            let token = match self
76655                .hub
76656                .auth
76657                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
76658                .await
76659            {
76660                Ok(token) => token,
76661                Err(e) => match dlg.token(e) {
76662                    Ok(token) => token,
76663                    Err(e) => {
76664                        dlg.finished(false);
76665                        return Err(common::Error::MissingToken(e));
76666                    }
76667                },
76668            };
76669            let mut req_result = {
76670                let client = &self.hub.client;
76671                dlg.pre_request();
76672                let mut req_builder = hyper::Request::builder()
76673                    .method(hyper::Method::GET)
76674                    .uri(url.as_str())
76675                    .header(USER_AGENT, self.hub._user_agent.clone());
76676
76677                if let Some(token) = token.as_ref() {
76678                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
76679                }
76680
76681                let request = req_builder
76682                    .header(CONTENT_LENGTH, 0_u64)
76683                    .body(common::to_body::<String>(None));
76684
76685                client.request(request.unwrap()).await
76686            };
76687
76688            match req_result {
76689                Err(err) => {
76690                    if let common::Retry::After(d) = dlg.http_error(&err) {
76691                        sleep(d).await;
76692                        continue;
76693                    }
76694                    dlg.finished(false);
76695                    return Err(common::Error::HttpError(err));
76696                }
76697                Ok(res) => {
76698                    let (mut parts, body) = res.into_parts();
76699                    let mut body = common::Body::new(body);
76700                    if !parts.status.is_success() {
76701                        let bytes = common::to_bytes(body).await.unwrap_or_default();
76702                        let error = serde_json::from_str(&common::to_string(&bytes));
76703                        let response = common::to_response(parts, bytes.into());
76704
76705                        if let common::Retry::After(d) =
76706                            dlg.http_failure(&response, error.as_ref().ok())
76707                        {
76708                            sleep(d).await;
76709                            continue;
76710                        }
76711
76712                        dlg.finished(false);
76713
76714                        return Err(match error {
76715                            Ok(value) => common::Error::BadRequest(value),
76716                            _ => common::Error::Failure(response),
76717                        });
76718                    }
76719                    let response = {
76720                        let bytes = common::to_bytes(body).await.unwrap_or_default();
76721                        let encoded = common::to_string(&bytes);
76722                        match serde_json::from_str(&encoded) {
76723                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
76724                            Err(error) => {
76725                                dlg.response_json_decode_error(&encoded, &error);
76726                                return Err(common::Error::JsonDecodeError(
76727                                    encoded.to_string(),
76728                                    error,
76729                                ));
76730                            }
76731                        }
76732                    };
76733
76734                    dlg.finished(true);
76735                    return Ok(response);
76736                }
76737            }
76738        }
76739    }
76740
76741    /// User profile ID associated with this request.
76742    ///
76743    /// Sets the *profile id* path property to the given value.
76744    ///
76745    /// Even though the property as already been set when instantiating this call,
76746    /// we provide this method for API completeness.
76747    pub fn profile_id(mut self, new_value: i64) -> TargetableRemarketingListListCall<'a, C> {
76748        self._profile_id = new_value;
76749        self
76750    }
76751    /// Select only targetable remarketing lists targetable by these advertisers.
76752    ///
76753    /// Sets the *advertiser id* query property to the given value.
76754    ///
76755    /// Even though the property as already been set when instantiating this call,
76756    /// we provide this method for API completeness.
76757    pub fn advertiser_id(mut self, new_value: i64) -> TargetableRemarketingListListCall<'a, C> {
76758        self._advertiser_id = new_value;
76759        self
76760    }
76761    /// Order of sorted results.
76762    ///
76763    /// Sets the *sort order* query property to the given value.
76764    pub fn sort_order(mut self, new_value: &str) -> TargetableRemarketingListListCall<'a, C> {
76765        self._sort_order = Some(new_value.to_string());
76766        self
76767    }
76768    /// Field by which to sort the list.
76769    ///
76770    /// Sets the *sort field* query property to the given value.
76771    pub fn sort_field(mut self, new_value: &str) -> TargetableRemarketingListListCall<'a, C> {
76772        self._sort_field = Some(new_value.to_string());
76773        self
76774    }
76775    /// Value of the nextPageToken from the previous result page.
76776    ///
76777    /// Sets the *page token* query property to the given value.
76778    pub fn page_token(mut self, new_value: &str) -> TargetableRemarketingListListCall<'a, C> {
76779        self._page_token = Some(new_value.to_string());
76780        self
76781    }
76782    /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "remarketing list*2015" will return objects with names like "remarketing list June 2015", "remarketing list April 2015", or simply "remarketing list 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "remarketing list" will match objects with name "my remarketing list", "remarketing list 2015", or simply "remarketing list".
76783    ///
76784    /// Sets the *name* query property to the given value.
76785    pub fn name(mut self, new_value: &str) -> TargetableRemarketingListListCall<'a, C> {
76786        self._name = Some(new_value.to_string());
76787        self
76788    }
76789    /// Maximum number of results to return.
76790    ///
76791    /// Sets the *max results* query property to the given value.
76792    pub fn max_results(mut self, new_value: i32) -> TargetableRemarketingListListCall<'a, C> {
76793        self._max_results = Some(new_value);
76794        self
76795    }
76796    /// Select only active or only inactive targetable remarketing lists.
76797    ///
76798    /// Sets the *active* query property to the given value.
76799    pub fn active(mut self, new_value: bool) -> TargetableRemarketingListListCall<'a, C> {
76800        self._active = Some(new_value);
76801        self
76802    }
76803    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
76804    /// while executing the actual API request.
76805    ///
76806    /// ````text
76807    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
76808    /// ````
76809    ///
76810    /// Sets the *delegate* property to the given value.
76811    pub fn delegate(
76812        mut self,
76813        new_value: &'a mut dyn common::Delegate,
76814    ) -> TargetableRemarketingListListCall<'a, C> {
76815        self._delegate = Some(new_value);
76816        self
76817    }
76818
76819    /// Set any additional parameter of the query string used in the request.
76820    /// It should be used to set parameters which are not yet available through their own
76821    /// setters.
76822    ///
76823    /// Please note that this method must not be used to set any of the known parameters
76824    /// which have their own setter method. If done anyway, the request will fail.
76825    ///
76826    /// # Additional Parameters
76827    ///
76828    /// * *$.xgafv* (query-string) - V1 error format.
76829    /// * *access_token* (query-string) - OAuth access token.
76830    /// * *alt* (query-string) - Data format for response.
76831    /// * *callback* (query-string) - JSONP
76832    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
76833    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
76834    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
76835    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
76836    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
76837    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
76838    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
76839    pub fn param<T>(mut self, name: T, value: T) -> TargetableRemarketingListListCall<'a, C>
76840    where
76841        T: AsRef<str>,
76842    {
76843        self._additional_params
76844            .insert(name.as_ref().to_string(), value.as_ref().to_string());
76845        self
76846    }
76847
76848    /// Identifies the authorization scope for the method you are building.
76849    ///
76850    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
76851    /// [`Scope::Dfatrafficking`].
76852    ///
76853    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
76854    /// tokens for more than one scope.
76855    ///
76856    /// Usually there is more than one suitable scope to authorize an operation, some of which may
76857    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
76858    /// sufficient, a read-write scope will do as well.
76859    pub fn add_scope<St>(mut self, scope: St) -> TargetableRemarketingListListCall<'a, C>
76860    where
76861        St: AsRef<str>,
76862    {
76863        self._scopes.insert(String::from(scope.as_ref()));
76864        self
76865    }
76866    /// Identifies the authorization scope(s) for the method you are building.
76867    ///
76868    /// See [`Self::add_scope()`] for details.
76869    pub fn add_scopes<I, St>(mut self, scopes: I) -> TargetableRemarketingListListCall<'a, C>
76870    where
76871        I: IntoIterator<Item = St>,
76872        St: AsRef<str>,
76873    {
76874        self._scopes
76875            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
76876        self
76877    }
76878
76879    /// Removes all scopes, and no default scope will be used either.
76880    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
76881    /// for details).
76882    pub fn clear_scopes(mut self) -> TargetableRemarketingListListCall<'a, C> {
76883        self._scopes.clear();
76884        self
76885    }
76886}
76887
76888/// Gets one targeting template by ID.
76889///
76890/// A builder for the *get* method supported by a *targetingTemplate* resource.
76891/// It is not used directly, but through a [`TargetingTemplateMethods`] instance.
76892///
76893/// # Example
76894///
76895/// Instantiate a resource method builder
76896///
76897/// ```test_harness,no_run
76898/// # extern crate hyper;
76899/// # extern crate hyper_rustls;
76900/// # extern crate google_dfareporting3d3 as dfareporting3d3;
76901/// # async fn dox() {
76902/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
76903///
76904/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
76905/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
76906/// #     secret,
76907/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
76908/// # ).build().await.unwrap();
76909///
76910/// # let client = hyper_util::client::legacy::Client::builder(
76911/// #     hyper_util::rt::TokioExecutor::new()
76912/// # )
76913/// # .build(
76914/// #     hyper_rustls::HttpsConnectorBuilder::new()
76915/// #         .with_native_roots()
76916/// #         .unwrap()
76917/// #         .https_or_http()
76918/// #         .enable_http1()
76919/// #         .build()
76920/// # );
76921/// # let mut hub = Dfareporting::new(client, auth);
76922/// // You can configure optional parameters by calling the respective setters at will, and
76923/// // execute the final call using `doit()`.
76924/// // Values shown here are possibly random and not representative !
76925/// let result = hub.targeting_templates().get(-70, -63)
76926///              .doit().await;
76927/// # }
76928/// ```
76929pub struct TargetingTemplateGetCall<'a, C>
76930where
76931    C: 'a,
76932{
76933    hub: &'a Dfareporting<C>,
76934    _profile_id: i64,
76935    _id: i64,
76936    _delegate: Option<&'a mut dyn common::Delegate>,
76937    _additional_params: HashMap<String, String>,
76938    _scopes: BTreeSet<String>,
76939}
76940
76941impl<'a, C> common::CallBuilder for TargetingTemplateGetCall<'a, C> {}
76942
76943impl<'a, C> TargetingTemplateGetCall<'a, C>
76944where
76945    C: common::Connector,
76946{
76947    /// Perform the operation you have build so far.
76948    pub async fn doit(mut self) -> common::Result<(common::Response, TargetingTemplate)> {
76949        use std::borrow::Cow;
76950        use std::io::{Read, Seek};
76951
76952        use common::{url::Params, ToParts};
76953        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
76954
76955        let mut dd = common::DefaultDelegate;
76956        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
76957        dlg.begin(common::MethodInfo {
76958            id: "dfareporting.targetingTemplates.get",
76959            http_method: hyper::Method::GET,
76960        });
76961
76962        for &field in ["alt", "profileId", "id"].iter() {
76963            if self._additional_params.contains_key(field) {
76964                dlg.finished(false);
76965                return Err(common::Error::FieldClash(field));
76966            }
76967        }
76968
76969        let mut params = Params::with_capacity(4 + self._additional_params.len());
76970        params.push("profileId", self._profile_id.to_string());
76971        params.push("id", self._id.to_string());
76972
76973        params.extend(self._additional_params.iter());
76974
76975        params.push("alt", "json");
76976        let mut url =
76977            self.hub._base_url.clone() + "userprofiles/{profileId}/targetingTemplates/{id}";
76978        if self._scopes.is_empty() {
76979            self._scopes
76980                .insert(Scope::Dfatrafficking.as_ref().to_string());
76981        }
76982
76983        #[allow(clippy::single_element_loop)]
76984        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
76985            url = params.uri_replacement(url, param_name, find_this, false);
76986        }
76987        {
76988            let to_remove = ["id", "profileId"];
76989            params.remove_params(&to_remove);
76990        }
76991
76992        let url = params.parse_with_url(&url);
76993
76994        loop {
76995            let token = match self
76996                .hub
76997                .auth
76998                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
76999                .await
77000            {
77001                Ok(token) => token,
77002                Err(e) => match dlg.token(e) {
77003                    Ok(token) => token,
77004                    Err(e) => {
77005                        dlg.finished(false);
77006                        return Err(common::Error::MissingToken(e));
77007                    }
77008                },
77009            };
77010            let mut req_result = {
77011                let client = &self.hub.client;
77012                dlg.pre_request();
77013                let mut req_builder = hyper::Request::builder()
77014                    .method(hyper::Method::GET)
77015                    .uri(url.as_str())
77016                    .header(USER_AGENT, self.hub._user_agent.clone());
77017
77018                if let Some(token) = token.as_ref() {
77019                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
77020                }
77021
77022                let request = req_builder
77023                    .header(CONTENT_LENGTH, 0_u64)
77024                    .body(common::to_body::<String>(None));
77025
77026                client.request(request.unwrap()).await
77027            };
77028
77029            match req_result {
77030                Err(err) => {
77031                    if let common::Retry::After(d) = dlg.http_error(&err) {
77032                        sleep(d).await;
77033                        continue;
77034                    }
77035                    dlg.finished(false);
77036                    return Err(common::Error::HttpError(err));
77037                }
77038                Ok(res) => {
77039                    let (mut parts, body) = res.into_parts();
77040                    let mut body = common::Body::new(body);
77041                    if !parts.status.is_success() {
77042                        let bytes = common::to_bytes(body).await.unwrap_or_default();
77043                        let error = serde_json::from_str(&common::to_string(&bytes));
77044                        let response = common::to_response(parts, bytes.into());
77045
77046                        if let common::Retry::After(d) =
77047                            dlg.http_failure(&response, error.as_ref().ok())
77048                        {
77049                            sleep(d).await;
77050                            continue;
77051                        }
77052
77053                        dlg.finished(false);
77054
77055                        return Err(match error {
77056                            Ok(value) => common::Error::BadRequest(value),
77057                            _ => common::Error::Failure(response),
77058                        });
77059                    }
77060                    let response = {
77061                        let bytes = common::to_bytes(body).await.unwrap_or_default();
77062                        let encoded = common::to_string(&bytes);
77063                        match serde_json::from_str(&encoded) {
77064                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
77065                            Err(error) => {
77066                                dlg.response_json_decode_error(&encoded, &error);
77067                                return Err(common::Error::JsonDecodeError(
77068                                    encoded.to_string(),
77069                                    error,
77070                                ));
77071                            }
77072                        }
77073                    };
77074
77075                    dlg.finished(true);
77076                    return Ok(response);
77077                }
77078            }
77079        }
77080    }
77081
77082    /// User profile ID associated with this request.
77083    ///
77084    /// Sets the *profile id* path property to the given value.
77085    ///
77086    /// Even though the property as already been set when instantiating this call,
77087    /// we provide this method for API completeness.
77088    pub fn profile_id(mut self, new_value: i64) -> TargetingTemplateGetCall<'a, C> {
77089        self._profile_id = new_value;
77090        self
77091    }
77092    /// Targeting template ID.
77093    ///
77094    /// Sets the *id* path property to the given value.
77095    ///
77096    /// Even though the property as already been set when instantiating this call,
77097    /// we provide this method for API completeness.
77098    pub fn id(mut self, new_value: i64) -> TargetingTemplateGetCall<'a, C> {
77099        self._id = new_value;
77100        self
77101    }
77102    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
77103    /// while executing the actual API request.
77104    ///
77105    /// ````text
77106    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
77107    /// ````
77108    ///
77109    /// Sets the *delegate* property to the given value.
77110    pub fn delegate(
77111        mut self,
77112        new_value: &'a mut dyn common::Delegate,
77113    ) -> TargetingTemplateGetCall<'a, C> {
77114        self._delegate = Some(new_value);
77115        self
77116    }
77117
77118    /// Set any additional parameter of the query string used in the request.
77119    /// It should be used to set parameters which are not yet available through their own
77120    /// setters.
77121    ///
77122    /// Please note that this method must not be used to set any of the known parameters
77123    /// which have their own setter method. If done anyway, the request will fail.
77124    ///
77125    /// # Additional Parameters
77126    ///
77127    /// * *$.xgafv* (query-string) - V1 error format.
77128    /// * *access_token* (query-string) - OAuth access token.
77129    /// * *alt* (query-string) - Data format for response.
77130    /// * *callback* (query-string) - JSONP
77131    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
77132    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
77133    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
77134    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
77135    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
77136    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
77137    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
77138    pub fn param<T>(mut self, name: T, value: T) -> TargetingTemplateGetCall<'a, C>
77139    where
77140        T: AsRef<str>,
77141    {
77142        self._additional_params
77143            .insert(name.as_ref().to_string(), value.as_ref().to_string());
77144        self
77145    }
77146
77147    /// Identifies the authorization scope for the method you are building.
77148    ///
77149    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
77150    /// [`Scope::Dfatrafficking`].
77151    ///
77152    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
77153    /// tokens for more than one scope.
77154    ///
77155    /// Usually there is more than one suitable scope to authorize an operation, some of which may
77156    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
77157    /// sufficient, a read-write scope will do as well.
77158    pub fn add_scope<St>(mut self, scope: St) -> TargetingTemplateGetCall<'a, C>
77159    where
77160        St: AsRef<str>,
77161    {
77162        self._scopes.insert(String::from(scope.as_ref()));
77163        self
77164    }
77165    /// Identifies the authorization scope(s) for the method you are building.
77166    ///
77167    /// See [`Self::add_scope()`] for details.
77168    pub fn add_scopes<I, St>(mut self, scopes: I) -> TargetingTemplateGetCall<'a, C>
77169    where
77170        I: IntoIterator<Item = St>,
77171        St: AsRef<str>,
77172    {
77173        self._scopes
77174            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
77175        self
77176    }
77177
77178    /// Removes all scopes, and no default scope will be used either.
77179    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
77180    /// for details).
77181    pub fn clear_scopes(mut self) -> TargetingTemplateGetCall<'a, C> {
77182        self._scopes.clear();
77183        self
77184    }
77185}
77186
77187/// Inserts a new targeting template.
77188///
77189/// A builder for the *insert* method supported by a *targetingTemplate* resource.
77190/// It is not used directly, but through a [`TargetingTemplateMethods`] instance.
77191///
77192/// # Example
77193///
77194/// Instantiate a resource method builder
77195///
77196/// ```test_harness,no_run
77197/// # extern crate hyper;
77198/// # extern crate hyper_rustls;
77199/// # extern crate google_dfareporting3d3 as dfareporting3d3;
77200/// use dfareporting3d3::api::TargetingTemplate;
77201/// # async fn dox() {
77202/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
77203///
77204/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
77205/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
77206/// #     secret,
77207/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
77208/// # ).build().await.unwrap();
77209///
77210/// # let client = hyper_util::client::legacy::Client::builder(
77211/// #     hyper_util::rt::TokioExecutor::new()
77212/// # )
77213/// # .build(
77214/// #     hyper_rustls::HttpsConnectorBuilder::new()
77215/// #         .with_native_roots()
77216/// #         .unwrap()
77217/// #         .https_or_http()
77218/// #         .enable_http1()
77219/// #         .build()
77220/// # );
77221/// # let mut hub = Dfareporting::new(client, auth);
77222/// // As the method needs a request, you would usually fill it with the desired information
77223/// // into the respective structure. Some of the parts shown here might not be applicable !
77224/// // Values shown here are possibly random and not representative !
77225/// let mut req = TargetingTemplate::default();
77226///
77227/// // You can configure optional parameters by calling the respective setters at will, and
77228/// // execute the final call using `doit()`.
77229/// // Values shown here are possibly random and not representative !
77230/// let result = hub.targeting_templates().insert(req, -25)
77231///              .doit().await;
77232/// # }
77233/// ```
77234pub struct TargetingTemplateInsertCall<'a, C>
77235where
77236    C: 'a,
77237{
77238    hub: &'a Dfareporting<C>,
77239    _request: TargetingTemplate,
77240    _profile_id: i64,
77241    _delegate: Option<&'a mut dyn common::Delegate>,
77242    _additional_params: HashMap<String, String>,
77243    _scopes: BTreeSet<String>,
77244}
77245
77246impl<'a, C> common::CallBuilder for TargetingTemplateInsertCall<'a, C> {}
77247
77248impl<'a, C> TargetingTemplateInsertCall<'a, C>
77249where
77250    C: common::Connector,
77251{
77252    /// Perform the operation you have build so far.
77253    pub async fn doit(mut self) -> common::Result<(common::Response, TargetingTemplate)> {
77254        use std::borrow::Cow;
77255        use std::io::{Read, Seek};
77256
77257        use common::{url::Params, ToParts};
77258        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
77259
77260        let mut dd = common::DefaultDelegate;
77261        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
77262        dlg.begin(common::MethodInfo {
77263            id: "dfareporting.targetingTemplates.insert",
77264            http_method: hyper::Method::POST,
77265        });
77266
77267        for &field in ["alt", "profileId"].iter() {
77268            if self._additional_params.contains_key(field) {
77269                dlg.finished(false);
77270                return Err(common::Error::FieldClash(field));
77271            }
77272        }
77273
77274        let mut params = Params::with_capacity(4 + self._additional_params.len());
77275        params.push("profileId", self._profile_id.to_string());
77276
77277        params.extend(self._additional_params.iter());
77278
77279        params.push("alt", "json");
77280        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/targetingTemplates";
77281        if self._scopes.is_empty() {
77282            self._scopes
77283                .insert(Scope::Dfatrafficking.as_ref().to_string());
77284        }
77285
77286        #[allow(clippy::single_element_loop)]
77287        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
77288            url = params.uri_replacement(url, param_name, find_this, false);
77289        }
77290        {
77291            let to_remove = ["profileId"];
77292            params.remove_params(&to_remove);
77293        }
77294
77295        let url = params.parse_with_url(&url);
77296
77297        let mut json_mime_type = mime::APPLICATION_JSON;
77298        let mut request_value_reader = {
77299            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
77300            common::remove_json_null_values(&mut value);
77301            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
77302            serde_json::to_writer(&mut dst, &value).unwrap();
77303            dst
77304        };
77305        let request_size = request_value_reader
77306            .seek(std::io::SeekFrom::End(0))
77307            .unwrap();
77308        request_value_reader
77309            .seek(std::io::SeekFrom::Start(0))
77310            .unwrap();
77311
77312        loop {
77313            let token = match self
77314                .hub
77315                .auth
77316                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
77317                .await
77318            {
77319                Ok(token) => token,
77320                Err(e) => match dlg.token(e) {
77321                    Ok(token) => token,
77322                    Err(e) => {
77323                        dlg.finished(false);
77324                        return Err(common::Error::MissingToken(e));
77325                    }
77326                },
77327            };
77328            request_value_reader
77329                .seek(std::io::SeekFrom::Start(0))
77330                .unwrap();
77331            let mut req_result = {
77332                let client = &self.hub.client;
77333                dlg.pre_request();
77334                let mut req_builder = hyper::Request::builder()
77335                    .method(hyper::Method::POST)
77336                    .uri(url.as_str())
77337                    .header(USER_AGENT, self.hub._user_agent.clone());
77338
77339                if let Some(token) = token.as_ref() {
77340                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
77341                }
77342
77343                let request = req_builder
77344                    .header(CONTENT_TYPE, json_mime_type.to_string())
77345                    .header(CONTENT_LENGTH, request_size as u64)
77346                    .body(common::to_body(
77347                        request_value_reader.get_ref().clone().into(),
77348                    ));
77349
77350                client.request(request.unwrap()).await
77351            };
77352
77353            match req_result {
77354                Err(err) => {
77355                    if let common::Retry::After(d) = dlg.http_error(&err) {
77356                        sleep(d).await;
77357                        continue;
77358                    }
77359                    dlg.finished(false);
77360                    return Err(common::Error::HttpError(err));
77361                }
77362                Ok(res) => {
77363                    let (mut parts, body) = res.into_parts();
77364                    let mut body = common::Body::new(body);
77365                    if !parts.status.is_success() {
77366                        let bytes = common::to_bytes(body).await.unwrap_or_default();
77367                        let error = serde_json::from_str(&common::to_string(&bytes));
77368                        let response = common::to_response(parts, bytes.into());
77369
77370                        if let common::Retry::After(d) =
77371                            dlg.http_failure(&response, error.as_ref().ok())
77372                        {
77373                            sleep(d).await;
77374                            continue;
77375                        }
77376
77377                        dlg.finished(false);
77378
77379                        return Err(match error {
77380                            Ok(value) => common::Error::BadRequest(value),
77381                            _ => common::Error::Failure(response),
77382                        });
77383                    }
77384                    let response = {
77385                        let bytes = common::to_bytes(body).await.unwrap_or_default();
77386                        let encoded = common::to_string(&bytes);
77387                        match serde_json::from_str(&encoded) {
77388                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
77389                            Err(error) => {
77390                                dlg.response_json_decode_error(&encoded, &error);
77391                                return Err(common::Error::JsonDecodeError(
77392                                    encoded.to_string(),
77393                                    error,
77394                                ));
77395                            }
77396                        }
77397                    };
77398
77399                    dlg.finished(true);
77400                    return Ok(response);
77401                }
77402            }
77403        }
77404    }
77405
77406    ///
77407    /// Sets the *request* property to the given value.
77408    ///
77409    /// Even though the property as already been set when instantiating this call,
77410    /// we provide this method for API completeness.
77411    pub fn request(mut self, new_value: TargetingTemplate) -> TargetingTemplateInsertCall<'a, C> {
77412        self._request = new_value;
77413        self
77414    }
77415    /// User profile ID associated with this request.
77416    ///
77417    /// Sets the *profile id* path property to the given value.
77418    ///
77419    /// Even though the property as already been set when instantiating this call,
77420    /// we provide this method for API completeness.
77421    pub fn profile_id(mut self, new_value: i64) -> TargetingTemplateInsertCall<'a, C> {
77422        self._profile_id = new_value;
77423        self
77424    }
77425    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
77426    /// while executing the actual API request.
77427    ///
77428    /// ````text
77429    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
77430    /// ````
77431    ///
77432    /// Sets the *delegate* property to the given value.
77433    pub fn delegate(
77434        mut self,
77435        new_value: &'a mut dyn common::Delegate,
77436    ) -> TargetingTemplateInsertCall<'a, C> {
77437        self._delegate = Some(new_value);
77438        self
77439    }
77440
77441    /// Set any additional parameter of the query string used in the request.
77442    /// It should be used to set parameters which are not yet available through their own
77443    /// setters.
77444    ///
77445    /// Please note that this method must not be used to set any of the known parameters
77446    /// which have their own setter method. If done anyway, the request will fail.
77447    ///
77448    /// # Additional Parameters
77449    ///
77450    /// * *$.xgafv* (query-string) - V1 error format.
77451    /// * *access_token* (query-string) - OAuth access token.
77452    /// * *alt* (query-string) - Data format for response.
77453    /// * *callback* (query-string) - JSONP
77454    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
77455    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
77456    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
77457    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
77458    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
77459    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
77460    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
77461    pub fn param<T>(mut self, name: T, value: T) -> TargetingTemplateInsertCall<'a, C>
77462    where
77463        T: AsRef<str>,
77464    {
77465        self._additional_params
77466            .insert(name.as_ref().to_string(), value.as_ref().to_string());
77467        self
77468    }
77469
77470    /// Identifies the authorization scope for the method you are building.
77471    ///
77472    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
77473    /// [`Scope::Dfatrafficking`].
77474    ///
77475    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
77476    /// tokens for more than one scope.
77477    ///
77478    /// Usually there is more than one suitable scope to authorize an operation, some of which may
77479    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
77480    /// sufficient, a read-write scope will do as well.
77481    pub fn add_scope<St>(mut self, scope: St) -> TargetingTemplateInsertCall<'a, C>
77482    where
77483        St: AsRef<str>,
77484    {
77485        self._scopes.insert(String::from(scope.as_ref()));
77486        self
77487    }
77488    /// Identifies the authorization scope(s) for the method you are building.
77489    ///
77490    /// See [`Self::add_scope()`] for details.
77491    pub fn add_scopes<I, St>(mut self, scopes: I) -> TargetingTemplateInsertCall<'a, C>
77492    where
77493        I: IntoIterator<Item = St>,
77494        St: AsRef<str>,
77495    {
77496        self._scopes
77497            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
77498        self
77499    }
77500
77501    /// Removes all scopes, and no default scope will be used either.
77502    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
77503    /// for details).
77504    pub fn clear_scopes(mut self) -> TargetingTemplateInsertCall<'a, C> {
77505        self._scopes.clear();
77506        self
77507    }
77508}
77509
77510/// Retrieves a list of targeting templates, optionally filtered. This method supports paging.
77511///
77512/// A builder for the *list* method supported by a *targetingTemplate* resource.
77513/// It is not used directly, but through a [`TargetingTemplateMethods`] instance.
77514///
77515/// # Example
77516///
77517/// Instantiate a resource method builder
77518///
77519/// ```test_harness,no_run
77520/// # extern crate hyper;
77521/// # extern crate hyper_rustls;
77522/// # extern crate google_dfareporting3d3 as dfareporting3d3;
77523/// # async fn dox() {
77524/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
77525///
77526/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
77527/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
77528/// #     secret,
77529/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
77530/// # ).build().await.unwrap();
77531///
77532/// # let client = hyper_util::client::legacy::Client::builder(
77533/// #     hyper_util::rt::TokioExecutor::new()
77534/// # )
77535/// # .build(
77536/// #     hyper_rustls::HttpsConnectorBuilder::new()
77537/// #         .with_native_roots()
77538/// #         .unwrap()
77539/// #         .https_or_http()
77540/// #         .enable_http1()
77541/// #         .build()
77542/// # );
77543/// # let mut hub = Dfareporting::new(client, auth);
77544/// // You can configure optional parameters by calling the respective setters at will, and
77545/// // execute the final call using `doit()`.
77546/// // Values shown here are possibly random and not representative !
77547/// let result = hub.targeting_templates().list(-11)
77548///              .sort_order("kasd")
77549///              .sort_field("sanctus")
77550///              .search_string("gubergren")
77551///              .page_token("accusam")
77552///              .max_results(-51)
77553///              .add_ids(-4)
77554///              .advertiser_id(-58)
77555///              .doit().await;
77556/// # }
77557/// ```
77558pub struct TargetingTemplateListCall<'a, C>
77559where
77560    C: 'a,
77561{
77562    hub: &'a Dfareporting<C>,
77563    _profile_id: i64,
77564    _sort_order: Option<String>,
77565    _sort_field: Option<String>,
77566    _search_string: Option<String>,
77567    _page_token: Option<String>,
77568    _max_results: Option<i32>,
77569    _ids: Vec<i64>,
77570    _advertiser_id: Option<i64>,
77571    _delegate: Option<&'a mut dyn common::Delegate>,
77572    _additional_params: HashMap<String, String>,
77573    _scopes: BTreeSet<String>,
77574}
77575
77576impl<'a, C> common::CallBuilder for TargetingTemplateListCall<'a, C> {}
77577
77578impl<'a, C> TargetingTemplateListCall<'a, C>
77579where
77580    C: common::Connector,
77581{
77582    /// Perform the operation you have build so far.
77583    pub async fn doit(
77584        mut self,
77585    ) -> common::Result<(common::Response, TargetingTemplatesListResponse)> {
77586        use std::borrow::Cow;
77587        use std::io::{Read, Seek};
77588
77589        use common::{url::Params, ToParts};
77590        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
77591
77592        let mut dd = common::DefaultDelegate;
77593        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
77594        dlg.begin(common::MethodInfo {
77595            id: "dfareporting.targetingTemplates.list",
77596            http_method: hyper::Method::GET,
77597        });
77598
77599        for &field in [
77600            "alt",
77601            "profileId",
77602            "sortOrder",
77603            "sortField",
77604            "searchString",
77605            "pageToken",
77606            "maxResults",
77607            "ids",
77608            "advertiserId",
77609        ]
77610        .iter()
77611        {
77612            if self._additional_params.contains_key(field) {
77613                dlg.finished(false);
77614                return Err(common::Error::FieldClash(field));
77615            }
77616        }
77617
77618        let mut params = Params::with_capacity(10 + self._additional_params.len());
77619        params.push("profileId", self._profile_id.to_string());
77620        if let Some(value) = self._sort_order.as_ref() {
77621            params.push("sortOrder", value);
77622        }
77623        if let Some(value) = self._sort_field.as_ref() {
77624            params.push("sortField", value);
77625        }
77626        if let Some(value) = self._search_string.as_ref() {
77627            params.push("searchString", value);
77628        }
77629        if let Some(value) = self._page_token.as_ref() {
77630            params.push("pageToken", value);
77631        }
77632        if let Some(value) = self._max_results.as_ref() {
77633            params.push("maxResults", value.to_string());
77634        }
77635        if !self._ids.is_empty() {
77636            for f in self._ids.iter() {
77637                params.push("ids", f.to_string());
77638            }
77639        }
77640        if let Some(value) = self._advertiser_id.as_ref() {
77641            params.push("advertiserId", value.to_string());
77642        }
77643
77644        params.extend(self._additional_params.iter());
77645
77646        params.push("alt", "json");
77647        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/targetingTemplates";
77648        if self._scopes.is_empty() {
77649            self._scopes
77650                .insert(Scope::Dfatrafficking.as_ref().to_string());
77651        }
77652
77653        #[allow(clippy::single_element_loop)]
77654        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
77655            url = params.uri_replacement(url, param_name, find_this, false);
77656        }
77657        {
77658            let to_remove = ["profileId"];
77659            params.remove_params(&to_remove);
77660        }
77661
77662        let url = params.parse_with_url(&url);
77663
77664        loop {
77665            let token = match self
77666                .hub
77667                .auth
77668                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
77669                .await
77670            {
77671                Ok(token) => token,
77672                Err(e) => match dlg.token(e) {
77673                    Ok(token) => token,
77674                    Err(e) => {
77675                        dlg.finished(false);
77676                        return Err(common::Error::MissingToken(e));
77677                    }
77678                },
77679            };
77680            let mut req_result = {
77681                let client = &self.hub.client;
77682                dlg.pre_request();
77683                let mut req_builder = hyper::Request::builder()
77684                    .method(hyper::Method::GET)
77685                    .uri(url.as_str())
77686                    .header(USER_AGENT, self.hub._user_agent.clone());
77687
77688                if let Some(token) = token.as_ref() {
77689                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
77690                }
77691
77692                let request = req_builder
77693                    .header(CONTENT_LENGTH, 0_u64)
77694                    .body(common::to_body::<String>(None));
77695
77696                client.request(request.unwrap()).await
77697            };
77698
77699            match req_result {
77700                Err(err) => {
77701                    if let common::Retry::After(d) = dlg.http_error(&err) {
77702                        sleep(d).await;
77703                        continue;
77704                    }
77705                    dlg.finished(false);
77706                    return Err(common::Error::HttpError(err));
77707                }
77708                Ok(res) => {
77709                    let (mut parts, body) = res.into_parts();
77710                    let mut body = common::Body::new(body);
77711                    if !parts.status.is_success() {
77712                        let bytes = common::to_bytes(body).await.unwrap_or_default();
77713                        let error = serde_json::from_str(&common::to_string(&bytes));
77714                        let response = common::to_response(parts, bytes.into());
77715
77716                        if let common::Retry::After(d) =
77717                            dlg.http_failure(&response, error.as_ref().ok())
77718                        {
77719                            sleep(d).await;
77720                            continue;
77721                        }
77722
77723                        dlg.finished(false);
77724
77725                        return Err(match error {
77726                            Ok(value) => common::Error::BadRequest(value),
77727                            _ => common::Error::Failure(response),
77728                        });
77729                    }
77730                    let response = {
77731                        let bytes = common::to_bytes(body).await.unwrap_or_default();
77732                        let encoded = common::to_string(&bytes);
77733                        match serde_json::from_str(&encoded) {
77734                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
77735                            Err(error) => {
77736                                dlg.response_json_decode_error(&encoded, &error);
77737                                return Err(common::Error::JsonDecodeError(
77738                                    encoded.to_string(),
77739                                    error,
77740                                ));
77741                            }
77742                        }
77743                    };
77744
77745                    dlg.finished(true);
77746                    return Ok(response);
77747                }
77748            }
77749        }
77750    }
77751
77752    /// User profile ID associated with this request.
77753    ///
77754    /// Sets the *profile id* path property to the given value.
77755    ///
77756    /// Even though the property as already been set when instantiating this call,
77757    /// we provide this method for API completeness.
77758    pub fn profile_id(mut self, new_value: i64) -> TargetingTemplateListCall<'a, C> {
77759        self._profile_id = new_value;
77760        self
77761    }
77762    /// Order of sorted results.
77763    ///
77764    /// Sets the *sort order* query property to the given value.
77765    pub fn sort_order(mut self, new_value: &str) -> TargetingTemplateListCall<'a, C> {
77766        self._sort_order = Some(new_value.to_string());
77767        self
77768    }
77769    /// Field by which to sort the list.
77770    ///
77771    /// Sets the *sort field* query property to the given value.
77772    pub fn sort_field(mut self, new_value: &str) -> TargetingTemplateListCall<'a, C> {
77773        self._sort_field = Some(new_value.to_string());
77774        self
77775    }
77776    /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "template*2015" will return objects with names like "template June 2015", "template April 2015", or simply "template 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "template" will match objects with name "my template", "template 2015", or simply "template".
77777    ///
77778    /// Sets the *search string* query property to the given value.
77779    pub fn search_string(mut self, new_value: &str) -> TargetingTemplateListCall<'a, C> {
77780        self._search_string = Some(new_value.to_string());
77781        self
77782    }
77783    /// Value of the nextPageToken from the previous result page.
77784    ///
77785    /// Sets the *page token* query property to the given value.
77786    pub fn page_token(mut self, new_value: &str) -> TargetingTemplateListCall<'a, C> {
77787        self._page_token = Some(new_value.to_string());
77788        self
77789    }
77790    /// Maximum number of results to return.
77791    ///
77792    /// Sets the *max results* query property to the given value.
77793    pub fn max_results(mut self, new_value: i32) -> TargetingTemplateListCall<'a, C> {
77794        self._max_results = Some(new_value);
77795        self
77796    }
77797    /// Select only targeting templates with these IDs.
77798    ///
77799    /// Append the given value to the *ids* query property.
77800    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
77801    pub fn add_ids(mut self, new_value: i64) -> TargetingTemplateListCall<'a, C> {
77802        self._ids.push(new_value);
77803        self
77804    }
77805    /// Select only targeting templates with this advertiser ID.
77806    ///
77807    /// Sets the *advertiser id* query property to the given value.
77808    pub fn advertiser_id(mut self, new_value: i64) -> TargetingTemplateListCall<'a, C> {
77809        self._advertiser_id = Some(new_value);
77810        self
77811    }
77812    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
77813    /// while executing the actual API request.
77814    ///
77815    /// ````text
77816    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
77817    /// ````
77818    ///
77819    /// Sets the *delegate* property to the given value.
77820    pub fn delegate(
77821        mut self,
77822        new_value: &'a mut dyn common::Delegate,
77823    ) -> TargetingTemplateListCall<'a, C> {
77824        self._delegate = Some(new_value);
77825        self
77826    }
77827
77828    /// Set any additional parameter of the query string used in the request.
77829    /// It should be used to set parameters which are not yet available through their own
77830    /// setters.
77831    ///
77832    /// Please note that this method must not be used to set any of the known parameters
77833    /// which have their own setter method. If done anyway, the request will fail.
77834    ///
77835    /// # Additional Parameters
77836    ///
77837    /// * *$.xgafv* (query-string) - V1 error format.
77838    /// * *access_token* (query-string) - OAuth access token.
77839    /// * *alt* (query-string) - Data format for response.
77840    /// * *callback* (query-string) - JSONP
77841    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
77842    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
77843    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
77844    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
77845    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
77846    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
77847    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
77848    pub fn param<T>(mut self, name: T, value: T) -> TargetingTemplateListCall<'a, C>
77849    where
77850        T: AsRef<str>,
77851    {
77852        self._additional_params
77853            .insert(name.as_ref().to_string(), value.as_ref().to_string());
77854        self
77855    }
77856
77857    /// Identifies the authorization scope for the method you are building.
77858    ///
77859    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
77860    /// [`Scope::Dfatrafficking`].
77861    ///
77862    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
77863    /// tokens for more than one scope.
77864    ///
77865    /// Usually there is more than one suitable scope to authorize an operation, some of which may
77866    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
77867    /// sufficient, a read-write scope will do as well.
77868    pub fn add_scope<St>(mut self, scope: St) -> TargetingTemplateListCall<'a, C>
77869    where
77870        St: AsRef<str>,
77871    {
77872        self._scopes.insert(String::from(scope.as_ref()));
77873        self
77874    }
77875    /// Identifies the authorization scope(s) for the method you are building.
77876    ///
77877    /// See [`Self::add_scope()`] for details.
77878    pub fn add_scopes<I, St>(mut self, scopes: I) -> TargetingTemplateListCall<'a, C>
77879    where
77880        I: IntoIterator<Item = St>,
77881        St: AsRef<str>,
77882    {
77883        self._scopes
77884            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
77885        self
77886    }
77887
77888    /// Removes all scopes, and no default scope will be used either.
77889    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
77890    /// for details).
77891    pub fn clear_scopes(mut self) -> TargetingTemplateListCall<'a, C> {
77892        self._scopes.clear();
77893        self
77894    }
77895}
77896
77897/// Updates an existing targeting template. This method supports patch semantics.
77898///
77899/// A builder for the *patch* method supported by a *targetingTemplate* resource.
77900/// It is not used directly, but through a [`TargetingTemplateMethods`] instance.
77901///
77902/// # Example
77903///
77904/// Instantiate a resource method builder
77905///
77906/// ```test_harness,no_run
77907/// # extern crate hyper;
77908/// # extern crate hyper_rustls;
77909/// # extern crate google_dfareporting3d3 as dfareporting3d3;
77910/// use dfareporting3d3::api::TargetingTemplate;
77911/// # async fn dox() {
77912/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
77913///
77914/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
77915/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
77916/// #     secret,
77917/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
77918/// # ).build().await.unwrap();
77919///
77920/// # let client = hyper_util::client::legacy::Client::builder(
77921/// #     hyper_util::rt::TokioExecutor::new()
77922/// # )
77923/// # .build(
77924/// #     hyper_rustls::HttpsConnectorBuilder::new()
77925/// #         .with_native_roots()
77926/// #         .unwrap()
77927/// #         .https_or_http()
77928/// #         .enable_http1()
77929/// #         .build()
77930/// # );
77931/// # let mut hub = Dfareporting::new(client, auth);
77932/// // As the method needs a request, you would usually fill it with the desired information
77933/// // into the respective structure. Some of the parts shown here might not be applicable !
77934/// // Values shown here are possibly random and not representative !
77935/// let mut req = TargetingTemplate::default();
77936///
77937/// // You can configure optional parameters by calling the respective setters at will, and
77938/// // execute the final call using `doit()`.
77939/// // Values shown here are possibly random and not representative !
77940/// let result = hub.targeting_templates().patch(req, -10, -79)
77941///              .doit().await;
77942/// # }
77943/// ```
77944pub struct TargetingTemplatePatchCall<'a, C>
77945where
77946    C: 'a,
77947{
77948    hub: &'a Dfareporting<C>,
77949    _request: TargetingTemplate,
77950    _profile_id: i64,
77951    _id: i64,
77952    _delegate: Option<&'a mut dyn common::Delegate>,
77953    _additional_params: HashMap<String, String>,
77954    _scopes: BTreeSet<String>,
77955}
77956
77957impl<'a, C> common::CallBuilder for TargetingTemplatePatchCall<'a, C> {}
77958
77959impl<'a, C> TargetingTemplatePatchCall<'a, C>
77960where
77961    C: common::Connector,
77962{
77963    /// Perform the operation you have build so far.
77964    pub async fn doit(mut self) -> common::Result<(common::Response, TargetingTemplate)> {
77965        use std::borrow::Cow;
77966        use std::io::{Read, Seek};
77967
77968        use common::{url::Params, ToParts};
77969        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
77970
77971        let mut dd = common::DefaultDelegate;
77972        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
77973        dlg.begin(common::MethodInfo {
77974            id: "dfareporting.targetingTemplates.patch",
77975            http_method: hyper::Method::PATCH,
77976        });
77977
77978        for &field in ["alt", "profileId", "id"].iter() {
77979            if self._additional_params.contains_key(field) {
77980                dlg.finished(false);
77981                return Err(common::Error::FieldClash(field));
77982            }
77983        }
77984
77985        let mut params = Params::with_capacity(5 + self._additional_params.len());
77986        params.push("profileId", self._profile_id.to_string());
77987        params.push("id", self._id.to_string());
77988
77989        params.extend(self._additional_params.iter());
77990
77991        params.push("alt", "json");
77992        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/targetingTemplates";
77993        if self._scopes.is_empty() {
77994            self._scopes
77995                .insert(Scope::Dfatrafficking.as_ref().to_string());
77996        }
77997
77998        #[allow(clippy::single_element_loop)]
77999        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
78000            url = params.uri_replacement(url, param_name, find_this, false);
78001        }
78002        {
78003            let to_remove = ["profileId"];
78004            params.remove_params(&to_remove);
78005        }
78006
78007        let url = params.parse_with_url(&url);
78008
78009        let mut json_mime_type = mime::APPLICATION_JSON;
78010        let mut request_value_reader = {
78011            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
78012            common::remove_json_null_values(&mut value);
78013            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
78014            serde_json::to_writer(&mut dst, &value).unwrap();
78015            dst
78016        };
78017        let request_size = request_value_reader
78018            .seek(std::io::SeekFrom::End(0))
78019            .unwrap();
78020        request_value_reader
78021            .seek(std::io::SeekFrom::Start(0))
78022            .unwrap();
78023
78024        loop {
78025            let token = match self
78026                .hub
78027                .auth
78028                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
78029                .await
78030            {
78031                Ok(token) => token,
78032                Err(e) => match dlg.token(e) {
78033                    Ok(token) => token,
78034                    Err(e) => {
78035                        dlg.finished(false);
78036                        return Err(common::Error::MissingToken(e));
78037                    }
78038                },
78039            };
78040            request_value_reader
78041                .seek(std::io::SeekFrom::Start(0))
78042                .unwrap();
78043            let mut req_result = {
78044                let client = &self.hub.client;
78045                dlg.pre_request();
78046                let mut req_builder = hyper::Request::builder()
78047                    .method(hyper::Method::PATCH)
78048                    .uri(url.as_str())
78049                    .header(USER_AGENT, self.hub._user_agent.clone());
78050
78051                if let Some(token) = token.as_ref() {
78052                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
78053                }
78054
78055                let request = req_builder
78056                    .header(CONTENT_TYPE, json_mime_type.to_string())
78057                    .header(CONTENT_LENGTH, request_size as u64)
78058                    .body(common::to_body(
78059                        request_value_reader.get_ref().clone().into(),
78060                    ));
78061
78062                client.request(request.unwrap()).await
78063            };
78064
78065            match req_result {
78066                Err(err) => {
78067                    if let common::Retry::After(d) = dlg.http_error(&err) {
78068                        sleep(d).await;
78069                        continue;
78070                    }
78071                    dlg.finished(false);
78072                    return Err(common::Error::HttpError(err));
78073                }
78074                Ok(res) => {
78075                    let (mut parts, body) = res.into_parts();
78076                    let mut body = common::Body::new(body);
78077                    if !parts.status.is_success() {
78078                        let bytes = common::to_bytes(body).await.unwrap_or_default();
78079                        let error = serde_json::from_str(&common::to_string(&bytes));
78080                        let response = common::to_response(parts, bytes.into());
78081
78082                        if let common::Retry::After(d) =
78083                            dlg.http_failure(&response, error.as_ref().ok())
78084                        {
78085                            sleep(d).await;
78086                            continue;
78087                        }
78088
78089                        dlg.finished(false);
78090
78091                        return Err(match error {
78092                            Ok(value) => common::Error::BadRequest(value),
78093                            _ => common::Error::Failure(response),
78094                        });
78095                    }
78096                    let response = {
78097                        let bytes = common::to_bytes(body).await.unwrap_or_default();
78098                        let encoded = common::to_string(&bytes);
78099                        match serde_json::from_str(&encoded) {
78100                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
78101                            Err(error) => {
78102                                dlg.response_json_decode_error(&encoded, &error);
78103                                return Err(common::Error::JsonDecodeError(
78104                                    encoded.to_string(),
78105                                    error,
78106                                ));
78107                            }
78108                        }
78109                    };
78110
78111                    dlg.finished(true);
78112                    return Ok(response);
78113                }
78114            }
78115        }
78116    }
78117
78118    ///
78119    /// Sets the *request* property to the given value.
78120    ///
78121    /// Even though the property as already been set when instantiating this call,
78122    /// we provide this method for API completeness.
78123    pub fn request(mut self, new_value: TargetingTemplate) -> TargetingTemplatePatchCall<'a, C> {
78124        self._request = new_value;
78125        self
78126    }
78127    /// User profile ID associated with this request.
78128    ///
78129    /// Sets the *profile id* path property to the given value.
78130    ///
78131    /// Even though the property as already been set when instantiating this call,
78132    /// we provide this method for API completeness.
78133    pub fn profile_id(mut self, new_value: i64) -> TargetingTemplatePatchCall<'a, C> {
78134        self._profile_id = new_value;
78135        self
78136    }
78137    /// TargetingTemplate ID.
78138    ///
78139    /// Sets the *id* query property to the given value.
78140    ///
78141    /// Even though the property as already been set when instantiating this call,
78142    /// we provide this method for API completeness.
78143    pub fn id(mut self, new_value: i64) -> TargetingTemplatePatchCall<'a, C> {
78144        self._id = new_value;
78145        self
78146    }
78147    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
78148    /// while executing the actual API request.
78149    ///
78150    /// ````text
78151    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
78152    /// ````
78153    ///
78154    /// Sets the *delegate* property to the given value.
78155    pub fn delegate(
78156        mut self,
78157        new_value: &'a mut dyn common::Delegate,
78158    ) -> TargetingTemplatePatchCall<'a, C> {
78159        self._delegate = Some(new_value);
78160        self
78161    }
78162
78163    /// Set any additional parameter of the query string used in the request.
78164    /// It should be used to set parameters which are not yet available through their own
78165    /// setters.
78166    ///
78167    /// Please note that this method must not be used to set any of the known parameters
78168    /// which have their own setter method. If done anyway, the request will fail.
78169    ///
78170    /// # Additional Parameters
78171    ///
78172    /// * *$.xgafv* (query-string) - V1 error format.
78173    /// * *access_token* (query-string) - OAuth access token.
78174    /// * *alt* (query-string) - Data format for response.
78175    /// * *callback* (query-string) - JSONP
78176    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
78177    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
78178    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
78179    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
78180    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
78181    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
78182    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
78183    pub fn param<T>(mut self, name: T, value: T) -> TargetingTemplatePatchCall<'a, C>
78184    where
78185        T: AsRef<str>,
78186    {
78187        self._additional_params
78188            .insert(name.as_ref().to_string(), value.as_ref().to_string());
78189        self
78190    }
78191
78192    /// Identifies the authorization scope for the method you are building.
78193    ///
78194    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
78195    /// [`Scope::Dfatrafficking`].
78196    ///
78197    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
78198    /// tokens for more than one scope.
78199    ///
78200    /// Usually there is more than one suitable scope to authorize an operation, some of which may
78201    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
78202    /// sufficient, a read-write scope will do as well.
78203    pub fn add_scope<St>(mut self, scope: St) -> TargetingTemplatePatchCall<'a, C>
78204    where
78205        St: AsRef<str>,
78206    {
78207        self._scopes.insert(String::from(scope.as_ref()));
78208        self
78209    }
78210    /// Identifies the authorization scope(s) for the method you are building.
78211    ///
78212    /// See [`Self::add_scope()`] for details.
78213    pub fn add_scopes<I, St>(mut self, scopes: I) -> TargetingTemplatePatchCall<'a, C>
78214    where
78215        I: IntoIterator<Item = St>,
78216        St: AsRef<str>,
78217    {
78218        self._scopes
78219            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
78220        self
78221    }
78222
78223    /// Removes all scopes, and no default scope will be used either.
78224    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
78225    /// for details).
78226    pub fn clear_scopes(mut self) -> TargetingTemplatePatchCall<'a, C> {
78227        self._scopes.clear();
78228        self
78229    }
78230}
78231
78232/// Updates an existing targeting template.
78233///
78234/// A builder for the *update* method supported by a *targetingTemplate* resource.
78235/// It is not used directly, but through a [`TargetingTemplateMethods`] instance.
78236///
78237/// # Example
78238///
78239/// Instantiate a resource method builder
78240///
78241/// ```test_harness,no_run
78242/// # extern crate hyper;
78243/// # extern crate hyper_rustls;
78244/// # extern crate google_dfareporting3d3 as dfareporting3d3;
78245/// use dfareporting3d3::api::TargetingTemplate;
78246/// # async fn dox() {
78247/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
78248///
78249/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
78250/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
78251/// #     secret,
78252/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
78253/// # ).build().await.unwrap();
78254///
78255/// # let client = hyper_util::client::legacy::Client::builder(
78256/// #     hyper_util::rt::TokioExecutor::new()
78257/// # )
78258/// # .build(
78259/// #     hyper_rustls::HttpsConnectorBuilder::new()
78260/// #         .with_native_roots()
78261/// #         .unwrap()
78262/// #         .https_or_http()
78263/// #         .enable_http1()
78264/// #         .build()
78265/// # );
78266/// # let mut hub = Dfareporting::new(client, auth);
78267/// // As the method needs a request, you would usually fill it with the desired information
78268/// // into the respective structure. Some of the parts shown here might not be applicable !
78269/// // Values shown here are possibly random and not representative !
78270/// let mut req = TargetingTemplate::default();
78271///
78272/// // You can configure optional parameters by calling the respective setters at will, and
78273/// // execute the final call using `doit()`.
78274/// // Values shown here are possibly random and not representative !
78275/// let result = hub.targeting_templates().update(req, -97)
78276///              .doit().await;
78277/// # }
78278/// ```
78279pub struct TargetingTemplateUpdateCall<'a, C>
78280where
78281    C: 'a,
78282{
78283    hub: &'a Dfareporting<C>,
78284    _request: TargetingTemplate,
78285    _profile_id: i64,
78286    _delegate: Option<&'a mut dyn common::Delegate>,
78287    _additional_params: HashMap<String, String>,
78288    _scopes: BTreeSet<String>,
78289}
78290
78291impl<'a, C> common::CallBuilder for TargetingTemplateUpdateCall<'a, C> {}
78292
78293impl<'a, C> TargetingTemplateUpdateCall<'a, C>
78294where
78295    C: common::Connector,
78296{
78297    /// Perform the operation you have build so far.
78298    pub async fn doit(mut self) -> common::Result<(common::Response, TargetingTemplate)> {
78299        use std::borrow::Cow;
78300        use std::io::{Read, Seek};
78301
78302        use common::{url::Params, ToParts};
78303        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
78304
78305        let mut dd = common::DefaultDelegate;
78306        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
78307        dlg.begin(common::MethodInfo {
78308            id: "dfareporting.targetingTemplates.update",
78309            http_method: hyper::Method::PUT,
78310        });
78311
78312        for &field in ["alt", "profileId"].iter() {
78313            if self._additional_params.contains_key(field) {
78314                dlg.finished(false);
78315                return Err(common::Error::FieldClash(field));
78316            }
78317        }
78318
78319        let mut params = Params::with_capacity(4 + self._additional_params.len());
78320        params.push("profileId", self._profile_id.to_string());
78321
78322        params.extend(self._additional_params.iter());
78323
78324        params.push("alt", "json");
78325        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/targetingTemplates";
78326        if self._scopes.is_empty() {
78327            self._scopes
78328                .insert(Scope::Dfatrafficking.as_ref().to_string());
78329        }
78330
78331        #[allow(clippy::single_element_loop)]
78332        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
78333            url = params.uri_replacement(url, param_name, find_this, false);
78334        }
78335        {
78336            let to_remove = ["profileId"];
78337            params.remove_params(&to_remove);
78338        }
78339
78340        let url = params.parse_with_url(&url);
78341
78342        let mut json_mime_type = mime::APPLICATION_JSON;
78343        let mut request_value_reader = {
78344            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
78345            common::remove_json_null_values(&mut value);
78346            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
78347            serde_json::to_writer(&mut dst, &value).unwrap();
78348            dst
78349        };
78350        let request_size = request_value_reader
78351            .seek(std::io::SeekFrom::End(0))
78352            .unwrap();
78353        request_value_reader
78354            .seek(std::io::SeekFrom::Start(0))
78355            .unwrap();
78356
78357        loop {
78358            let token = match self
78359                .hub
78360                .auth
78361                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
78362                .await
78363            {
78364                Ok(token) => token,
78365                Err(e) => match dlg.token(e) {
78366                    Ok(token) => token,
78367                    Err(e) => {
78368                        dlg.finished(false);
78369                        return Err(common::Error::MissingToken(e));
78370                    }
78371                },
78372            };
78373            request_value_reader
78374                .seek(std::io::SeekFrom::Start(0))
78375                .unwrap();
78376            let mut req_result = {
78377                let client = &self.hub.client;
78378                dlg.pre_request();
78379                let mut req_builder = hyper::Request::builder()
78380                    .method(hyper::Method::PUT)
78381                    .uri(url.as_str())
78382                    .header(USER_AGENT, self.hub._user_agent.clone());
78383
78384                if let Some(token) = token.as_ref() {
78385                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
78386                }
78387
78388                let request = req_builder
78389                    .header(CONTENT_TYPE, json_mime_type.to_string())
78390                    .header(CONTENT_LENGTH, request_size as u64)
78391                    .body(common::to_body(
78392                        request_value_reader.get_ref().clone().into(),
78393                    ));
78394
78395                client.request(request.unwrap()).await
78396            };
78397
78398            match req_result {
78399                Err(err) => {
78400                    if let common::Retry::After(d) = dlg.http_error(&err) {
78401                        sleep(d).await;
78402                        continue;
78403                    }
78404                    dlg.finished(false);
78405                    return Err(common::Error::HttpError(err));
78406                }
78407                Ok(res) => {
78408                    let (mut parts, body) = res.into_parts();
78409                    let mut body = common::Body::new(body);
78410                    if !parts.status.is_success() {
78411                        let bytes = common::to_bytes(body).await.unwrap_or_default();
78412                        let error = serde_json::from_str(&common::to_string(&bytes));
78413                        let response = common::to_response(parts, bytes.into());
78414
78415                        if let common::Retry::After(d) =
78416                            dlg.http_failure(&response, error.as_ref().ok())
78417                        {
78418                            sleep(d).await;
78419                            continue;
78420                        }
78421
78422                        dlg.finished(false);
78423
78424                        return Err(match error {
78425                            Ok(value) => common::Error::BadRequest(value),
78426                            _ => common::Error::Failure(response),
78427                        });
78428                    }
78429                    let response = {
78430                        let bytes = common::to_bytes(body).await.unwrap_or_default();
78431                        let encoded = common::to_string(&bytes);
78432                        match serde_json::from_str(&encoded) {
78433                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
78434                            Err(error) => {
78435                                dlg.response_json_decode_error(&encoded, &error);
78436                                return Err(common::Error::JsonDecodeError(
78437                                    encoded.to_string(),
78438                                    error,
78439                                ));
78440                            }
78441                        }
78442                    };
78443
78444                    dlg.finished(true);
78445                    return Ok(response);
78446                }
78447            }
78448        }
78449    }
78450
78451    ///
78452    /// Sets the *request* property to the given value.
78453    ///
78454    /// Even though the property as already been set when instantiating this call,
78455    /// we provide this method for API completeness.
78456    pub fn request(mut self, new_value: TargetingTemplate) -> TargetingTemplateUpdateCall<'a, C> {
78457        self._request = new_value;
78458        self
78459    }
78460    /// User profile ID associated with this request.
78461    ///
78462    /// Sets the *profile id* path property to the given value.
78463    ///
78464    /// Even though the property as already been set when instantiating this call,
78465    /// we provide this method for API completeness.
78466    pub fn profile_id(mut self, new_value: i64) -> TargetingTemplateUpdateCall<'a, C> {
78467        self._profile_id = new_value;
78468        self
78469    }
78470    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
78471    /// while executing the actual API request.
78472    ///
78473    /// ````text
78474    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
78475    /// ````
78476    ///
78477    /// Sets the *delegate* property to the given value.
78478    pub fn delegate(
78479        mut self,
78480        new_value: &'a mut dyn common::Delegate,
78481    ) -> TargetingTemplateUpdateCall<'a, C> {
78482        self._delegate = Some(new_value);
78483        self
78484    }
78485
78486    /// Set any additional parameter of the query string used in the request.
78487    /// It should be used to set parameters which are not yet available through their own
78488    /// setters.
78489    ///
78490    /// Please note that this method must not be used to set any of the known parameters
78491    /// which have their own setter method. If done anyway, the request will fail.
78492    ///
78493    /// # Additional Parameters
78494    ///
78495    /// * *$.xgafv* (query-string) - V1 error format.
78496    /// * *access_token* (query-string) - OAuth access token.
78497    /// * *alt* (query-string) - Data format for response.
78498    /// * *callback* (query-string) - JSONP
78499    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
78500    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
78501    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
78502    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
78503    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
78504    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
78505    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
78506    pub fn param<T>(mut self, name: T, value: T) -> TargetingTemplateUpdateCall<'a, C>
78507    where
78508        T: AsRef<str>,
78509    {
78510        self._additional_params
78511            .insert(name.as_ref().to_string(), value.as_ref().to_string());
78512        self
78513    }
78514
78515    /// Identifies the authorization scope for the method you are building.
78516    ///
78517    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
78518    /// [`Scope::Dfatrafficking`].
78519    ///
78520    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
78521    /// tokens for more than one scope.
78522    ///
78523    /// Usually there is more than one suitable scope to authorize an operation, some of which may
78524    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
78525    /// sufficient, a read-write scope will do as well.
78526    pub fn add_scope<St>(mut self, scope: St) -> TargetingTemplateUpdateCall<'a, C>
78527    where
78528        St: AsRef<str>,
78529    {
78530        self._scopes.insert(String::from(scope.as_ref()));
78531        self
78532    }
78533    /// Identifies the authorization scope(s) for the method you are building.
78534    ///
78535    /// See [`Self::add_scope()`] for details.
78536    pub fn add_scopes<I, St>(mut self, scopes: I) -> TargetingTemplateUpdateCall<'a, C>
78537    where
78538        I: IntoIterator<Item = St>,
78539        St: AsRef<str>,
78540    {
78541        self._scopes
78542            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
78543        self
78544    }
78545
78546    /// Removes all scopes, and no default scope will be used either.
78547    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
78548    /// for details).
78549    pub fn clear_scopes(mut self) -> TargetingTemplateUpdateCall<'a, C> {
78550        self._scopes.clear();
78551        self
78552    }
78553}
78554
78555/// Gets one user profile by ID.
78556///
78557/// A builder for the *get* method supported by a *userProfile* resource.
78558/// It is not used directly, but through a [`UserProfileMethods`] instance.
78559///
78560/// # Example
78561///
78562/// Instantiate a resource method builder
78563///
78564/// ```test_harness,no_run
78565/// # extern crate hyper;
78566/// # extern crate hyper_rustls;
78567/// # extern crate google_dfareporting3d3 as dfareporting3d3;
78568/// # async fn dox() {
78569/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
78570///
78571/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
78572/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
78573/// #     secret,
78574/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
78575/// # ).build().await.unwrap();
78576///
78577/// # let client = hyper_util::client::legacy::Client::builder(
78578/// #     hyper_util::rt::TokioExecutor::new()
78579/// # )
78580/// # .build(
78581/// #     hyper_rustls::HttpsConnectorBuilder::new()
78582/// #         .with_native_roots()
78583/// #         .unwrap()
78584/// #         .https_or_http()
78585/// #         .enable_http1()
78586/// #         .build()
78587/// # );
78588/// # let mut hub = Dfareporting::new(client, auth);
78589/// // You can configure optional parameters by calling the respective setters at will, and
78590/// // execute the final call using `doit()`.
78591/// // Values shown here are possibly random and not representative !
78592/// let result = hub.user_profiles().get(-33)
78593///              .doit().await;
78594/// # }
78595/// ```
78596pub struct UserProfileGetCall<'a, C>
78597where
78598    C: 'a,
78599{
78600    hub: &'a Dfareporting<C>,
78601    _profile_id: i64,
78602    _delegate: Option<&'a mut dyn common::Delegate>,
78603    _additional_params: HashMap<String, String>,
78604    _scopes: BTreeSet<String>,
78605}
78606
78607impl<'a, C> common::CallBuilder for UserProfileGetCall<'a, C> {}
78608
78609impl<'a, C> UserProfileGetCall<'a, C>
78610where
78611    C: common::Connector,
78612{
78613    /// Perform the operation you have build so far.
78614    pub async fn doit(mut self) -> common::Result<(common::Response, UserProfile)> {
78615        use std::borrow::Cow;
78616        use std::io::{Read, Seek};
78617
78618        use common::{url::Params, ToParts};
78619        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
78620
78621        let mut dd = common::DefaultDelegate;
78622        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
78623        dlg.begin(common::MethodInfo {
78624            id: "dfareporting.userProfiles.get",
78625            http_method: hyper::Method::GET,
78626        });
78627
78628        for &field in ["alt", "profileId"].iter() {
78629            if self._additional_params.contains_key(field) {
78630                dlg.finished(false);
78631                return Err(common::Error::FieldClash(field));
78632            }
78633        }
78634
78635        let mut params = Params::with_capacity(3 + self._additional_params.len());
78636        params.push("profileId", self._profile_id.to_string());
78637
78638        params.extend(self._additional_params.iter());
78639
78640        params.push("alt", "json");
78641        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}";
78642        if self._scopes.is_empty() {
78643            self._scopes
78644                .insert(Scope::Ddmconversion.as_ref().to_string());
78645        }
78646
78647        #[allow(clippy::single_element_loop)]
78648        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
78649            url = params.uri_replacement(url, param_name, find_this, false);
78650        }
78651        {
78652            let to_remove = ["profileId"];
78653            params.remove_params(&to_remove);
78654        }
78655
78656        let url = params.parse_with_url(&url);
78657
78658        loop {
78659            let token = match self
78660                .hub
78661                .auth
78662                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
78663                .await
78664            {
78665                Ok(token) => token,
78666                Err(e) => match dlg.token(e) {
78667                    Ok(token) => token,
78668                    Err(e) => {
78669                        dlg.finished(false);
78670                        return Err(common::Error::MissingToken(e));
78671                    }
78672                },
78673            };
78674            let mut req_result = {
78675                let client = &self.hub.client;
78676                dlg.pre_request();
78677                let mut req_builder = hyper::Request::builder()
78678                    .method(hyper::Method::GET)
78679                    .uri(url.as_str())
78680                    .header(USER_AGENT, self.hub._user_agent.clone());
78681
78682                if let Some(token) = token.as_ref() {
78683                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
78684                }
78685
78686                let request = req_builder
78687                    .header(CONTENT_LENGTH, 0_u64)
78688                    .body(common::to_body::<String>(None));
78689
78690                client.request(request.unwrap()).await
78691            };
78692
78693            match req_result {
78694                Err(err) => {
78695                    if let common::Retry::After(d) = dlg.http_error(&err) {
78696                        sleep(d).await;
78697                        continue;
78698                    }
78699                    dlg.finished(false);
78700                    return Err(common::Error::HttpError(err));
78701                }
78702                Ok(res) => {
78703                    let (mut parts, body) = res.into_parts();
78704                    let mut body = common::Body::new(body);
78705                    if !parts.status.is_success() {
78706                        let bytes = common::to_bytes(body).await.unwrap_or_default();
78707                        let error = serde_json::from_str(&common::to_string(&bytes));
78708                        let response = common::to_response(parts, bytes.into());
78709
78710                        if let common::Retry::After(d) =
78711                            dlg.http_failure(&response, error.as_ref().ok())
78712                        {
78713                            sleep(d).await;
78714                            continue;
78715                        }
78716
78717                        dlg.finished(false);
78718
78719                        return Err(match error {
78720                            Ok(value) => common::Error::BadRequest(value),
78721                            _ => common::Error::Failure(response),
78722                        });
78723                    }
78724                    let response = {
78725                        let bytes = common::to_bytes(body).await.unwrap_or_default();
78726                        let encoded = common::to_string(&bytes);
78727                        match serde_json::from_str(&encoded) {
78728                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
78729                            Err(error) => {
78730                                dlg.response_json_decode_error(&encoded, &error);
78731                                return Err(common::Error::JsonDecodeError(
78732                                    encoded.to_string(),
78733                                    error,
78734                                ));
78735                            }
78736                        }
78737                    };
78738
78739                    dlg.finished(true);
78740                    return Ok(response);
78741                }
78742            }
78743        }
78744    }
78745
78746    /// The user profile ID.
78747    ///
78748    /// Sets the *profile id* path property to the given value.
78749    ///
78750    /// Even though the property as already been set when instantiating this call,
78751    /// we provide this method for API completeness.
78752    pub fn profile_id(mut self, new_value: i64) -> UserProfileGetCall<'a, C> {
78753        self._profile_id = new_value;
78754        self
78755    }
78756    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
78757    /// while executing the actual API request.
78758    ///
78759    /// ````text
78760    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
78761    /// ````
78762    ///
78763    /// Sets the *delegate* property to the given value.
78764    pub fn delegate(
78765        mut self,
78766        new_value: &'a mut dyn common::Delegate,
78767    ) -> UserProfileGetCall<'a, C> {
78768        self._delegate = Some(new_value);
78769        self
78770    }
78771
78772    /// Set any additional parameter of the query string used in the request.
78773    /// It should be used to set parameters which are not yet available through their own
78774    /// setters.
78775    ///
78776    /// Please note that this method must not be used to set any of the known parameters
78777    /// which have their own setter method. If done anyway, the request will fail.
78778    ///
78779    /// # Additional Parameters
78780    ///
78781    /// * *$.xgafv* (query-string) - V1 error format.
78782    /// * *access_token* (query-string) - OAuth access token.
78783    /// * *alt* (query-string) - Data format for response.
78784    /// * *callback* (query-string) - JSONP
78785    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
78786    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
78787    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
78788    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
78789    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
78790    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
78791    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
78792    pub fn param<T>(mut self, name: T, value: T) -> UserProfileGetCall<'a, C>
78793    where
78794        T: AsRef<str>,
78795    {
78796        self._additional_params
78797            .insert(name.as_ref().to_string(), value.as_ref().to_string());
78798        self
78799    }
78800
78801    /// Identifies the authorization scope for the method you are building.
78802    ///
78803    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
78804    /// [`Scope::Ddmconversion`].
78805    ///
78806    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
78807    /// tokens for more than one scope.
78808    ///
78809    /// Usually there is more than one suitable scope to authorize an operation, some of which may
78810    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
78811    /// sufficient, a read-write scope will do as well.
78812    pub fn add_scope<St>(mut self, scope: St) -> UserProfileGetCall<'a, C>
78813    where
78814        St: AsRef<str>,
78815    {
78816        self._scopes.insert(String::from(scope.as_ref()));
78817        self
78818    }
78819    /// Identifies the authorization scope(s) for the method you are building.
78820    ///
78821    /// See [`Self::add_scope()`] for details.
78822    pub fn add_scopes<I, St>(mut self, scopes: I) -> UserProfileGetCall<'a, C>
78823    where
78824        I: IntoIterator<Item = St>,
78825        St: AsRef<str>,
78826    {
78827        self._scopes
78828            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
78829        self
78830    }
78831
78832    /// Removes all scopes, and no default scope will be used either.
78833    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
78834    /// for details).
78835    pub fn clear_scopes(mut self) -> UserProfileGetCall<'a, C> {
78836        self._scopes.clear();
78837        self
78838    }
78839}
78840
78841/// Retrieves list of user profiles for a user.
78842///
78843/// A builder for the *list* method supported by a *userProfile* resource.
78844/// It is not used directly, but through a [`UserProfileMethods`] instance.
78845///
78846/// # Example
78847///
78848/// Instantiate a resource method builder
78849///
78850/// ```test_harness,no_run
78851/// # extern crate hyper;
78852/// # extern crate hyper_rustls;
78853/// # extern crate google_dfareporting3d3 as dfareporting3d3;
78854/// # async fn dox() {
78855/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
78856///
78857/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
78858/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
78859/// #     secret,
78860/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
78861/// # ).build().await.unwrap();
78862///
78863/// # let client = hyper_util::client::legacy::Client::builder(
78864/// #     hyper_util::rt::TokioExecutor::new()
78865/// # )
78866/// # .build(
78867/// #     hyper_rustls::HttpsConnectorBuilder::new()
78868/// #         .with_native_roots()
78869/// #         .unwrap()
78870/// #         .https_or_http()
78871/// #         .enable_http1()
78872/// #         .build()
78873/// # );
78874/// # let mut hub = Dfareporting::new(client, auth);
78875/// // You can configure optional parameters by calling the respective setters at will, and
78876/// // execute the final call using `doit()`.
78877/// // Values shown here are possibly random and not representative !
78878/// let result = hub.user_profiles().list()
78879///              .doit().await;
78880/// # }
78881/// ```
78882pub struct UserProfileListCall<'a, C>
78883where
78884    C: 'a,
78885{
78886    hub: &'a Dfareporting<C>,
78887    _delegate: Option<&'a mut dyn common::Delegate>,
78888    _additional_params: HashMap<String, String>,
78889    _scopes: BTreeSet<String>,
78890}
78891
78892impl<'a, C> common::CallBuilder for UserProfileListCall<'a, C> {}
78893
78894impl<'a, C> UserProfileListCall<'a, C>
78895where
78896    C: common::Connector,
78897{
78898    /// Perform the operation you have build so far.
78899    pub async fn doit(mut self) -> common::Result<(common::Response, UserProfileList)> {
78900        use std::borrow::Cow;
78901        use std::io::{Read, Seek};
78902
78903        use common::{url::Params, ToParts};
78904        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
78905
78906        let mut dd = common::DefaultDelegate;
78907        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
78908        dlg.begin(common::MethodInfo {
78909            id: "dfareporting.userProfiles.list",
78910            http_method: hyper::Method::GET,
78911        });
78912
78913        for &field in ["alt"].iter() {
78914            if self._additional_params.contains_key(field) {
78915                dlg.finished(false);
78916                return Err(common::Error::FieldClash(field));
78917            }
78918        }
78919
78920        let mut params = Params::with_capacity(2 + self._additional_params.len());
78921
78922        params.extend(self._additional_params.iter());
78923
78924        params.push("alt", "json");
78925        let mut url = self.hub._base_url.clone() + "userprofiles";
78926        if self._scopes.is_empty() {
78927            self._scopes
78928                .insert(Scope::Ddmconversion.as_ref().to_string());
78929        }
78930
78931        let url = params.parse_with_url(&url);
78932
78933        loop {
78934            let token = match self
78935                .hub
78936                .auth
78937                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
78938                .await
78939            {
78940                Ok(token) => token,
78941                Err(e) => match dlg.token(e) {
78942                    Ok(token) => token,
78943                    Err(e) => {
78944                        dlg.finished(false);
78945                        return Err(common::Error::MissingToken(e));
78946                    }
78947                },
78948            };
78949            let mut req_result = {
78950                let client = &self.hub.client;
78951                dlg.pre_request();
78952                let mut req_builder = hyper::Request::builder()
78953                    .method(hyper::Method::GET)
78954                    .uri(url.as_str())
78955                    .header(USER_AGENT, self.hub._user_agent.clone());
78956
78957                if let Some(token) = token.as_ref() {
78958                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
78959                }
78960
78961                let request = req_builder
78962                    .header(CONTENT_LENGTH, 0_u64)
78963                    .body(common::to_body::<String>(None));
78964
78965                client.request(request.unwrap()).await
78966            };
78967
78968            match req_result {
78969                Err(err) => {
78970                    if let common::Retry::After(d) = dlg.http_error(&err) {
78971                        sleep(d).await;
78972                        continue;
78973                    }
78974                    dlg.finished(false);
78975                    return Err(common::Error::HttpError(err));
78976                }
78977                Ok(res) => {
78978                    let (mut parts, body) = res.into_parts();
78979                    let mut body = common::Body::new(body);
78980                    if !parts.status.is_success() {
78981                        let bytes = common::to_bytes(body).await.unwrap_or_default();
78982                        let error = serde_json::from_str(&common::to_string(&bytes));
78983                        let response = common::to_response(parts, bytes.into());
78984
78985                        if let common::Retry::After(d) =
78986                            dlg.http_failure(&response, error.as_ref().ok())
78987                        {
78988                            sleep(d).await;
78989                            continue;
78990                        }
78991
78992                        dlg.finished(false);
78993
78994                        return Err(match error {
78995                            Ok(value) => common::Error::BadRequest(value),
78996                            _ => common::Error::Failure(response),
78997                        });
78998                    }
78999                    let response = {
79000                        let bytes = common::to_bytes(body).await.unwrap_or_default();
79001                        let encoded = common::to_string(&bytes);
79002                        match serde_json::from_str(&encoded) {
79003                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
79004                            Err(error) => {
79005                                dlg.response_json_decode_error(&encoded, &error);
79006                                return Err(common::Error::JsonDecodeError(
79007                                    encoded.to_string(),
79008                                    error,
79009                                ));
79010                            }
79011                        }
79012                    };
79013
79014                    dlg.finished(true);
79015                    return Ok(response);
79016                }
79017            }
79018        }
79019    }
79020
79021    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
79022    /// while executing the actual API request.
79023    ///
79024    /// ````text
79025    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
79026    /// ````
79027    ///
79028    /// Sets the *delegate* property to the given value.
79029    pub fn delegate(
79030        mut self,
79031        new_value: &'a mut dyn common::Delegate,
79032    ) -> UserProfileListCall<'a, C> {
79033        self._delegate = Some(new_value);
79034        self
79035    }
79036
79037    /// Set any additional parameter of the query string used in the request.
79038    /// It should be used to set parameters which are not yet available through their own
79039    /// setters.
79040    ///
79041    /// Please note that this method must not be used to set any of the known parameters
79042    /// which have their own setter method. If done anyway, the request will fail.
79043    ///
79044    /// # Additional Parameters
79045    ///
79046    /// * *$.xgafv* (query-string) - V1 error format.
79047    /// * *access_token* (query-string) - OAuth access token.
79048    /// * *alt* (query-string) - Data format for response.
79049    /// * *callback* (query-string) - JSONP
79050    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
79051    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
79052    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
79053    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
79054    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
79055    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
79056    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
79057    pub fn param<T>(mut self, name: T, value: T) -> UserProfileListCall<'a, C>
79058    where
79059        T: AsRef<str>,
79060    {
79061        self._additional_params
79062            .insert(name.as_ref().to_string(), value.as_ref().to_string());
79063        self
79064    }
79065
79066    /// Identifies the authorization scope for the method you are building.
79067    ///
79068    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
79069    /// [`Scope::Ddmconversion`].
79070    ///
79071    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
79072    /// tokens for more than one scope.
79073    ///
79074    /// Usually there is more than one suitable scope to authorize an operation, some of which may
79075    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
79076    /// sufficient, a read-write scope will do as well.
79077    pub fn add_scope<St>(mut self, scope: St) -> UserProfileListCall<'a, C>
79078    where
79079        St: AsRef<str>,
79080    {
79081        self._scopes.insert(String::from(scope.as_ref()));
79082        self
79083    }
79084    /// Identifies the authorization scope(s) for the method you are building.
79085    ///
79086    /// See [`Self::add_scope()`] for details.
79087    pub fn add_scopes<I, St>(mut self, scopes: I) -> UserProfileListCall<'a, C>
79088    where
79089        I: IntoIterator<Item = St>,
79090        St: AsRef<str>,
79091    {
79092        self._scopes
79093            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
79094        self
79095    }
79096
79097    /// Removes all scopes, and no default scope will be used either.
79098    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
79099    /// for details).
79100    pub fn clear_scopes(mut self) -> UserProfileListCall<'a, C> {
79101        self._scopes.clear();
79102        self
79103    }
79104}
79105
79106/// Gets one user role permission group by ID.
79107///
79108/// A builder for the *get* method supported by a *userRolePermissionGroup* resource.
79109/// It is not used directly, but through a [`UserRolePermissionGroupMethods`] instance.
79110///
79111/// # Example
79112///
79113/// Instantiate a resource method builder
79114///
79115/// ```test_harness,no_run
79116/// # extern crate hyper;
79117/// # extern crate hyper_rustls;
79118/// # extern crate google_dfareporting3d3 as dfareporting3d3;
79119/// # async fn dox() {
79120/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
79121///
79122/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
79123/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
79124/// #     secret,
79125/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
79126/// # ).build().await.unwrap();
79127///
79128/// # let client = hyper_util::client::legacy::Client::builder(
79129/// #     hyper_util::rt::TokioExecutor::new()
79130/// # )
79131/// # .build(
79132/// #     hyper_rustls::HttpsConnectorBuilder::new()
79133/// #         .with_native_roots()
79134/// #         .unwrap()
79135/// #         .https_or_http()
79136/// #         .enable_http1()
79137/// #         .build()
79138/// # );
79139/// # let mut hub = Dfareporting::new(client, auth);
79140/// // You can configure optional parameters by calling the respective setters at will, and
79141/// // execute the final call using `doit()`.
79142/// // Values shown here are possibly random and not representative !
79143/// let result = hub.user_role_permission_groups().get(-23, -51)
79144///              .doit().await;
79145/// # }
79146/// ```
79147pub struct UserRolePermissionGroupGetCall<'a, C>
79148where
79149    C: 'a,
79150{
79151    hub: &'a Dfareporting<C>,
79152    _profile_id: i64,
79153    _id: i64,
79154    _delegate: Option<&'a mut dyn common::Delegate>,
79155    _additional_params: HashMap<String, String>,
79156    _scopes: BTreeSet<String>,
79157}
79158
79159impl<'a, C> common::CallBuilder for UserRolePermissionGroupGetCall<'a, C> {}
79160
79161impl<'a, C> UserRolePermissionGroupGetCall<'a, C>
79162where
79163    C: common::Connector,
79164{
79165    /// Perform the operation you have build so far.
79166    pub async fn doit(mut self) -> common::Result<(common::Response, UserRolePermissionGroup)> {
79167        use std::borrow::Cow;
79168        use std::io::{Read, Seek};
79169
79170        use common::{url::Params, ToParts};
79171        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
79172
79173        let mut dd = common::DefaultDelegate;
79174        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
79175        dlg.begin(common::MethodInfo {
79176            id: "dfareporting.userRolePermissionGroups.get",
79177            http_method: hyper::Method::GET,
79178        });
79179
79180        for &field in ["alt", "profileId", "id"].iter() {
79181            if self._additional_params.contains_key(field) {
79182                dlg.finished(false);
79183                return Err(common::Error::FieldClash(field));
79184            }
79185        }
79186
79187        let mut params = Params::with_capacity(4 + self._additional_params.len());
79188        params.push("profileId", self._profile_id.to_string());
79189        params.push("id", self._id.to_string());
79190
79191        params.extend(self._additional_params.iter());
79192
79193        params.push("alt", "json");
79194        let mut url =
79195            self.hub._base_url.clone() + "userprofiles/{profileId}/userRolePermissionGroups/{id}";
79196        if self._scopes.is_empty() {
79197            self._scopes
79198                .insert(Scope::Dfatrafficking.as_ref().to_string());
79199        }
79200
79201        #[allow(clippy::single_element_loop)]
79202        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
79203            url = params.uri_replacement(url, param_name, find_this, false);
79204        }
79205        {
79206            let to_remove = ["id", "profileId"];
79207            params.remove_params(&to_remove);
79208        }
79209
79210        let url = params.parse_with_url(&url);
79211
79212        loop {
79213            let token = match self
79214                .hub
79215                .auth
79216                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
79217                .await
79218            {
79219                Ok(token) => token,
79220                Err(e) => match dlg.token(e) {
79221                    Ok(token) => token,
79222                    Err(e) => {
79223                        dlg.finished(false);
79224                        return Err(common::Error::MissingToken(e));
79225                    }
79226                },
79227            };
79228            let mut req_result = {
79229                let client = &self.hub.client;
79230                dlg.pre_request();
79231                let mut req_builder = hyper::Request::builder()
79232                    .method(hyper::Method::GET)
79233                    .uri(url.as_str())
79234                    .header(USER_AGENT, self.hub._user_agent.clone());
79235
79236                if let Some(token) = token.as_ref() {
79237                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
79238                }
79239
79240                let request = req_builder
79241                    .header(CONTENT_LENGTH, 0_u64)
79242                    .body(common::to_body::<String>(None));
79243
79244                client.request(request.unwrap()).await
79245            };
79246
79247            match req_result {
79248                Err(err) => {
79249                    if let common::Retry::After(d) = dlg.http_error(&err) {
79250                        sleep(d).await;
79251                        continue;
79252                    }
79253                    dlg.finished(false);
79254                    return Err(common::Error::HttpError(err));
79255                }
79256                Ok(res) => {
79257                    let (mut parts, body) = res.into_parts();
79258                    let mut body = common::Body::new(body);
79259                    if !parts.status.is_success() {
79260                        let bytes = common::to_bytes(body).await.unwrap_or_default();
79261                        let error = serde_json::from_str(&common::to_string(&bytes));
79262                        let response = common::to_response(parts, bytes.into());
79263
79264                        if let common::Retry::After(d) =
79265                            dlg.http_failure(&response, error.as_ref().ok())
79266                        {
79267                            sleep(d).await;
79268                            continue;
79269                        }
79270
79271                        dlg.finished(false);
79272
79273                        return Err(match error {
79274                            Ok(value) => common::Error::BadRequest(value),
79275                            _ => common::Error::Failure(response),
79276                        });
79277                    }
79278                    let response = {
79279                        let bytes = common::to_bytes(body).await.unwrap_or_default();
79280                        let encoded = common::to_string(&bytes);
79281                        match serde_json::from_str(&encoded) {
79282                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
79283                            Err(error) => {
79284                                dlg.response_json_decode_error(&encoded, &error);
79285                                return Err(common::Error::JsonDecodeError(
79286                                    encoded.to_string(),
79287                                    error,
79288                                ));
79289                            }
79290                        }
79291                    };
79292
79293                    dlg.finished(true);
79294                    return Ok(response);
79295                }
79296            }
79297        }
79298    }
79299
79300    /// User profile ID associated with this request.
79301    ///
79302    /// Sets the *profile id* path property to the given value.
79303    ///
79304    /// Even though the property as already been set when instantiating this call,
79305    /// we provide this method for API completeness.
79306    pub fn profile_id(mut self, new_value: i64) -> UserRolePermissionGroupGetCall<'a, C> {
79307        self._profile_id = new_value;
79308        self
79309    }
79310    /// User role permission group ID.
79311    ///
79312    /// Sets the *id* path property to the given value.
79313    ///
79314    /// Even though the property as already been set when instantiating this call,
79315    /// we provide this method for API completeness.
79316    pub fn id(mut self, new_value: i64) -> UserRolePermissionGroupGetCall<'a, C> {
79317        self._id = new_value;
79318        self
79319    }
79320    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
79321    /// while executing the actual API request.
79322    ///
79323    /// ````text
79324    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
79325    /// ````
79326    ///
79327    /// Sets the *delegate* property to the given value.
79328    pub fn delegate(
79329        mut self,
79330        new_value: &'a mut dyn common::Delegate,
79331    ) -> UserRolePermissionGroupGetCall<'a, C> {
79332        self._delegate = Some(new_value);
79333        self
79334    }
79335
79336    /// Set any additional parameter of the query string used in the request.
79337    /// It should be used to set parameters which are not yet available through their own
79338    /// setters.
79339    ///
79340    /// Please note that this method must not be used to set any of the known parameters
79341    /// which have their own setter method. If done anyway, the request will fail.
79342    ///
79343    /// # Additional Parameters
79344    ///
79345    /// * *$.xgafv* (query-string) - V1 error format.
79346    /// * *access_token* (query-string) - OAuth access token.
79347    /// * *alt* (query-string) - Data format for response.
79348    /// * *callback* (query-string) - JSONP
79349    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
79350    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
79351    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
79352    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
79353    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
79354    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
79355    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
79356    pub fn param<T>(mut self, name: T, value: T) -> UserRolePermissionGroupGetCall<'a, C>
79357    where
79358        T: AsRef<str>,
79359    {
79360        self._additional_params
79361            .insert(name.as_ref().to_string(), value.as_ref().to_string());
79362        self
79363    }
79364
79365    /// Identifies the authorization scope for the method you are building.
79366    ///
79367    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
79368    /// [`Scope::Dfatrafficking`].
79369    ///
79370    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
79371    /// tokens for more than one scope.
79372    ///
79373    /// Usually there is more than one suitable scope to authorize an operation, some of which may
79374    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
79375    /// sufficient, a read-write scope will do as well.
79376    pub fn add_scope<St>(mut self, scope: St) -> UserRolePermissionGroupGetCall<'a, C>
79377    where
79378        St: AsRef<str>,
79379    {
79380        self._scopes.insert(String::from(scope.as_ref()));
79381        self
79382    }
79383    /// Identifies the authorization scope(s) for the method you are building.
79384    ///
79385    /// See [`Self::add_scope()`] for details.
79386    pub fn add_scopes<I, St>(mut self, scopes: I) -> UserRolePermissionGroupGetCall<'a, C>
79387    where
79388        I: IntoIterator<Item = St>,
79389        St: AsRef<str>,
79390    {
79391        self._scopes
79392            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
79393        self
79394    }
79395
79396    /// Removes all scopes, and no default scope will be used either.
79397    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
79398    /// for details).
79399    pub fn clear_scopes(mut self) -> UserRolePermissionGroupGetCall<'a, C> {
79400        self._scopes.clear();
79401        self
79402    }
79403}
79404
79405/// Gets a list of all supported user role permission groups.
79406///
79407/// A builder for the *list* method supported by a *userRolePermissionGroup* resource.
79408/// It is not used directly, but through a [`UserRolePermissionGroupMethods`] instance.
79409///
79410/// # Example
79411///
79412/// Instantiate a resource method builder
79413///
79414/// ```test_harness,no_run
79415/// # extern crate hyper;
79416/// # extern crate hyper_rustls;
79417/// # extern crate google_dfareporting3d3 as dfareporting3d3;
79418/// # async fn dox() {
79419/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
79420///
79421/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
79422/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
79423/// #     secret,
79424/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
79425/// # ).build().await.unwrap();
79426///
79427/// # let client = hyper_util::client::legacy::Client::builder(
79428/// #     hyper_util::rt::TokioExecutor::new()
79429/// # )
79430/// # .build(
79431/// #     hyper_rustls::HttpsConnectorBuilder::new()
79432/// #         .with_native_roots()
79433/// #         .unwrap()
79434/// #         .https_or_http()
79435/// #         .enable_http1()
79436/// #         .build()
79437/// # );
79438/// # let mut hub = Dfareporting::new(client, auth);
79439/// // You can configure optional parameters by calling the respective setters at will, and
79440/// // execute the final call using `doit()`.
79441/// // Values shown here are possibly random and not representative !
79442/// let result = hub.user_role_permission_groups().list(-89)
79443///              .doit().await;
79444/// # }
79445/// ```
79446pub struct UserRolePermissionGroupListCall<'a, C>
79447where
79448    C: 'a,
79449{
79450    hub: &'a Dfareporting<C>,
79451    _profile_id: i64,
79452    _delegate: Option<&'a mut dyn common::Delegate>,
79453    _additional_params: HashMap<String, String>,
79454    _scopes: BTreeSet<String>,
79455}
79456
79457impl<'a, C> common::CallBuilder for UserRolePermissionGroupListCall<'a, C> {}
79458
79459impl<'a, C> UserRolePermissionGroupListCall<'a, C>
79460where
79461    C: common::Connector,
79462{
79463    /// Perform the operation you have build so far.
79464    pub async fn doit(
79465        mut self,
79466    ) -> common::Result<(common::Response, UserRolePermissionGroupsListResponse)> {
79467        use std::borrow::Cow;
79468        use std::io::{Read, Seek};
79469
79470        use common::{url::Params, ToParts};
79471        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
79472
79473        let mut dd = common::DefaultDelegate;
79474        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
79475        dlg.begin(common::MethodInfo {
79476            id: "dfareporting.userRolePermissionGroups.list",
79477            http_method: hyper::Method::GET,
79478        });
79479
79480        for &field in ["alt", "profileId"].iter() {
79481            if self._additional_params.contains_key(field) {
79482                dlg.finished(false);
79483                return Err(common::Error::FieldClash(field));
79484            }
79485        }
79486
79487        let mut params = Params::with_capacity(3 + self._additional_params.len());
79488        params.push("profileId", self._profile_id.to_string());
79489
79490        params.extend(self._additional_params.iter());
79491
79492        params.push("alt", "json");
79493        let mut url =
79494            self.hub._base_url.clone() + "userprofiles/{profileId}/userRolePermissionGroups";
79495        if self._scopes.is_empty() {
79496            self._scopes
79497                .insert(Scope::Dfatrafficking.as_ref().to_string());
79498        }
79499
79500        #[allow(clippy::single_element_loop)]
79501        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
79502            url = params.uri_replacement(url, param_name, find_this, false);
79503        }
79504        {
79505            let to_remove = ["profileId"];
79506            params.remove_params(&to_remove);
79507        }
79508
79509        let url = params.parse_with_url(&url);
79510
79511        loop {
79512            let token = match self
79513                .hub
79514                .auth
79515                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
79516                .await
79517            {
79518                Ok(token) => token,
79519                Err(e) => match dlg.token(e) {
79520                    Ok(token) => token,
79521                    Err(e) => {
79522                        dlg.finished(false);
79523                        return Err(common::Error::MissingToken(e));
79524                    }
79525                },
79526            };
79527            let mut req_result = {
79528                let client = &self.hub.client;
79529                dlg.pre_request();
79530                let mut req_builder = hyper::Request::builder()
79531                    .method(hyper::Method::GET)
79532                    .uri(url.as_str())
79533                    .header(USER_AGENT, self.hub._user_agent.clone());
79534
79535                if let Some(token) = token.as_ref() {
79536                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
79537                }
79538
79539                let request = req_builder
79540                    .header(CONTENT_LENGTH, 0_u64)
79541                    .body(common::to_body::<String>(None));
79542
79543                client.request(request.unwrap()).await
79544            };
79545
79546            match req_result {
79547                Err(err) => {
79548                    if let common::Retry::After(d) = dlg.http_error(&err) {
79549                        sleep(d).await;
79550                        continue;
79551                    }
79552                    dlg.finished(false);
79553                    return Err(common::Error::HttpError(err));
79554                }
79555                Ok(res) => {
79556                    let (mut parts, body) = res.into_parts();
79557                    let mut body = common::Body::new(body);
79558                    if !parts.status.is_success() {
79559                        let bytes = common::to_bytes(body).await.unwrap_or_default();
79560                        let error = serde_json::from_str(&common::to_string(&bytes));
79561                        let response = common::to_response(parts, bytes.into());
79562
79563                        if let common::Retry::After(d) =
79564                            dlg.http_failure(&response, error.as_ref().ok())
79565                        {
79566                            sleep(d).await;
79567                            continue;
79568                        }
79569
79570                        dlg.finished(false);
79571
79572                        return Err(match error {
79573                            Ok(value) => common::Error::BadRequest(value),
79574                            _ => common::Error::Failure(response),
79575                        });
79576                    }
79577                    let response = {
79578                        let bytes = common::to_bytes(body).await.unwrap_or_default();
79579                        let encoded = common::to_string(&bytes);
79580                        match serde_json::from_str(&encoded) {
79581                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
79582                            Err(error) => {
79583                                dlg.response_json_decode_error(&encoded, &error);
79584                                return Err(common::Error::JsonDecodeError(
79585                                    encoded.to_string(),
79586                                    error,
79587                                ));
79588                            }
79589                        }
79590                    };
79591
79592                    dlg.finished(true);
79593                    return Ok(response);
79594                }
79595            }
79596        }
79597    }
79598
79599    /// User profile ID associated with this request.
79600    ///
79601    /// Sets the *profile id* path property to the given value.
79602    ///
79603    /// Even though the property as already been set when instantiating this call,
79604    /// we provide this method for API completeness.
79605    pub fn profile_id(mut self, new_value: i64) -> UserRolePermissionGroupListCall<'a, C> {
79606        self._profile_id = new_value;
79607        self
79608    }
79609    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
79610    /// while executing the actual API request.
79611    ///
79612    /// ````text
79613    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
79614    /// ````
79615    ///
79616    /// Sets the *delegate* property to the given value.
79617    pub fn delegate(
79618        mut self,
79619        new_value: &'a mut dyn common::Delegate,
79620    ) -> UserRolePermissionGroupListCall<'a, C> {
79621        self._delegate = Some(new_value);
79622        self
79623    }
79624
79625    /// Set any additional parameter of the query string used in the request.
79626    /// It should be used to set parameters which are not yet available through their own
79627    /// setters.
79628    ///
79629    /// Please note that this method must not be used to set any of the known parameters
79630    /// which have their own setter method. If done anyway, the request will fail.
79631    ///
79632    /// # Additional Parameters
79633    ///
79634    /// * *$.xgafv* (query-string) - V1 error format.
79635    /// * *access_token* (query-string) - OAuth access token.
79636    /// * *alt* (query-string) - Data format for response.
79637    /// * *callback* (query-string) - JSONP
79638    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
79639    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
79640    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
79641    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
79642    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
79643    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
79644    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
79645    pub fn param<T>(mut self, name: T, value: T) -> UserRolePermissionGroupListCall<'a, C>
79646    where
79647        T: AsRef<str>,
79648    {
79649        self._additional_params
79650            .insert(name.as_ref().to_string(), value.as_ref().to_string());
79651        self
79652    }
79653
79654    /// Identifies the authorization scope for the method you are building.
79655    ///
79656    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
79657    /// [`Scope::Dfatrafficking`].
79658    ///
79659    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
79660    /// tokens for more than one scope.
79661    ///
79662    /// Usually there is more than one suitable scope to authorize an operation, some of which may
79663    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
79664    /// sufficient, a read-write scope will do as well.
79665    pub fn add_scope<St>(mut self, scope: St) -> UserRolePermissionGroupListCall<'a, C>
79666    where
79667        St: AsRef<str>,
79668    {
79669        self._scopes.insert(String::from(scope.as_ref()));
79670        self
79671    }
79672    /// Identifies the authorization scope(s) for the method you are building.
79673    ///
79674    /// See [`Self::add_scope()`] for details.
79675    pub fn add_scopes<I, St>(mut self, scopes: I) -> UserRolePermissionGroupListCall<'a, C>
79676    where
79677        I: IntoIterator<Item = St>,
79678        St: AsRef<str>,
79679    {
79680        self._scopes
79681            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
79682        self
79683    }
79684
79685    /// Removes all scopes, and no default scope will be used either.
79686    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
79687    /// for details).
79688    pub fn clear_scopes(mut self) -> UserRolePermissionGroupListCall<'a, C> {
79689        self._scopes.clear();
79690        self
79691    }
79692}
79693
79694/// Gets one user role permission by ID.
79695///
79696/// A builder for the *get* method supported by a *userRolePermission* resource.
79697/// It is not used directly, but through a [`UserRolePermissionMethods`] instance.
79698///
79699/// # Example
79700///
79701/// Instantiate a resource method builder
79702///
79703/// ```test_harness,no_run
79704/// # extern crate hyper;
79705/// # extern crate hyper_rustls;
79706/// # extern crate google_dfareporting3d3 as dfareporting3d3;
79707/// # async fn dox() {
79708/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
79709///
79710/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
79711/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
79712/// #     secret,
79713/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
79714/// # ).build().await.unwrap();
79715///
79716/// # let client = hyper_util::client::legacy::Client::builder(
79717/// #     hyper_util::rt::TokioExecutor::new()
79718/// # )
79719/// # .build(
79720/// #     hyper_rustls::HttpsConnectorBuilder::new()
79721/// #         .with_native_roots()
79722/// #         .unwrap()
79723/// #         .https_or_http()
79724/// #         .enable_http1()
79725/// #         .build()
79726/// # );
79727/// # let mut hub = Dfareporting::new(client, auth);
79728/// // You can configure optional parameters by calling the respective setters at will, and
79729/// // execute the final call using `doit()`.
79730/// // Values shown here are possibly random and not representative !
79731/// let result = hub.user_role_permissions().get(-46, -47)
79732///              .doit().await;
79733/// # }
79734/// ```
79735pub struct UserRolePermissionGetCall<'a, C>
79736where
79737    C: 'a,
79738{
79739    hub: &'a Dfareporting<C>,
79740    _profile_id: i64,
79741    _id: i64,
79742    _delegate: Option<&'a mut dyn common::Delegate>,
79743    _additional_params: HashMap<String, String>,
79744    _scopes: BTreeSet<String>,
79745}
79746
79747impl<'a, C> common::CallBuilder for UserRolePermissionGetCall<'a, C> {}
79748
79749impl<'a, C> UserRolePermissionGetCall<'a, C>
79750where
79751    C: common::Connector,
79752{
79753    /// Perform the operation you have build so far.
79754    pub async fn doit(mut self) -> common::Result<(common::Response, UserRolePermission)> {
79755        use std::borrow::Cow;
79756        use std::io::{Read, Seek};
79757
79758        use common::{url::Params, ToParts};
79759        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
79760
79761        let mut dd = common::DefaultDelegate;
79762        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
79763        dlg.begin(common::MethodInfo {
79764            id: "dfareporting.userRolePermissions.get",
79765            http_method: hyper::Method::GET,
79766        });
79767
79768        for &field in ["alt", "profileId", "id"].iter() {
79769            if self._additional_params.contains_key(field) {
79770                dlg.finished(false);
79771                return Err(common::Error::FieldClash(field));
79772            }
79773        }
79774
79775        let mut params = Params::with_capacity(4 + self._additional_params.len());
79776        params.push("profileId", self._profile_id.to_string());
79777        params.push("id", self._id.to_string());
79778
79779        params.extend(self._additional_params.iter());
79780
79781        params.push("alt", "json");
79782        let mut url =
79783            self.hub._base_url.clone() + "userprofiles/{profileId}/userRolePermissions/{id}";
79784        if self._scopes.is_empty() {
79785            self._scopes
79786                .insert(Scope::Dfatrafficking.as_ref().to_string());
79787        }
79788
79789        #[allow(clippy::single_element_loop)]
79790        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
79791            url = params.uri_replacement(url, param_name, find_this, false);
79792        }
79793        {
79794            let to_remove = ["id", "profileId"];
79795            params.remove_params(&to_remove);
79796        }
79797
79798        let url = params.parse_with_url(&url);
79799
79800        loop {
79801            let token = match self
79802                .hub
79803                .auth
79804                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
79805                .await
79806            {
79807                Ok(token) => token,
79808                Err(e) => match dlg.token(e) {
79809                    Ok(token) => token,
79810                    Err(e) => {
79811                        dlg.finished(false);
79812                        return Err(common::Error::MissingToken(e));
79813                    }
79814                },
79815            };
79816            let mut req_result = {
79817                let client = &self.hub.client;
79818                dlg.pre_request();
79819                let mut req_builder = hyper::Request::builder()
79820                    .method(hyper::Method::GET)
79821                    .uri(url.as_str())
79822                    .header(USER_AGENT, self.hub._user_agent.clone());
79823
79824                if let Some(token) = token.as_ref() {
79825                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
79826                }
79827
79828                let request = req_builder
79829                    .header(CONTENT_LENGTH, 0_u64)
79830                    .body(common::to_body::<String>(None));
79831
79832                client.request(request.unwrap()).await
79833            };
79834
79835            match req_result {
79836                Err(err) => {
79837                    if let common::Retry::After(d) = dlg.http_error(&err) {
79838                        sleep(d).await;
79839                        continue;
79840                    }
79841                    dlg.finished(false);
79842                    return Err(common::Error::HttpError(err));
79843                }
79844                Ok(res) => {
79845                    let (mut parts, body) = res.into_parts();
79846                    let mut body = common::Body::new(body);
79847                    if !parts.status.is_success() {
79848                        let bytes = common::to_bytes(body).await.unwrap_or_default();
79849                        let error = serde_json::from_str(&common::to_string(&bytes));
79850                        let response = common::to_response(parts, bytes.into());
79851
79852                        if let common::Retry::After(d) =
79853                            dlg.http_failure(&response, error.as_ref().ok())
79854                        {
79855                            sleep(d).await;
79856                            continue;
79857                        }
79858
79859                        dlg.finished(false);
79860
79861                        return Err(match error {
79862                            Ok(value) => common::Error::BadRequest(value),
79863                            _ => common::Error::Failure(response),
79864                        });
79865                    }
79866                    let response = {
79867                        let bytes = common::to_bytes(body).await.unwrap_or_default();
79868                        let encoded = common::to_string(&bytes);
79869                        match serde_json::from_str(&encoded) {
79870                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
79871                            Err(error) => {
79872                                dlg.response_json_decode_error(&encoded, &error);
79873                                return Err(common::Error::JsonDecodeError(
79874                                    encoded.to_string(),
79875                                    error,
79876                                ));
79877                            }
79878                        }
79879                    };
79880
79881                    dlg.finished(true);
79882                    return Ok(response);
79883                }
79884            }
79885        }
79886    }
79887
79888    /// User profile ID associated with this request.
79889    ///
79890    /// Sets the *profile id* path property to the given value.
79891    ///
79892    /// Even though the property as already been set when instantiating this call,
79893    /// we provide this method for API completeness.
79894    pub fn profile_id(mut self, new_value: i64) -> UserRolePermissionGetCall<'a, C> {
79895        self._profile_id = new_value;
79896        self
79897    }
79898    /// User role permission ID.
79899    ///
79900    /// Sets the *id* path property to the given value.
79901    ///
79902    /// Even though the property as already been set when instantiating this call,
79903    /// we provide this method for API completeness.
79904    pub fn id(mut self, new_value: i64) -> UserRolePermissionGetCall<'a, C> {
79905        self._id = new_value;
79906        self
79907    }
79908    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
79909    /// while executing the actual API request.
79910    ///
79911    /// ````text
79912    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
79913    /// ````
79914    ///
79915    /// Sets the *delegate* property to the given value.
79916    pub fn delegate(
79917        mut self,
79918        new_value: &'a mut dyn common::Delegate,
79919    ) -> UserRolePermissionGetCall<'a, C> {
79920        self._delegate = Some(new_value);
79921        self
79922    }
79923
79924    /// Set any additional parameter of the query string used in the request.
79925    /// It should be used to set parameters which are not yet available through their own
79926    /// setters.
79927    ///
79928    /// Please note that this method must not be used to set any of the known parameters
79929    /// which have their own setter method. If done anyway, the request will fail.
79930    ///
79931    /// # Additional Parameters
79932    ///
79933    /// * *$.xgafv* (query-string) - V1 error format.
79934    /// * *access_token* (query-string) - OAuth access token.
79935    /// * *alt* (query-string) - Data format for response.
79936    /// * *callback* (query-string) - JSONP
79937    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
79938    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
79939    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
79940    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
79941    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
79942    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
79943    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
79944    pub fn param<T>(mut self, name: T, value: T) -> UserRolePermissionGetCall<'a, C>
79945    where
79946        T: AsRef<str>,
79947    {
79948        self._additional_params
79949            .insert(name.as_ref().to_string(), value.as_ref().to_string());
79950        self
79951    }
79952
79953    /// Identifies the authorization scope for the method you are building.
79954    ///
79955    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
79956    /// [`Scope::Dfatrafficking`].
79957    ///
79958    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
79959    /// tokens for more than one scope.
79960    ///
79961    /// Usually there is more than one suitable scope to authorize an operation, some of which may
79962    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
79963    /// sufficient, a read-write scope will do as well.
79964    pub fn add_scope<St>(mut self, scope: St) -> UserRolePermissionGetCall<'a, C>
79965    where
79966        St: AsRef<str>,
79967    {
79968        self._scopes.insert(String::from(scope.as_ref()));
79969        self
79970    }
79971    /// Identifies the authorization scope(s) for the method you are building.
79972    ///
79973    /// See [`Self::add_scope()`] for details.
79974    pub fn add_scopes<I, St>(mut self, scopes: I) -> UserRolePermissionGetCall<'a, C>
79975    where
79976        I: IntoIterator<Item = St>,
79977        St: AsRef<str>,
79978    {
79979        self._scopes
79980            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
79981        self
79982    }
79983
79984    /// Removes all scopes, and no default scope will be used either.
79985    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
79986    /// for details).
79987    pub fn clear_scopes(mut self) -> UserRolePermissionGetCall<'a, C> {
79988        self._scopes.clear();
79989        self
79990    }
79991}
79992
79993/// Gets a list of user role permissions, possibly filtered.
79994///
79995/// A builder for the *list* method supported by a *userRolePermission* resource.
79996/// It is not used directly, but through a [`UserRolePermissionMethods`] instance.
79997///
79998/// # Example
79999///
80000/// Instantiate a resource method builder
80001///
80002/// ```test_harness,no_run
80003/// # extern crate hyper;
80004/// # extern crate hyper_rustls;
80005/// # extern crate google_dfareporting3d3 as dfareporting3d3;
80006/// # async fn dox() {
80007/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
80008///
80009/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
80010/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
80011/// #     secret,
80012/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
80013/// # ).build().await.unwrap();
80014///
80015/// # let client = hyper_util::client::legacy::Client::builder(
80016/// #     hyper_util::rt::TokioExecutor::new()
80017/// # )
80018/// # .build(
80019/// #     hyper_rustls::HttpsConnectorBuilder::new()
80020/// #         .with_native_roots()
80021/// #         .unwrap()
80022/// #         .https_or_http()
80023/// #         .enable_http1()
80024/// #         .build()
80025/// # );
80026/// # let mut hub = Dfareporting::new(client, auth);
80027/// // You can configure optional parameters by calling the respective setters at will, and
80028/// // execute the final call using `doit()`.
80029/// // Values shown here are possibly random and not representative !
80030/// let result = hub.user_role_permissions().list(-50)
80031///              .add_ids(-72)
80032///              .doit().await;
80033/// # }
80034/// ```
80035pub struct UserRolePermissionListCall<'a, C>
80036where
80037    C: 'a,
80038{
80039    hub: &'a Dfareporting<C>,
80040    _profile_id: i64,
80041    _ids: Vec<i64>,
80042    _delegate: Option<&'a mut dyn common::Delegate>,
80043    _additional_params: HashMap<String, String>,
80044    _scopes: BTreeSet<String>,
80045}
80046
80047impl<'a, C> common::CallBuilder for UserRolePermissionListCall<'a, C> {}
80048
80049impl<'a, C> UserRolePermissionListCall<'a, C>
80050where
80051    C: common::Connector,
80052{
80053    /// Perform the operation you have build so far.
80054    pub async fn doit(
80055        mut self,
80056    ) -> common::Result<(common::Response, UserRolePermissionsListResponse)> {
80057        use std::borrow::Cow;
80058        use std::io::{Read, Seek};
80059
80060        use common::{url::Params, ToParts};
80061        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
80062
80063        let mut dd = common::DefaultDelegate;
80064        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
80065        dlg.begin(common::MethodInfo {
80066            id: "dfareporting.userRolePermissions.list",
80067            http_method: hyper::Method::GET,
80068        });
80069
80070        for &field in ["alt", "profileId", "ids"].iter() {
80071            if self._additional_params.contains_key(field) {
80072                dlg.finished(false);
80073                return Err(common::Error::FieldClash(field));
80074            }
80075        }
80076
80077        let mut params = Params::with_capacity(4 + self._additional_params.len());
80078        params.push("profileId", self._profile_id.to_string());
80079        if !self._ids.is_empty() {
80080            for f in self._ids.iter() {
80081                params.push("ids", f.to_string());
80082            }
80083        }
80084
80085        params.extend(self._additional_params.iter());
80086
80087        params.push("alt", "json");
80088        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/userRolePermissions";
80089        if self._scopes.is_empty() {
80090            self._scopes
80091                .insert(Scope::Dfatrafficking.as_ref().to_string());
80092        }
80093
80094        #[allow(clippy::single_element_loop)]
80095        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
80096            url = params.uri_replacement(url, param_name, find_this, false);
80097        }
80098        {
80099            let to_remove = ["profileId"];
80100            params.remove_params(&to_remove);
80101        }
80102
80103        let url = params.parse_with_url(&url);
80104
80105        loop {
80106            let token = match self
80107                .hub
80108                .auth
80109                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
80110                .await
80111            {
80112                Ok(token) => token,
80113                Err(e) => match dlg.token(e) {
80114                    Ok(token) => token,
80115                    Err(e) => {
80116                        dlg.finished(false);
80117                        return Err(common::Error::MissingToken(e));
80118                    }
80119                },
80120            };
80121            let mut req_result = {
80122                let client = &self.hub.client;
80123                dlg.pre_request();
80124                let mut req_builder = hyper::Request::builder()
80125                    .method(hyper::Method::GET)
80126                    .uri(url.as_str())
80127                    .header(USER_AGENT, self.hub._user_agent.clone());
80128
80129                if let Some(token) = token.as_ref() {
80130                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
80131                }
80132
80133                let request = req_builder
80134                    .header(CONTENT_LENGTH, 0_u64)
80135                    .body(common::to_body::<String>(None));
80136
80137                client.request(request.unwrap()).await
80138            };
80139
80140            match req_result {
80141                Err(err) => {
80142                    if let common::Retry::After(d) = dlg.http_error(&err) {
80143                        sleep(d).await;
80144                        continue;
80145                    }
80146                    dlg.finished(false);
80147                    return Err(common::Error::HttpError(err));
80148                }
80149                Ok(res) => {
80150                    let (mut parts, body) = res.into_parts();
80151                    let mut body = common::Body::new(body);
80152                    if !parts.status.is_success() {
80153                        let bytes = common::to_bytes(body).await.unwrap_or_default();
80154                        let error = serde_json::from_str(&common::to_string(&bytes));
80155                        let response = common::to_response(parts, bytes.into());
80156
80157                        if let common::Retry::After(d) =
80158                            dlg.http_failure(&response, error.as_ref().ok())
80159                        {
80160                            sleep(d).await;
80161                            continue;
80162                        }
80163
80164                        dlg.finished(false);
80165
80166                        return Err(match error {
80167                            Ok(value) => common::Error::BadRequest(value),
80168                            _ => common::Error::Failure(response),
80169                        });
80170                    }
80171                    let response = {
80172                        let bytes = common::to_bytes(body).await.unwrap_or_default();
80173                        let encoded = common::to_string(&bytes);
80174                        match serde_json::from_str(&encoded) {
80175                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
80176                            Err(error) => {
80177                                dlg.response_json_decode_error(&encoded, &error);
80178                                return Err(common::Error::JsonDecodeError(
80179                                    encoded.to_string(),
80180                                    error,
80181                                ));
80182                            }
80183                        }
80184                    };
80185
80186                    dlg.finished(true);
80187                    return Ok(response);
80188                }
80189            }
80190        }
80191    }
80192
80193    /// User profile ID associated with this request.
80194    ///
80195    /// Sets the *profile id* path property to the given value.
80196    ///
80197    /// Even though the property as already been set when instantiating this call,
80198    /// we provide this method for API completeness.
80199    pub fn profile_id(mut self, new_value: i64) -> UserRolePermissionListCall<'a, C> {
80200        self._profile_id = new_value;
80201        self
80202    }
80203    /// Select only user role permissions with these IDs.
80204    ///
80205    /// Append the given value to the *ids* query property.
80206    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
80207    pub fn add_ids(mut self, new_value: i64) -> UserRolePermissionListCall<'a, C> {
80208        self._ids.push(new_value);
80209        self
80210    }
80211    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
80212    /// while executing the actual API request.
80213    ///
80214    /// ````text
80215    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
80216    /// ````
80217    ///
80218    /// Sets the *delegate* property to the given value.
80219    pub fn delegate(
80220        mut self,
80221        new_value: &'a mut dyn common::Delegate,
80222    ) -> UserRolePermissionListCall<'a, C> {
80223        self._delegate = Some(new_value);
80224        self
80225    }
80226
80227    /// Set any additional parameter of the query string used in the request.
80228    /// It should be used to set parameters which are not yet available through their own
80229    /// setters.
80230    ///
80231    /// Please note that this method must not be used to set any of the known parameters
80232    /// which have their own setter method. If done anyway, the request will fail.
80233    ///
80234    /// # Additional Parameters
80235    ///
80236    /// * *$.xgafv* (query-string) - V1 error format.
80237    /// * *access_token* (query-string) - OAuth access token.
80238    /// * *alt* (query-string) - Data format for response.
80239    /// * *callback* (query-string) - JSONP
80240    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
80241    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
80242    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
80243    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
80244    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
80245    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
80246    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
80247    pub fn param<T>(mut self, name: T, value: T) -> UserRolePermissionListCall<'a, C>
80248    where
80249        T: AsRef<str>,
80250    {
80251        self._additional_params
80252            .insert(name.as_ref().to_string(), value.as_ref().to_string());
80253        self
80254    }
80255
80256    /// Identifies the authorization scope for the method you are building.
80257    ///
80258    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
80259    /// [`Scope::Dfatrafficking`].
80260    ///
80261    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
80262    /// tokens for more than one scope.
80263    ///
80264    /// Usually there is more than one suitable scope to authorize an operation, some of which may
80265    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
80266    /// sufficient, a read-write scope will do as well.
80267    pub fn add_scope<St>(mut self, scope: St) -> UserRolePermissionListCall<'a, C>
80268    where
80269        St: AsRef<str>,
80270    {
80271        self._scopes.insert(String::from(scope.as_ref()));
80272        self
80273    }
80274    /// Identifies the authorization scope(s) for the method you are building.
80275    ///
80276    /// See [`Self::add_scope()`] for details.
80277    pub fn add_scopes<I, St>(mut self, scopes: I) -> UserRolePermissionListCall<'a, C>
80278    where
80279        I: IntoIterator<Item = St>,
80280        St: AsRef<str>,
80281    {
80282        self._scopes
80283            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
80284        self
80285    }
80286
80287    /// Removes all scopes, and no default scope will be used either.
80288    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
80289    /// for details).
80290    pub fn clear_scopes(mut self) -> UserRolePermissionListCall<'a, C> {
80291        self._scopes.clear();
80292        self
80293    }
80294}
80295
80296/// Deletes an existing user role.
80297///
80298/// A builder for the *delete* method supported by a *userRole* resource.
80299/// It is not used directly, but through a [`UserRoleMethods`] instance.
80300///
80301/// # Example
80302///
80303/// Instantiate a resource method builder
80304///
80305/// ```test_harness,no_run
80306/// # extern crate hyper;
80307/// # extern crate hyper_rustls;
80308/// # extern crate google_dfareporting3d3 as dfareporting3d3;
80309/// # async fn dox() {
80310/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
80311///
80312/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
80313/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
80314/// #     secret,
80315/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
80316/// # ).build().await.unwrap();
80317///
80318/// # let client = hyper_util::client::legacy::Client::builder(
80319/// #     hyper_util::rt::TokioExecutor::new()
80320/// # )
80321/// # .build(
80322/// #     hyper_rustls::HttpsConnectorBuilder::new()
80323/// #         .with_native_roots()
80324/// #         .unwrap()
80325/// #         .https_or_http()
80326/// #         .enable_http1()
80327/// #         .build()
80328/// # );
80329/// # let mut hub = Dfareporting::new(client, auth);
80330/// // You can configure optional parameters by calling the respective setters at will, and
80331/// // execute the final call using `doit()`.
80332/// // Values shown here are possibly random and not representative !
80333/// let result = hub.user_roles().delete(-44, -4)
80334///              .doit().await;
80335/// # }
80336/// ```
80337pub struct UserRoleDeleteCall<'a, C>
80338where
80339    C: 'a,
80340{
80341    hub: &'a Dfareporting<C>,
80342    _profile_id: i64,
80343    _id: i64,
80344    _delegate: Option<&'a mut dyn common::Delegate>,
80345    _additional_params: HashMap<String, String>,
80346    _scopes: BTreeSet<String>,
80347}
80348
80349impl<'a, C> common::CallBuilder for UserRoleDeleteCall<'a, C> {}
80350
80351impl<'a, C> UserRoleDeleteCall<'a, C>
80352where
80353    C: common::Connector,
80354{
80355    /// Perform the operation you have build so far.
80356    pub async fn doit(mut self) -> common::Result<common::Response> {
80357        use std::borrow::Cow;
80358        use std::io::{Read, Seek};
80359
80360        use common::{url::Params, ToParts};
80361        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
80362
80363        let mut dd = common::DefaultDelegate;
80364        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
80365        dlg.begin(common::MethodInfo {
80366            id: "dfareporting.userRoles.delete",
80367            http_method: hyper::Method::DELETE,
80368        });
80369
80370        for &field in ["profileId", "id"].iter() {
80371            if self._additional_params.contains_key(field) {
80372                dlg.finished(false);
80373                return Err(common::Error::FieldClash(field));
80374            }
80375        }
80376
80377        let mut params = Params::with_capacity(3 + self._additional_params.len());
80378        params.push("profileId", self._profile_id.to_string());
80379        params.push("id", self._id.to_string());
80380
80381        params.extend(self._additional_params.iter());
80382
80383        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/userRoles/{id}";
80384        if self._scopes.is_empty() {
80385            self._scopes
80386                .insert(Scope::Dfatrafficking.as_ref().to_string());
80387        }
80388
80389        #[allow(clippy::single_element_loop)]
80390        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
80391            url = params.uri_replacement(url, param_name, find_this, false);
80392        }
80393        {
80394            let to_remove = ["id", "profileId"];
80395            params.remove_params(&to_remove);
80396        }
80397
80398        let url = params.parse_with_url(&url);
80399
80400        loop {
80401            let token = match self
80402                .hub
80403                .auth
80404                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
80405                .await
80406            {
80407                Ok(token) => token,
80408                Err(e) => match dlg.token(e) {
80409                    Ok(token) => token,
80410                    Err(e) => {
80411                        dlg.finished(false);
80412                        return Err(common::Error::MissingToken(e));
80413                    }
80414                },
80415            };
80416            let mut req_result = {
80417                let client = &self.hub.client;
80418                dlg.pre_request();
80419                let mut req_builder = hyper::Request::builder()
80420                    .method(hyper::Method::DELETE)
80421                    .uri(url.as_str())
80422                    .header(USER_AGENT, self.hub._user_agent.clone());
80423
80424                if let Some(token) = token.as_ref() {
80425                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
80426                }
80427
80428                let request = req_builder
80429                    .header(CONTENT_LENGTH, 0_u64)
80430                    .body(common::to_body::<String>(None));
80431
80432                client.request(request.unwrap()).await
80433            };
80434
80435            match req_result {
80436                Err(err) => {
80437                    if let common::Retry::After(d) = dlg.http_error(&err) {
80438                        sleep(d).await;
80439                        continue;
80440                    }
80441                    dlg.finished(false);
80442                    return Err(common::Error::HttpError(err));
80443                }
80444                Ok(res) => {
80445                    let (mut parts, body) = res.into_parts();
80446                    let mut body = common::Body::new(body);
80447                    if !parts.status.is_success() {
80448                        let bytes = common::to_bytes(body).await.unwrap_or_default();
80449                        let error = serde_json::from_str(&common::to_string(&bytes));
80450                        let response = common::to_response(parts, bytes.into());
80451
80452                        if let common::Retry::After(d) =
80453                            dlg.http_failure(&response, error.as_ref().ok())
80454                        {
80455                            sleep(d).await;
80456                            continue;
80457                        }
80458
80459                        dlg.finished(false);
80460
80461                        return Err(match error {
80462                            Ok(value) => common::Error::BadRequest(value),
80463                            _ => common::Error::Failure(response),
80464                        });
80465                    }
80466                    let response = common::Response::from_parts(parts, body);
80467
80468                    dlg.finished(true);
80469                    return Ok(response);
80470                }
80471            }
80472        }
80473    }
80474
80475    /// User profile ID associated with this request.
80476    ///
80477    /// Sets the *profile id* path property to the given value.
80478    ///
80479    /// Even though the property as already been set when instantiating this call,
80480    /// we provide this method for API completeness.
80481    pub fn profile_id(mut self, new_value: i64) -> UserRoleDeleteCall<'a, C> {
80482        self._profile_id = new_value;
80483        self
80484    }
80485    /// User role ID.
80486    ///
80487    /// Sets the *id* path property to the given value.
80488    ///
80489    /// Even though the property as already been set when instantiating this call,
80490    /// we provide this method for API completeness.
80491    pub fn id(mut self, new_value: i64) -> UserRoleDeleteCall<'a, C> {
80492        self._id = new_value;
80493        self
80494    }
80495    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
80496    /// while executing the actual API request.
80497    ///
80498    /// ````text
80499    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
80500    /// ````
80501    ///
80502    /// Sets the *delegate* property to the given value.
80503    pub fn delegate(
80504        mut self,
80505        new_value: &'a mut dyn common::Delegate,
80506    ) -> UserRoleDeleteCall<'a, C> {
80507        self._delegate = Some(new_value);
80508        self
80509    }
80510
80511    /// Set any additional parameter of the query string used in the request.
80512    /// It should be used to set parameters which are not yet available through their own
80513    /// setters.
80514    ///
80515    /// Please note that this method must not be used to set any of the known parameters
80516    /// which have their own setter method. If done anyway, the request will fail.
80517    ///
80518    /// # Additional Parameters
80519    ///
80520    /// * *$.xgafv* (query-string) - V1 error format.
80521    /// * *access_token* (query-string) - OAuth access token.
80522    /// * *alt* (query-string) - Data format for response.
80523    /// * *callback* (query-string) - JSONP
80524    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
80525    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
80526    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
80527    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
80528    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
80529    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
80530    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
80531    pub fn param<T>(mut self, name: T, value: T) -> UserRoleDeleteCall<'a, C>
80532    where
80533        T: AsRef<str>,
80534    {
80535        self._additional_params
80536            .insert(name.as_ref().to_string(), value.as_ref().to_string());
80537        self
80538    }
80539
80540    /// Identifies the authorization scope for the method you are building.
80541    ///
80542    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
80543    /// [`Scope::Dfatrafficking`].
80544    ///
80545    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
80546    /// tokens for more than one scope.
80547    ///
80548    /// Usually there is more than one suitable scope to authorize an operation, some of which may
80549    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
80550    /// sufficient, a read-write scope will do as well.
80551    pub fn add_scope<St>(mut self, scope: St) -> UserRoleDeleteCall<'a, C>
80552    where
80553        St: AsRef<str>,
80554    {
80555        self._scopes.insert(String::from(scope.as_ref()));
80556        self
80557    }
80558    /// Identifies the authorization scope(s) for the method you are building.
80559    ///
80560    /// See [`Self::add_scope()`] for details.
80561    pub fn add_scopes<I, St>(mut self, scopes: I) -> UserRoleDeleteCall<'a, C>
80562    where
80563        I: IntoIterator<Item = St>,
80564        St: AsRef<str>,
80565    {
80566        self._scopes
80567            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
80568        self
80569    }
80570
80571    /// Removes all scopes, and no default scope will be used either.
80572    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
80573    /// for details).
80574    pub fn clear_scopes(mut self) -> UserRoleDeleteCall<'a, C> {
80575        self._scopes.clear();
80576        self
80577    }
80578}
80579
80580/// Gets one user role by ID.
80581///
80582/// A builder for the *get* method supported by a *userRole* resource.
80583/// It is not used directly, but through a [`UserRoleMethods`] instance.
80584///
80585/// # Example
80586///
80587/// Instantiate a resource method builder
80588///
80589/// ```test_harness,no_run
80590/// # extern crate hyper;
80591/// # extern crate hyper_rustls;
80592/// # extern crate google_dfareporting3d3 as dfareporting3d3;
80593/// # async fn dox() {
80594/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
80595///
80596/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
80597/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
80598/// #     secret,
80599/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
80600/// # ).build().await.unwrap();
80601///
80602/// # let client = hyper_util::client::legacy::Client::builder(
80603/// #     hyper_util::rt::TokioExecutor::new()
80604/// # )
80605/// # .build(
80606/// #     hyper_rustls::HttpsConnectorBuilder::new()
80607/// #         .with_native_roots()
80608/// #         .unwrap()
80609/// #         .https_or_http()
80610/// #         .enable_http1()
80611/// #         .build()
80612/// # );
80613/// # let mut hub = Dfareporting::new(client, auth);
80614/// // You can configure optional parameters by calling the respective setters at will, and
80615/// // execute the final call using `doit()`.
80616/// // Values shown here are possibly random and not representative !
80617/// let result = hub.user_roles().get(-20, -92)
80618///              .doit().await;
80619/// # }
80620/// ```
80621pub struct UserRoleGetCall<'a, C>
80622where
80623    C: 'a,
80624{
80625    hub: &'a Dfareporting<C>,
80626    _profile_id: i64,
80627    _id: i64,
80628    _delegate: Option<&'a mut dyn common::Delegate>,
80629    _additional_params: HashMap<String, String>,
80630    _scopes: BTreeSet<String>,
80631}
80632
80633impl<'a, C> common::CallBuilder for UserRoleGetCall<'a, C> {}
80634
80635impl<'a, C> UserRoleGetCall<'a, C>
80636where
80637    C: common::Connector,
80638{
80639    /// Perform the operation you have build so far.
80640    pub async fn doit(mut self) -> common::Result<(common::Response, UserRole)> {
80641        use std::borrow::Cow;
80642        use std::io::{Read, Seek};
80643
80644        use common::{url::Params, ToParts};
80645        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
80646
80647        let mut dd = common::DefaultDelegate;
80648        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
80649        dlg.begin(common::MethodInfo {
80650            id: "dfareporting.userRoles.get",
80651            http_method: hyper::Method::GET,
80652        });
80653
80654        for &field in ["alt", "profileId", "id"].iter() {
80655            if self._additional_params.contains_key(field) {
80656                dlg.finished(false);
80657                return Err(common::Error::FieldClash(field));
80658            }
80659        }
80660
80661        let mut params = Params::with_capacity(4 + self._additional_params.len());
80662        params.push("profileId", self._profile_id.to_string());
80663        params.push("id", self._id.to_string());
80664
80665        params.extend(self._additional_params.iter());
80666
80667        params.push("alt", "json");
80668        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/userRoles/{id}";
80669        if self._scopes.is_empty() {
80670            self._scopes
80671                .insert(Scope::Dfatrafficking.as_ref().to_string());
80672        }
80673
80674        #[allow(clippy::single_element_loop)]
80675        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
80676            url = params.uri_replacement(url, param_name, find_this, false);
80677        }
80678        {
80679            let to_remove = ["id", "profileId"];
80680            params.remove_params(&to_remove);
80681        }
80682
80683        let url = params.parse_with_url(&url);
80684
80685        loop {
80686            let token = match self
80687                .hub
80688                .auth
80689                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
80690                .await
80691            {
80692                Ok(token) => token,
80693                Err(e) => match dlg.token(e) {
80694                    Ok(token) => token,
80695                    Err(e) => {
80696                        dlg.finished(false);
80697                        return Err(common::Error::MissingToken(e));
80698                    }
80699                },
80700            };
80701            let mut req_result = {
80702                let client = &self.hub.client;
80703                dlg.pre_request();
80704                let mut req_builder = hyper::Request::builder()
80705                    .method(hyper::Method::GET)
80706                    .uri(url.as_str())
80707                    .header(USER_AGENT, self.hub._user_agent.clone());
80708
80709                if let Some(token) = token.as_ref() {
80710                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
80711                }
80712
80713                let request = req_builder
80714                    .header(CONTENT_LENGTH, 0_u64)
80715                    .body(common::to_body::<String>(None));
80716
80717                client.request(request.unwrap()).await
80718            };
80719
80720            match req_result {
80721                Err(err) => {
80722                    if let common::Retry::After(d) = dlg.http_error(&err) {
80723                        sleep(d).await;
80724                        continue;
80725                    }
80726                    dlg.finished(false);
80727                    return Err(common::Error::HttpError(err));
80728                }
80729                Ok(res) => {
80730                    let (mut parts, body) = res.into_parts();
80731                    let mut body = common::Body::new(body);
80732                    if !parts.status.is_success() {
80733                        let bytes = common::to_bytes(body).await.unwrap_or_default();
80734                        let error = serde_json::from_str(&common::to_string(&bytes));
80735                        let response = common::to_response(parts, bytes.into());
80736
80737                        if let common::Retry::After(d) =
80738                            dlg.http_failure(&response, error.as_ref().ok())
80739                        {
80740                            sleep(d).await;
80741                            continue;
80742                        }
80743
80744                        dlg.finished(false);
80745
80746                        return Err(match error {
80747                            Ok(value) => common::Error::BadRequest(value),
80748                            _ => common::Error::Failure(response),
80749                        });
80750                    }
80751                    let response = {
80752                        let bytes = common::to_bytes(body).await.unwrap_or_default();
80753                        let encoded = common::to_string(&bytes);
80754                        match serde_json::from_str(&encoded) {
80755                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
80756                            Err(error) => {
80757                                dlg.response_json_decode_error(&encoded, &error);
80758                                return Err(common::Error::JsonDecodeError(
80759                                    encoded.to_string(),
80760                                    error,
80761                                ));
80762                            }
80763                        }
80764                    };
80765
80766                    dlg.finished(true);
80767                    return Ok(response);
80768                }
80769            }
80770        }
80771    }
80772
80773    /// User profile ID associated with this request.
80774    ///
80775    /// Sets the *profile id* path property to the given value.
80776    ///
80777    /// Even though the property as already been set when instantiating this call,
80778    /// we provide this method for API completeness.
80779    pub fn profile_id(mut self, new_value: i64) -> UserRoleGetCall<'a, C> {
80780        self._profile_id = new_value;
80781        self
80782    }
80783    /// User role ID.
80784    ///
80785    /// Sets the *id* path property to the given value.
80786    ///
80787    /// Even though the property as already been set when instantiating this call,
80788    /// we provide this method for API completeness.
80789    pub fn id(mut self, new_value: i64) -> UserRoleGetCall<'a, C> {
80790        self._id = new_value;
80791        self
80792    }
80793    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
80794    /// while executing the actual API request.
80795    ///
80796    /// ````text
80797    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
80798    /// ````
80799    ///
80800    /// Sets the *delegate* property to the given value.
80801    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> UserRoleGetCall<'a, C> {
80802        self._delegate = Some(new_value);
80803        self
80804    }
80805
80806    /// Set any additional parameter of the query string used in the request.
80807    /// It should be used to set parameters which are not yet available through their own
80808    /// setters.
80809    ///
80810    /// Please note that this method must not be used to set any of the known parameters
80811    /// which have their own setter method. If done anyway, the request will fail.
80812    ///
80813    /// # Additional Parameters
80814    ///
80815    /// * *$.xgafv* (query-string) - V1 error format.
80816    /// * *access_token* (query-string) - OAuth access token.
80817    /// * *alt* (query-string) - Data format for response.
80818    /// * *callback* (query-string) - JSONP
80819    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
80820    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
80821    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
80822    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
80823    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
80824    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
80825    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
80826    pub fn param<T>(mut self, name: T, value: T) -> UserRoleGetCall<'a, C>
80827    where
80828        T: AsRef<str>,
80829    {
80830        self._additional_params
80831            .insert(name.as_ref().to_string(), value.as_ref().to_string());
80832        self
80833    }
80834
80835    /// Identifies the authorization scope for the method you are building.
80836    ///
80837    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
80838    /// [`Scope::Dfatrafficking`].
80839    ///
80840    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
80841    /// tokens for more than one scope.
80842    ///
80843    /// Usually there is more than one suitable scope to authorize an operation, some of which may
80844    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
80845    /// sufficient, a read-write scope will do as well.
80846    pub fn add_scope<St>(mut self, scope: St) -> UserRoleGetCall<'a, C>
80847    where
80848        St: AsRef<str>,
80849    {
80850        self._scopes.insert(String::from(scope.as_ref()));
80851        self
80852    }
80853    /// Identifies the authorization scope(s) for the method you are building.
80854    ///
80855    /// See [`Self::add_scope()`] for details.
80856    pub fn add_scopes<I, St>(mut self, scopes: I) -> UserRoleGetCall<'a, C>
80857    where
80858        I: IntoIterator<Item = St>,
80859        St: AsRef<str>,
80860    {
80861        self._scopes
80862            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
80863        self
80864    }
80865
80866    /// Removes all scopes, and no default scope will be used either.
80867    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
80868    /// for details).
80869    pub fn clear_scopes(mut self) -> UserRoleGetCall<'a, C> {
80870        self._scopes.clear();
80871        self
80872    }
80873}
80874
80875/// Inserts a new user role.
80876///
80877/// A builder for the *insert* method supported by a *userRole* resource.
80878/// It is not used directly, but through a [`UserRoleMethods`] instance.
80879///
80880/// # Example
80881///
80882/// Instantiate a resource method builder
80883///
80884/// ```test_harness,no_run
80885/// # extern crate hyper;
80886/// # extern crate hyper_rustls;
80887/// # extern crate google_dfareporting3d3 as dfareporting3d3;
80888/// use dfareporting3d3::api::UserRole;
80889/// # async fn dox() {
80890/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
80891///
80892/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
80893/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
80894/// #     secret,
80895/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
80896/// # ).build().await.unwrap();
80897///
80898/// # let client = hyper_util::client::legacy::Client::builder(
80899/// #     hyper_util::rt::TokioExecutor::new()
80900/// # )
80901/// # .build(
80902/// #     hyper_rustls::HttpsConnectorBuilder::new()
80903/// #         .with_native_roots()
80904/// #         .unwrap()
80905/// #         .https_or_http()
80906/// #         .enable_http1()
80907/// #         .build()
80908/// # );
80909/// # let mut hub = Dfareporting::new(client, auth);
80910/// // As the method needs a request, you would usually fill it with the desired information
80911/// // into the respective structure. Some of the parts shown here might not be applicable !
80912/// // Values shown here are possibly random and not representative !
80913/// let mut req = UserRole::default();
80914///
80915/// // You can configure optional parameters by calling the respective setters at will, and
80916/// // execute the final call using `doit()`.
80917/// // Values shown here are possibly random and not representative !
80918/// let result = hub.user_roles().insert(req, -72)
80919///              .doit().await;
80920/// # }
80921/// ```
80922pub struct UserRoleInsertCall<'a, C>
80923where
80924    C: 'a,
80925{
80926    hub: &'a Dfareporting<C>,
80927    _request: UserRole,
80928    _profile_id: i64,
80929    _delegate: Option<&'a mut dyn common::Delegate>,
80930    _additional_params: HashMap<String, String>,
80931    _scopes: BTreeSet<String>,
80932}
80933
80934impl<'a, C> common::CallBuilder for UserRoleInsertCall<'a, C> {}
80935
80936impl<'a, C> UserRoleInsertCall<'a, C>
80937where
80938    C: common::Connector,
80939{
80940    /// Perform the operation you have build so far.
80941    pub async fn doit(mut self) -> common::Result<(common::Response, UserRole)> {
80942        use std::borrow::Cow;
80943        use std::io::{Read, Seek};
80944
80945        use common::{url::Params, ToParts};
80946        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
80947
80948        let mut dd = common::DefaultDelegate;
80949        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
80950        dlg.begin(common::MethodInfo {
80951            id: "dfareporting.userRoles.insert",
80952            http_method: hyper::Method::POST,
80953        });
80954
80955        for &field in ["alt", "profileId"].iter() {
80956            if self._additional_params.contains_key(field) {
80957                dlg.finished(false);
80958                return Err(common::Error::FieldClash(field));
80959            }
80960        }
80961
80962        let mut params = Params::with_capacity(4 + self._additional_params.len());
80963        params.push("profileId", self._profile_id.to_string());
80964
80965        params.extend(self._additional_params.iter());
80966
80967        params.push("alt", "json");
80968        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/userRoles";
80969        if self._scopes.is_empty() {
80970            self._scopes
80971                .insert(Scope::Dfatrafficking.as_ref().to_string());
80972        }
80973
80974        #[allow(clippy::single_element_loop)]
80975        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
80976            url = params.uri_replacement(url, param_name, find_this, false);
80977        }
80978        {
80979            let to_remove = ["profileId"];
80980            params.remove_params(&to_remove);
80981        }
80982
80983        let url = params.parse_with_url(&url);
80984
80985        let mut json_mime_type = mime::APPLICATION_JSON;
80986        let mut request_value_reader = {
80987            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
80988            common::remove_json_null_values(&mut value);
80989            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
80990            serde_json::to_writer(&mut dst, &value).unwrap();
80991            dst
80992        };
80993        let request_size = request_value_reader
80994            .seek(std::io::SeekFrom::End(0))
80995            .unwrap();
80996        request_value_reader
80997            .seek(std::io::SeekFrom::Start(0))
80998            .unwrap();
80999
81000        loop {
81001            let token = match self
81002                .hub
81003                .auth
81004                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
81005                .await
81006            {
81007                Ok(token) => token,
81008                Err(e) => match dlg.token(e) {
81009                    Ok(token) => token,
81010                    Err(e) => {
81011                        dlg.finished(false);
81012                        return Err(common::Error::MissingToken(e));
81013                    }
81014                },
81015            };
81016            request_value_reader
81017                .seek(std::io::SeekFrom::Start(0))
81018                .unwrap();
81019            let mut req_result = {
81020                let client = &self.hub.client;
81021                dlg.pre_request();
81022                let mut req_builder = hyper::Request::builder()
81023                    .method(hyper::Method::POST)
81024                    .uri(url.as_str())
81025                    .header(USER_AGENT, self.hub._user_agent.clone());
81026
81027                if let Some(token) = token.as_ref() {
81028                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
81029                }
81030
81031                let request = req_builder
81032                    .header(CONTENT_TYPE, json_mime_type.to_string())
81033                    .header(CONTENT_LENGTH, request_size as u64)
81034                    .body(common::to_body(
81035                        request_value_reader.get_ref().clone().into(),
81036                    ));
81037
81038                client.request(request.unwrap()).await
81039            };
81040
81041            match req_result {
81042                Err(err) => {
81043                    if let common::Retry::After(d) = dlg.http_error(&err) {
81044                        sleep(d).await;
81045                        continue;
81046                    }
81047                    dlg.finished(false);
81048                    return Err(common::Error::HttpError(err));
81049                }
81050                Ok(res) => {
81051                    let (mut parts, body) = res.into_parts();
81052                    let mut body = common::Body::new(body);
81053                    if !parts.status.is_success() {
81054                        let bytes = common::to_bytes(body).await.unwrap_or_default();
81055                        let error = serde_json::from_str(&common::to_string(&bytes));
81056                        let response = common::to_response(parts, bytes.into());
81057
81058                        if let common::Retry::After(d) =
81059                            dlg.http_failure(&response, error.as_ref().ok())
81060                        {
81061                            sleep(d).await;
81062                            continue;
81063                        }
81064
81065                        dlg.finished(false);
81066
81067                        return Err(match error {
81068                            Ok(value) => common::Error::BadRequest(value),
81069                            _ => common::Error::Failure(response),
81070                        });
81071                    }
81072                    let response = {
81073                        let bytes = common::to_bytes(body).await.unwrap_or_default();
81074                        let encoded = common::to_string(&bytes);
81075                        match serde_json::from_str(&encoded) {
81076                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
81077                            Err(error) => {
81078                                dlg.response_json_decode_error(&encoded, &error);
81079                                return Err(common::Error::JsonDecodeError(
81080                                    encoded.to_string(),
81081                                    error,
81082                                ));
81083                            }
81084                        }
81085                    };
81086
81087                    dlg.finished(true);
81088                    return Ok(response);
81089                }
81090            }
81091        }
81092    }
81093
81094    ///
81095    /// Sets the *request* property to the given value.
81096    ///
81097    /// Even though the property as already been set when instantiating this call,
81098    /// we provide this method for API completeness.
81099    pub fn request(mut self, new_value: UserRole) -> UserRoleInsertCall<'a, C> {
81100        self._request = new_value;
81101        self
81102    }
81103    /// User profile ID associated with this request.
81104    ///
81105    /// Sets the *profile id* path property to the given value.
81106    ///
81107    /// Even though the property as already been set when instantiating this call,
81108    /// we provide this method for API completeness.
81109    pub fn profile_id(mut self, new_value: i64) -> UserRoleInsertCall<'a, C> {
81110        self._profile_id = new_value;
81111        self
81112    }
81113    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
81114    /// while executing the actual API request.
81115    ///
81116    /// ````text
81117    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
81118    /// ````
81119    ///
81120    /// Sets the *delegate* property to the given value.
81121    pub fn delegate(
81122        mut self,
81123        new_value: &'a mut dyn common::Delegate,
81124    ) -> UserRoleInsertCall<'a, C> {
81125        self._delegate = Some(new_value);
81126        self
81127    }
81128
81129    /// Set any additional parameter of the query string used in the request.
81130    /// It should be used to set parameters which are not yet available through their own
81131    /// setters.
81132    ///
81133    /// Please note that this method must not be used to set any of the known parameters
81134    /// which have their own setter method. If done anyway, the request will fail.
81135    ///
81136    /// # Additional Parameters
81137    ///
81138    /// * *$.xgafv* (query-string) - V1 error format.
81139    /// * *access_token* (query-string) - OAuth access token.
81140    /// * *alt* (query-string) - Data format for response.
81141    /// * *callback* (query-string) - JSONP
81142    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
81143    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
81144    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
81145    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
81146    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
81147    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
81148    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
81149    pub fn param<T>(mut self, name: T, value: T) -> UserRoleInsertCall<'a, C>
81150    where
81151        T: AsRef<str>,
81152    {
81153        self._additional_params
81154            .insert(name.as_ref().to_string(), value.as_ref().to_string());
81155        self
81156    }
81157
81158    /// Identifies the authorization scope for the method you are building.
81159    ///
81160    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
81161    /// [`Scope::Dfatrafficking`].
81162    ///
81163    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
81164    /// tokens for more than one scope.
81165    ///
81166    /// Usually there is more than one suitable scope to authorize an operation, some of which may
81167    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
81168    /// sufficient, a read-write scope will do as well.
81169    pub fn add_scope<St>(mut self, scope: St) -> UserRoleInsertCall<'a, C>
81170    where
81171        St: AsRef<str>,
81172    {
81173        self._scopes.insert(String::from(scope.as_ref()));
81174        self
81175    }
81176    /// Identifies the authorization scope(s) for the method you are building.
81177    ///
81178    /// See [`Self::add_scope()`] for details.
81179    pub fn add_scopes<I, St>(mut self, scopes: I) -> UserRoleInsertCall<'a, C>
81180    where
81181        I: IntoIterator<Item = St>,
81182        St: AsRef<str>,
81183    {
81184        self._scopes
81185            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
81186        self
81187    }
81188
81189    /// Removes all scopes, and no default scope will be used either.
81190    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
81191    /// for details).
81192    pub fn clear_scopes(mut self) -> UserRoleInsertCall<'a, C> {
81193        self._scopes.clear();
81194        self
81195    }
81196}
81197
81198/// Retrieves a list of user roles, possibly filtered. This method supports paging.
81199///
81200/// A builder for the *list* method supported by a *userRole* resource.
81201/// It is not used directly, but through a [`UserRoleMethods`] instance.
81202///
81203/// # Example
81204///
81205/// Instantiate a resource method builder
81206///
81207/// ```test_harness,no_run
81208/// # extern crate hyper;
81209/// # extern crate hyper_rustls;
81210/// # extern crate google_dfareporting3d3 as dfareporting3d3;
81211/// # async fn dox() {
81212/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
81213///
81214/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
81215/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
81216/// #     secret,
81217/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
81218/// # ).build().await.unwrap();
81219///
81220/// # let client = hyper_util::client::legacy::Client::builder(
81221/// #     hyper_util::rt::TokioExecutor::new()
81222/// # )
81223/// # .build(
81224/// #     hyper_rustls::HttpsConnectorBuilder::new()
81225/// #         .with_native_roots()
81226/// #         .unwrap()
81227/// #         .https_or_http()
81228/// #         .enable_http1()
81229/// #         .build()
81230/// # );
81231/// # let mut hub = Dfareporting::new(client, auth);
81232/// // You can configure optional parameters by calling the respective setters at will, and
81233/// // execute the final call using `doit()`.
81234/// // Values shown here are possibly random and not representative !
81235/// let result = hub.user_roles().list(-101)
81236///              .subaccount_id(-11)
81237///              .sort_order("sea")
81238///              .sort_field("et")
81239///              .search_string("voluptua.")
81240///              .page_token("ipsum")
81241///              .max_results(-67)
81242///              .add_ids(-5)
81243///              .account_user_role_only(true)
81244///              .doit().await;
81245/// # }
81246/// ```
81247pub struct UserRoleListCall<'a, C>
81248where
81249    C: 'a,
81250{
81251    hub: &'a Dfareporting<C>,
81252    _profile_id: i64,
81253    _subaccount_id: Option<i64>,
81254    _sort_order: Option<String>,
81255    _sort_field: Option<String>,
81256    _search_string: Option<String>,
81257    _page_token: Option<String>,
81258    _max_results: Option<i32>,
81259    _ids: Vec<i64>,
81260    _account_user_role_only: Option<bool>,
81261    _delegate: Option<&'a mut dyn common::Delegate>,
81262    _additional_params: HashMap<String, String>,
81263    _scopes: BTreeSet<String>,
81264}
81265
81266impl<'a, C> common::CallBuilder for UserRoleListCall<'a, C> {}
81267
81268impl<'a, C> UserRoleListCall<'a, C>
81269where
81270    C: common::Connector,
81271{
81272    /// Perform the operation you have build so far.
81273    pub async fn doit(mut self) -> common::Result<(common::Response, UserRolesListResponse)> {
81274        use std::borrow::Cow;
81275        use std::io::{Read, Seek};
81276
81277        use common::{url::Params, ToParts};
81278        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
81279
81280        let mut dd = common::DefaultDelegate;
81281        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
81282        dlg.begin(common::MethodInfo {
81283            id: "dfareporting.userRoles.list",
81284            http_method: hyper::Method::GET,
81285        });
81286
81287        for &field in [
81288            "alt",
81289            "profileId",
81290            "subaccountId",
81291            "sortOrder",
81292            "sortField",
81293            "searchString",
81294            "pageToken",
81295            "maxResults",
81296            "ids",
81297            "accountUserRoleOnly",
81298        ]
81299        .iter()
81300        {
81301            if self._additional_params.contains_key(field) {
81302                dlg.finished(false);
81303                return Err(common::Error::FieldClash(field));
81304            }
81305        }
81306
81307        let mut params = Params::with_capacity(11 + self._additional_params.len());
81308        params.push("profileId", self._profile_id.to_string());
81309        if let Some(value) = self._subaccount_id.as_ref() {
81310            params.push("subaccountId", value.to_string());
81311        }
81312        if let Some(value) = self._sort_order.as_ref() {
81313            params.push("sortOrder", value);
81314        }
81315        if let Some(value) = self._sort_field.as_ref() {
81316            params.push("sortField", value);
81317        }
81318        if let Some(value) = self._search_string.as_ref() {
81319            params.push("searchString", value);
81320        }
81321        if let Some(value) = self._page_token.as_ref() {
81322            params.push("pageToken", value);
81323        }
81324        if let Some(value) = self._max_results.as_ref() {
81325            params.push("maxResults", value.to_string());
81326        }
81327        if !self._ids.is_empty() {
81328            for f in self._ids.iter() {
81329                params.push("ids", f.to_string());
81330            }
81331        }
81332        if let Some(value) = self._account_user_role_only.as_ref() {
81333            params.push("accountUserRoleOnly", value.to_string());
81334        }
81335
81336        params.extend(self._additional_params.iter());
81337
81338        params.push("alt", "json");
81339        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/userRoles";
81340        if self._scopes.is_empty() {
81341            self._scopes
81342                .insert(Scope::Dfatrafficking.as_ref().to_string());
81343        }
81344
81345        #[allow(clippy::single_element_loop)]
81346        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
81347            url = params.uri_replacement(url, param_name, find_this, false);
81348        }
81349        {
81350            let to_remove = ["profileId"];
81351            params.remove_params(&to_remove);
81352        }
81353
81354        let url = params.parse_with_url(&url);
81355
81356        loop {
81357            let token = match self
81358                .hub
81359                .auth
81360                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
81361                .await
81362            {
81363                Ok(token) => token,
81364                Err(e) => match dlg.token(e) {
81365                    Ok(token) => token,
81366                    Err(e) => {
81367                        dlg.finished(false);
81368                        return Err(common::Error::MissingToken(e));
81369                    }
81370                },
81371            };
81372            let mut req_result = {
81373                let client = &self.hub.client;
81374                dlg.pre_request();
81375                let mut req_builder = hyper::Request::builder()
81376                    .method(hyper::Method::GET)
81377                    .uri(url.as_str())
81378                    .header(USER_AGENT, self.hub._user_agent.clone());
81379
81380                if let Some(token) = token.as_ref() {
81381                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
81382                }
81383
81384                let request = req_builder
81385                    .header(CONTENT_LENGTH, 0_u64)
81386                    .body(common::to_body::<String>(None));
81387
81388                client.request(request.unwrap()).await
81389            };
81390
81391            match req_result {
81392                Err(err) => {
81393                    if let common::Retry::After(d) = dlg.http_error(&err) {
81394                        sleep(d).await;
81395                        continue;
81396                    }
81397                    dlg.finished(false);
81398                    return Err(common::Error::HttpError(err));
81399                }
81400                Ok(res) => {
81401                    let (mut parts, body) = res.into_parts();
81402                    let mut body = common::Body::new(body);
81403                    if !parts.status.is_success() {
81404                        let bytes = common::to_bytes(body).await.unwrap_or_default();
81405                        let error = serde_json::from_str(&common::to_string(&bytes));
81406                        let response = common::to_response(parts, bytes.into());
81407
81408                        if let common::Retry::After(d) =
81409                            dlg.http_failure(&response, error.as_ref().ok())
81410                        {
81411                            sleep(d).await;
81412                            continue;
81413                        }
81414
81415                        dlg.finished(false);
81416
81417                        return Err(match error {
81418                            Ok(value) => common::Error::BadRequest(value),
81419                            _ => common::Error::Failure(response),
81420                        });
81421                    }
81422                    let response = {
81423                        let bytes = common::to_bytes(body).await.unwrap_or_default();
81424                        let encoded = common::to_string(&bytes);
81425                        match serde_json::from_str(&encoded) {
81426                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
81427                            Err(error) => {
81428                                dlg.response_json_decode_error(&encoded, &error);
81429                                return Err(common::Error::JsonDecodeError(
81430                                    encoded.to_string(),
81431                                    error,
81432                                ));
81433                            }
81434                        }
81435                    };
81436
81437                    dlg.finished(true);
81438                    return Ok(response);
81439                }
81440            }
81441        }
81442    }
81443
81444    /// User profile ID associated with this request.
81445    ///
81446    /// Sets the *profile id* path property to the given value.
81447    ///
81448    /// Even though the property as already been set when instantiating this call,
81449    /// we provide this method for API completeness.
81450    pub fn profile_id(mut self, new_value: i64) -> UserRoleListCall<'a, C> {
81451        self._profile_id = new_value;
81452        self
81453    }
81454    /// Select only user roles that belong to this subaccount.
81455    ///
81456    /// Sets the *subaccount id* query property to the given value.
81457    pub fn subaccount_id(mut self, new_value: i64) -> UserRoleListCall<'a, C> {
81458        self._subaccount_id = Some(new_value);
81459        self
81460    }
81461    /// Order of sorted results.
81462    ///
81463    /// Sets the *sort order* query property to the given value.
81464    pub fn sort_order(mut self, new_value: &str) -> UserRoleListCall<'a, C> {
81465        self._sort_order = Some(new_value.to_string());
81466        self
81467    }
81468    /// Field by which to sort the list.
81469    ///
81470    /// Sets the *sort field* query property to the given value.
81471    pub fn sort_field(mut self, new_value: &str) -> UserRoleListCall<'a, C> {
81472        self._sort_field = Some(new_value.to_string());
81473        self
81474    }
81475    /// Allows searching for objects by name or ID. Wildcards (*) are allowed. For example, "userrole*2015" will return objects with names like "userrole June 2015", "userrole April 2015", or simply "userrole 2015". Most of the searches also add wildcards implicitly at the start and the end of the search string. For example, a search string of "userrole" will match objects with name "my userrole", "userrole 2015", or simply "userrole".
81476    ///
81477    /// Sets the *search string* query property to the given value.
81478    pub fn search_string(mut self, new_value: &str) -> UserRoleListCall<'a, C> {
81479        self._search_string = Some(new_value.to_string());
81480        self
81481    }
81482    /// Value of the nextPageToken from the previous result page.
81483    ///
81484    /// Sets the *page token* query property to the given value.
81485    pub fn page_token(mut self, new_value: &str) -> UserRoleListCall<'a, C> {
81486        self._page_token = Some(new_value.to_string());
81487        self
81488    }
81489    /// Maximum number of results to return.
81490    ///
81491    /// Sets the *max results* query property to the given value.
81492    pub fn max_results(mut self, new_value: i32) -> UserRoleListCall<'a, C> {
81493        self._max_results = Some(new_value);
81494        self
81495    }
81496    /// Select only user roles with the specified IDs.
81497    ///
81498    /// Append the given value to the *ids* query property.
81499    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
81500    pub fn add_ids(mut self, new_value: i64) -> UserRoleListCall<'a, C> {
81501        self._ids.push(new_value);
81502        self
81503    }
81504    /// Select only account level user roles not associated with any specific subaccount.
81505    ///
81506    /// Sets the *account user role only* query property to the given value.
81507    pub fn account_user_role_only(mut self, new_value: bool) -> UserRoleListCall<'a, C> {
81508        self._account_user_role_only = Some(new_value);
81509        self
81510    }
81511    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
81512    /// while executing the actual API request.
81513    ///
81514    /// ````text
81515    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
81516    /// ````
81517    ///
81518    /// Sets the *delegate* property to the given value.
81519    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> UserRoleListCall<'a, C> {
81520        self._delegate = Some(new_value);
81521        self
81522    }
81523
81524    /// Set any additional parameter of the query string used in the request.
81525    /// It should be used to set parameters which are not yet available through their own
81526    /// setters.
81527    ///
81528    /// Please note that this method must not be used to set any of the known parameters
81529    /// which have their own setter method. If done anyway, the request will fail.
81530    ///
81531    /// # Additional Parameters
81532    ///
81533    /// * *$.xgafv* (query-string) - V1 error format.
81534    /// * *access_token* (query-string) - OAuth access token.
81535    /// * *alt* (query-string) - Data format for response.
81536    /// * *callback* (query-string) - JSONP
81537    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
81538    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
81539    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
81540    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
81541    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
81542    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
81543    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
81544    pub fn param<T>(mut self, name: T, value: T) -> UserRoleListCall<'a, C>
81545    where
81546        T: AsRef<str>,
81547    {
81548        self._additional_params
81549            .insert(name.as_ref().to_string(), value.as_ref().to_string());
81550        self
81551    }
81552
81553    /// Identifies the authorization scope for the method you are building.
81554    ///
81555    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
81556    /// [`Scope::Dfatrafficking`].
81557    ///
81558    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
81559    /// tokens for more than one scope.
81560    ///
81561    /// Usually there is more than one suitable scope to authorize an operation, some of which may
81562    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
81563    /// sufficient, a read-write scope will do as well.
81564    pub fn add_scope<St>(mut self, scope: St) -> UserRoleListCall<'a, C>
81565    where
81566        St: AsRef<str>,
81567    {
81568        self._scopes.insert(String::from(scope.as_ref()));
81569        self
81570    }
81571    /// Identifies the authorization scope(s) for the method you are building.
81572    ///
81573    /// See [`Self::add_scope()`] for details.
81574    pub fn add_scopes<I, St>(mut self, scopes: I) -> UserRoleListCall<'a, C>
81575    where
81576        I: IntoIterator<Item = St>,
81577        St: AsRef<str>,
81578    {
81579        self._scopes
81580            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
81581        self
81582    }
81583
81584    /// Removes all scopes, and no default scope will be used either.
81585    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
81586    /// for details).
81587    pub fn clear_scopes(mut self) -> UserRoleListCall<'a, C> {
81588        self._scopes.clear();
81589        self
81590    }
81591}
81592
81593/// Updates an existing user role. This method supports patch semantics.
81594///
81595/// A builder for the *patch* method supported by a *userRole* resource.
81596/// It is not used directly, but through a [`UserRoleMethods`] instance.
81597///
81598/// # Example
81599///
81600/// Instantiate a resource method builder
81601///
81602/// ```test_harness,no_run
81603/// # extern crate hyper;
81604/// # extern crate hyper_rustls;
81605/// # extern crate google_dfareporting3d3 as dfareporting3d3;
81606/// use dfareporting3d3::api::UserRole;
81607/// # async fn dox() {
81608/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
81609///
81610/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
81611/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
81612/// #     secret,
81613/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
81614/// # ).build().await.unwrap();
81615///
81616/// # let client = hyper_util::client::legacy::Client::builder(
81617/// #     hyper_util::rt::TokioExecutor::new()
81618/// # )
81619/// # .build(
81620/// #     hyper_rustls::HttpsConnectorBuilder::new()
81621/// #         .with_native_roots()
81622/// #         .unwrap()
81623/// #         .https_or_http()
81624/// #         .enable_http1()
81625/// #         .build()
81626/// # );
81627/// # let mut hub = Dfareporting::new(client, auth);
81628/// // As the method needs a request, you would usually fill it with the desired information
81629/// // into the respective structure. Some of the parts shown here might not be applicable !
81630/// // Values shown here are possibly random and not representative !
81631/// let mut req = UserRole::default();
81632///
81633/// // You can configure optional parameters by calling the respective setters at will, and
81634/// // execute the final call using `doit()`.
81635/// // Values shown here are possibly random and not representative !
81636/// let result = hub.user_roles().patch(req, -69, -44)
81637///              .doit().await;
81638/// # }
81639/// ```
81640pub struct UserRolePatchCall<'a, C>
81641where
81642    C: 'a,
81643{
81644    hub: &'a Dfareporting<C>,
81645    _request: UserRole,
81646    _profile_id: i64,
81647    _id: i64,
81648    _delegate: Option<&'a mut dyn common::Delegate>,
81649    _additional_params: HashMap<String, String>,
81650    _scopes: BTreeSet<String>,
81651}
81652
81653impl<'a, C> common::CallBuilder for UserRolePatchCall<'a, C> {}
81654
81655impl<'a, C> UserRolePatchCall<'a, C>
81656where
81657    C: common::Connector,
81658{
81659    /// Perform the operation you have build so far.
81660    pub async fn doit(mut self) -> common::Result<(common::Response, UserRole)> {
81661        use std::borrow::Cow;
81662        use std::io::{Read, Seek};
81663
81664        use common::{url::Params, ToParts};
81665        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
81666
81667        let mut dd = common::DefaultDelegate;
81668        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
81669        dlg.begin(common::MethodInfo {
81670            id: "dfareporting.userRoles.patch",
81671            http_method: hyper::Method::PATCH,
81672        });
81673
81674        for &field in ["alt", "profileId", "id"].iter() {
81675            if self._additional_params.contains_key(field) {
81676                dlg.finished(false);
81677                return Err(common::Error::FieldClash(field));
81678            }
81679        }
81680
81681        let mut params = Params::with_capacity(5 + self._additional_params.len());
81682        params.push("profileId", self._profile_id.to_string());
81683        params.push("id", self._id.to_string());
81684
81685        params.extend(self._additional_params.iter());
81686
81687        params.push("alt", "json");
81688        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/userRoles";
81689        if self._scopes.is_empty() {
81690            self._scopes
81691                .insert(Scope::Dfatrafficking.as_ref().to_string());
81692        }
81693
81694        #[allow(clippy::single_element_loop)]
81695        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
81696            url = params.uri_replacement(url, param_name, find_this, false);
81697        }
81698        {
81699            let to_remove = ["profileId"];
81700            params.remove_params(&to_remove);
81701        }
81702
81703        let url = params.parse_with_url(&url);
81704
81705        let mut json_mime_type = mime::APPLICATION_JSON;
81706        let mut request_value_reader = {
81707            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
81708            common::remove_json_null_values(&mut value);
81709            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
81710            serde_json::to_writer(&mut dst, &value).unwrap();
81711            dst
81712        };
81713        let request_size = request_value_reader
81714            .seek(std::io::SeekFrom::End(0))
81715            .unwrap();
81716        request_value_reader
81717            .seek(std::io::SeekFrom::Start(0))
81718            .unwrap();
81719
81720        loop {
81721            let token = match self
81722                .hub
81723                .auth
81724                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
81725                .await
81726            {
81727                Ok(token) => token,
81728                Err(e) => match dlg.token(e) {
81729                    Ok(token) => token,
81730                    Err(e) => {
81731                        dlg.finished(false);
81732                        return Err(common::Error::MissingToken(e));
81733                    }
81734                },
81735            };
81736            request_value_reader
81737                .seek(std::io::SeekFrom::Start(0))
81738                .unwrap();
81739            let mut req_result = {
81740                let client = &self.hub.client;
81741                dlg.pre_request();
81742                let mut req_builder = hyper::Request::builder()
81743                    .method(hyper::Method::PATCH)
81744                    .uri(url.as_str())
81745                    .header(USER_AGENT, self.hub._user_agent.clone());
81746
81747                if let Some(token) = token.as_ref() {
81748                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
81749                }
81750
81751                let request = req_builder
81752                    .header(CONTENT_TYPE, json_mime_type.to_string())
81753                    .header(CONTENT_LENGTH, request_size as u64)
81754                    .body(common::to_body(
81755                        request_value_reader.get_ref().clone().into(),
81756                    ));
81757
81758                client.request(request.unwrap()).await
81759            };
81760
81761            match req_result {
81762                Err(err) => {
81763                    if let common::Retry::After(d) = dlg.http_error(&err) {
81764                        sleep(d).await;
81765                        continue;
81766                    }
81767                    dlg.finished(false);
81768                    return Err(common::Error::HttpError(err));
81769                }
81770                Ok(res) => {
81771                    let (mut parts, body) = res.into_parts();
81772                    let mut body = common::Body::new(body);
81773                    if !parts.status.is_success() {
81774                        let bytes = common::to_bytes(body).await.unwrap_or_default();
81775                        let error = serde_json::from_str(&common::to_string(&bytes));
81776                        let response = common::to_response(parts, bytes.into());
81777
81778                        if let common::Retry::After(d) =
81779                            dlg.http_failure(&response, error.as_ref().ok())
81780                        {
81781                            sleep(d).await;
81782                            continue;
81783                        }
81784
81785                        dlg.finished(false);
81786
81787                        return Err(match error {
81788                            Ok(value) => common::Error::BadRequest(value),
81789                            _ => common::Error::Failure(response),
81790                        });
81791                    }
81792                    let response = {
81793                        let bytes = common::to_bytes(body).await.unwrap_or_default();
81794                        let encoded = common::to_string(&bytes);
81795                        match serde_json::from_str(&encoded) {
81796                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
81797                            Err(error) => {
81798                                dlg.response_json_decode_error(&encoded, &error);
81799                                return Err(common::Error::JsonDecodeError(
81800                                    encoded.to_string(),
81801                                    error,
81802                                ));
81803                            }
81804                        }
81805                    };
81806
81807                    dlg.finished(true);
81808                    return Ok(response);
81809                }
81810            }
81811        }
81812    }
81813
81814    ///
81815    /// Sets the *request* property to the given value.
81816    ///
81817    /// Even though the property as already been set when instantiating this call,
81818    /// we provide this method for API completeness.
81819    pub fn request(mut self, new_value: UserRole) -> UserRolePatchCall<'a, C> {
81820        self._request = new_value;
81821        self
81822    }
81823    /// User profile ID associated with this request.
81824    ///
81825    /// Sets the *profile id* path property to the given value.
81826    ///
81827    /// Even though the property as already been set when instantiating this call,
81828    /// we provide this method for API completeness.
81829    pub fn profile_id(mut self, new_value: i64) -> UserRolePatchCall<'a, C> {
81830        self._profile_id = new_value;
81831        self
81832    }
81833    /// UserRole ID.
81834    ///
81835    /// Sets the *id* query property to the given value.
81836    ///
81837    /// Even though the property as already been set when instantiating this call,
81838    /// we provide this method for API completeness.
81839    pub fn id(mut self, new_value: i64) -> UserRolePatchCall<'a, C> {
81840        self._id = new_value;
81841        self
81842    }
81843    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
81844    /// while executing the actual API request.
81845    ///
81846    /// ````text
81847    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
81848    /// ````
81849    ///
81850    /// Sets the *delegate* property to the given value.
81851    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> UserRolePatchCall<'a, C> {
81852        self._delegate = Some(new_value);
81853        self
81854    }
81855
81856    /// Set any additional parameter of the query string used in the request.
81857    /// It should be used to set parameters which are not yet available through their own
81858    /// setters.
81859    ///
81860    /// Please note that this method must not be used to set any of the known parameters
81861    /// which have their own setter method. If done anyway, the request will fail.
81862    ///
81863    /// # Additional Parameters
81864    ///
81865    /// * *$.xgafv* (query-string) - V1 error format.
81866    /// * *access_token* (query-string) - OAuth access token.
81867    /// * *alt* (query-string) - Data format for response.
81868    /// * *callback* (query-string) - JSONP
81869    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
81870    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
81871    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
81872    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
81873    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
81874    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
81875    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
81876    pub fn param<T>(mut self, name: T, value: T) -> UserRolePatchCall<'a, C>
81877    where
81878        T: AsRef<str>,
81879    {
81880        self._additional_params
81881            .insert(name.as_ref().to_string(), value.as_ref().to_string());
81882        self
81883    }
81884
81885    /// Identifies the authorization scope for the method you are building.
81886    ///
81887    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
81888    /// [`Scope::Dfatrafficking`].
81889    ///
81890    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
81891    /// tokens for more than one scope.
81892    ///
81893    /// Usually there is more than one suitable scope to authorize an operation, some of which may
81894    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
81895    /// sufficient, a read-write scope will do as well.
81896    pub fn add_scope<St>(mut self, scope: St) -> UserRolePatchCall<'a, C>
81897    where
81898        St: AsRef<str>,
81899    {
81900        self._scopes.insert(String::from(scope.as_ref()));
81901        self
81902    }
81903    /// Identifies the authorization scope(s) for the method you are building.
81904    ///
81905    /// See [`Self::add_scope()`] for details.
81906    pub fn add_scopes<I, St>(mut self, scopes: I) -> UserRolePatchCall<'a, C>
81907    where
81908        I: IntoIterator<Item = St>,
81909        St: AsRef<str>,
81910    {
81911        self._scopes
81912            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
81913        self
81914    }
81915
81916    /// Removes all scopes, and no default scope will be used either.
81917    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
81918    /// for details).
81919    pub fn clear_scopes(mut self) -> UserRolePatchCall<'a, C> {
81920        self._scopes.clear();
81921        self
81922    }
81923}
81924
81925/// Updates an existing user role.
81926///
81927/// A builder for the *update* method supported by a *userRole* resource.
81928/// It is not used directly, but through a [`UserRoleMethods`] instance.
81929///
81930/// # Example
81931///
81932/// Instantiate a resource method builder
81933///
81934/// ```test_harness,no_run
81935/// # extern crate hyper;
81936/// # extern crate hyper_rustls;
81937/// # extern crate google_dfareporting3d3 as dfareporting3d3;
81938/// use dfareporting3d3::api::UserRole;
81939/// # async fn dox() {
81940/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
81941///
81942/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
81943/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
81944/// #     secret,
81945/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
81946/// # ).build().await.unwrap();
81947///
81948/// # let client = hyper_util::client::legacy::Client::builder(
81949/// #     hyper_util::rt::TokioExecutor::new()
81950/// # )
81951/// # .build(
81952/// #     hyper_rustls::HttpsConnectorBuilder::new()
81953/// #         .with_native_roots()
81954/// #         .unwrap()
81955/// #         .https_or_http()
81956/// #         .enable_http1()
81957/// #         .build()
81958/// # );
81959/// # let mut hub = Dfareporting::new(client, auth);
81960/// // As the method needs a request, you would usually fill it with the desired information
81961/// // into the respective structure. Some of the parts shown here might not be applicable !
81962/// // Values shown here are possibly random and not representative !
81963/// let mut req = UserRole::default();
81964///
81965/// // You can configure optional parameters by calling the respective setters at will, and
81966/// // execute the final call using `doit()`.
81967/// // Values shown here are possibly random and not representative !
81968/// let result = hub.user_roles().update(req, -79)
81969///              .doit().await;
81970/// # }
81971/// ```
81972pub struct UserRoleUpdateCall<'a, C>
81973where
81974    C: 'a,
81975{
81976    hub: &'a Dfareporting<C>,
81977    _request: UserRole,
81978    _profile_id: i64,
81979    _delegate: Option<&'a mut dyn common::Delegate>,
81980    _additional_params: HashMap<String, String>,
81981    _scopes: BTreeSet<String>,
81982}
81983
81984impl<'a, C> common::CallBuilder for UserRoleUpdateCall<'a, C> {}
81985
81986impl<'a, C> UserRoleUpdateCall<'a, C>
81987where
81988    C: common::Connector,
81989{
81990    /// Perform the operation you have build so far.
81991    pub async fn doit(mut self) -> common::Result<(common::Response, UserRole)> {
81992        use std::borrow::Cow;
81993        use std::io::{Read, Seek};
81994
81995        use common::{url::Params, ToParts};
81996        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
81997
81998        let mut dd = common::DefaultDelegate;
81999        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
82000        dlg.begin(common::MethodInfo {
82001            id: "dfareporting.userRoles.update",
82002            http_method: hyper::Method::PUT,
82003        });
82004
82005        for &field in ["alt", "profileId"].iter() {
82006            if self._additional_params.contains_key(field) {
82007                dlg.finished(false);
82008                return Err(common::Error::FieldClash(field));
82009            }
82010        }
82011
82012        let mut params = Params::with_capacity(4 + self._additional_params.len());
82013        params.push("profileId", self._profile_id.to_string());
82014
82015        params.extend(self._additional_params.iter());
82016
82017        params.push("alt", "json");
82018        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/userRoles";
82019        if self._scopes.is_empty() {
82020            self._scopes
82021                .insert(Scope::Dfatrafficking.as_ref().to_string());
82022        }
82023
82024        #[allow(clippy::single_element_loop)]
82025        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
82026            url = params.uri_replacement(url, param_name, find_this, false);
82027        }
82028        {
82029            let to_remove = ["profileId"];
82030            params.remove_params(&to_remove);
82031        }
82032
82033        let url = params.parse_with_url(&url);
82034
82035        let mut json_mime_type = mime::APPLICATION_JSON;
82036        let mut request_value_reader = {
82037            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
82038            common::remove_json_null_values(&mut value);
82039            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
82040            serde_json::to_writer(&mut dst, &value).unwrap();
82041            dst
82042        };
82043        let request_size = request_value_reader
82044            .seek(std::io::SeekFrom::End(0))
82045            .unwrap();
82046        request_value_reader
82047            .seek(std::io::SeekFrom::Start(0))
82048            .unwrap();
82049
82050        loop {
82051            let token = match self
82052                .hub
82053                .auth
82054                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
82055                .await
82056            {
82057                Ok(token) => token,
82058                Err(e) => match dlg.token(e) {
82059                    Ok(token) => token,
82060                    Err(e) => {
82061                        dlg.finished(false);
82062                        return Err(common::Error::MissingToken(e));
82063                    }
82064                },
82065            };
82066            request_value_reader
82067                .seek(std::io::SeekFrom::Start(0))
82068                .unwrap();
82069            let mut req_result = {
82070                let client = &self.hub.client;
82071                dlg.pre_request();
82072                let mut req_builder = hyper::Request::builder()
82073                    .method(hyper::Method::PUT)
82074                    .uri(url.as_str())
82075                    .header(USER_AGENT, self.hub._user_agent.clone());
82076
82077                if let Some(token) = token.as_ref() {
82078                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
82079                }
82080
82081                let request = req_builder
82082                    .header(CONTENT_TYPE, json_mime_type.to_string())
82083                    .header(CONTENT_LENGTH, request_size as u64)
82084                    .body(common::to_body(
82085                        request_value_reader.get_ref().clone().into(),
82086                    ));
82087
82088                client.request(request.unwrap()).await
82089            };
82090
82091            match req_result {
82092                Err(err) => {
82093                    if let common::Retry::After(d) = dlg.http_error(&err) {
82094                        sleep(d).await;
82095                        continue;
82096                    }
82097                    dlg.finished(false);
82098                    return Err(common::Error::HttpError(err));
82099                }
82100                Ok(res) => {
82101                    let (mut parts, body) = res.into_parts();
82102                    let mut body = common::Body::new(body);
82103                    if !parts.status.is_success() {
82104                        let bytes = common::to_bytes(body).await.unwrap_or_default();
82105                        let error = serde_json::from_str(&common::to_string(&bytes));
82106                        let response = common::to_response(parts, bytes.into());
82107
82108                        if let common::Retry::After(d) =
82109                            dlg.http_failure(&response, error.as_ref().ok())
82110                        {
82111                            sleep(d).await;
82112                            continue;
82113                        }
82114
82115                        dlg.finished(false);
82116
82117                        return Err(match error {
82118                            Ok(value) => common::Error::BadRequest(value),
82119                            _ => common::Error::Failure(response),
82120                        });
82121                    }
82122                    let response = {
82123                        let bytes = common::to_bytes(body).await.unwrap_or_default();
82124                        let encoded = common::to_string(&bytes);
82125                        match serde_json::from_str(&encoded) {
82126                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
82127                            Err(error) => {
82128                                dlg.response_json_decode_error(&encoded, &error);
82129                                return Err(common::Error::JsonDecodeError(
82130                                    encoded.to_string(),
82131                                    error,
82132                                ));
82133                            }
82134                        }
82135                    };
82136
82137                    dlg.finished(true);
82138                    return Ok(response);
82139                }
82140            }
82141        }
82142    }
82143
82144    ///
82145    /// Sets the *request* property to the given value.
82146    ///
82147    /// Even though the property as already been set when instantiating this call,
82148    /// we provide this method for API completeness.
82149    pub fn request(mut self, new_value: UserRole) -> UserRoleUpdateCall<'a, C> {
82150        self._request = new_value;
82151        self
82152    }
82153    /// User profile ID associated with this request.
82154    ///
82155    /// Sets the *profile id* path property to the given value.
82156    ///
82157    /// Even though the property as already been set when instantiating this call,
82158    /// we provide this method for API completeness.
82159    pub fn profile_id(mut self, new_value: i64) -> UserRoleUpdateCall<'a, C> {
82160        self._profile_id = new_value;
82161        self
82162    }
82163    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
82164    /// while executing the actual API request.
82165    ///
82166    /// ````text
82167    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
82168    /// ````
82169    ///
82170    /// Sets the *delegate* property to the given value.
82171    pub fn delegate(
82172        mut self,
82173        new_value: &'a mut dyn common::Delegate,
82174    ) -> UserRoleUpdateCall<'a, C> {
82175        self._delegate = Some(new_value);
82176        self
82177    }
82178
82179    /// Set any additional parameter of the query string used in the request.
82180    /// It should be used to set parameters which are not yet available through their own
82181    /// setters.
82182    ///
82183    /// Please note that this method must not be used to set any of the known parameters
82184    /// which have their own setter method. If done anyway, the request will fail.
82185    ///
82186    /// # Additional Parameters
82187    ///
82188    /// * *$.xgafv* (query-string) - V1 error format.
82189    /// * *access_token* (query-string) - OAuth access token.
82190    /// * *alt* (query-string) - Data format for response.
82191    /// * *callback* (query-string) - JSONP
82192    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
82193    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
82194    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
82195    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
82196    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
82197    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
82198    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
82199    pub fn param<T>(mut self, name: T, value: T) -> UserRoleUpdateCall<'a, C>
82200    where
82201        T: AsRef<str>,
82202    {
82203        self._additional_params
82204            .insert(name.as_ref().to_string(), value.as_ref().to_string());
82205        self
82206    }
82207
82208    /// Identifies the authorization scope for the method you are building.
82209    ///
82210    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
82211    /// [`Scope::Dfatrafficking`].
82212    ///
82213    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
82214    /// tokens for more than one scope.
82215    ///
82216    /// Usually there is more than one suitable scope to authorize an operation, some of which may
82217    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
82218    /// sufficient, a read-write scope will do as well.
82219    pub fn add_scope<St>(mut self, scope: St) -> UserRoleUpdateCall<'a, C>
82220    where
82221        St: AsRef<str>,
82222    {
82223        self._scopes.insert(String::from(scope.as_ref()));
82224        self
82225    }
82226    /// Identifies the authorization scope(s) for the method you are building.
82227    ///
82228    /// See [`Self::add_scope()`] for details.
82229    pub fn add_scopes<I, St>(mut self, scopes: I) -> UserRoleUpdateCall<'a, C>
82230    where
82231        I: IntoIterator<Item = St>,
82232        St: AsRef<str>,
82233    {
82234        self._scopes
82235            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
82236        self
82237    }
82238
82239    /// Removes all scopes, and no default scope will be used either.
82240    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
82241    /// for details).
82242    pub fn clear_scopes(mut self) -> UserRoleUpdateCall<'a, C> {
82243        self._scopes.clear();
82244        self
82245    }
82246}
82247
82248/// Gets one video format by ID.
82249///
82250/// A builder for the *get* method supported by a *videoFormat* resource.
82251/// It is not used directly, but through a [`VideoFormatMethods`] instance.
82252///
82253/// # Example
82254///
82255/// Instantiate a resource method builder
82256///
82257/// ```test_harness,no_run
82258/// # extern crate hyper;
82259/// # extern crate hyper_rustls;
82260/// # extern crate google_dfareporting3d3 as dfareporting3d3;
82261/// # async fn dox() {
82262/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
82263///
82264/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
82265/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
82266/// #     secret,
82267/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
82268/// # ).build().await.unwrap();
82269///
82270/// # let client = hyper_util::client::legacy::Client::builder(
82271/// #     hyper_util::rt::TokioExecutor::new()
82272/// # )
82273/// # .build(
82274/// #     hyper_rustls::HttpsConnectorBuilder::new()
82275/// #         .with_native_roots()
82276/// #         .unwrap()
82277/// #         .https_or_http()
82278/// #         .enable_http1()
82279/// #         .build()
82280/// # );
82281/// # let mut hub = Dfareporting::new(client, auth);
82282/// // You can configure optional parameters by calling the respective setters at will, and
82283/// // execute the final call using `doit()`.
82284/// // Values shown here are possibly random and not representative !
82285/// let result = hub.video_formats().get(-93, -101)
82286///              .doit().await;
82287/// # }
82288/// ```
82289pub struct VideoFormatGetCall<'a, C>
82290where
82291    C: 'a,
82292{
82293    hub: &'a Dfareporting<C>,
82294    _profile_id: i64,
82295    _id: i32,
82296    _delegate: Option<&'a mut dyn common::Delegate>,
82297    _additional_params: HashMap<String, String>,
82298    _scopes: BTreeSet<String>,
82299}
82300
82301impl<'a, C> common::CallBuilder for VideoFormatGetCall<'a, C> {}
82302
82303impl<'a, C> VideoFormatGetCall<'a, C>
82304where
82305    C: common::Connector,
82306{
82307    /// Perform the operation you have build so far.
82308    pub async fn doit(mut self) -> common::Result<(common::Response, VideoFormat)> {
82309        use std::borrow::Cow;
82310        use std::io::{Read, Seek};
82311
82312        use common::{url::Params, ToParts};
82313        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
82314
82315        let mut dd = common::DefaultDelegate;
82316        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
82317        dlg.begin(common::MethodInfo {
82318            id: "dfareporting.videoFormats.get",
82319            http_method: hyper::Method::GET,
82320        });
82321
82322        for &field in ["alt", "profileId", "id"].iter() {
82323            if self._additional_params.contains_key(field) {
82324                dlg.finished(false);
82325                return Err(common::Error::FieldClash(field));
82326            }
82327        }
82328
82329        let mut params = Params::with_capacity(4 + self._additional_params.len());
82330        params.push("profileId", self._profile_id.to_string());
82331        params.push("id", self._id.to_string());
82332
82333        params.extend(self._additional_params.iter());
82334
82335        params.push("alt", "json");
82336        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/videoFormats/{id}";
82337        if self._scopes.is_empty() {
82338            self._scopes
82339                .insert(Scope::Dfatrafficking.as_ref().to_string());
82340        }
82341
82342        #[allow(clippy::single_element_loop)]
82343        for &(find_this, param_name) in [("{profileId}", "profileId"), ("{id}", "id")].iter() {
82344            url = params.uri_replacement(url, param_name, find_this, false);
82345        }
82346        {
82347            let to_remove = ["id", "profileId"];
82348            params.remove_params(&to_remove);
82349        }
82350
82351        let url = params.parse_with_url(&url);
82352
82353        loop {
82354            let token = match self
82355                .hub
82356                .auth
82357                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
82358                .await
82359            {
82360                Ok(token) => token,
82361                Err(e) => match dlg.token(e) {
82362                    Ok(token) => token,
82363                    Err(e) => {
82364                        dlg.finished(false);
82365                        return Err(common::Error::MissingToken(e));
82366                    }
82367                },
82368            };
82369            let mut req_result = {
82370                let client = &self.hub.client;
82371                dlg.pre_request();
82372                let mut req_builder = hyper::Request::builder()
82373                    .method(hyper::Method::GET)
82374                    .uri(url.as_str())
82375                    .header(USER_AGENT, self.hub._user_agent.clone());
82376
82377                if let Some(token) = token.as_ref() {
82378                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
82379                }
82380
82381                let request = req_builder
82382                    .header(CONTENT_LENGTH, 0_u64)
82383                    .body(common::to_body::<String>(None));
82384
82385                client.request(request.unwrap()).await
82386            };
82387
82388            match req_result {
82389                Err(err) => {
82390                    if let common::Retry::After(d) = dlg.http_error(&err) {
82391                        sleep(d).await;
82392                        continue;
82393                    }
82394                    dlg.finished(false);
82395                    return Err(common::Error::HttpError(err));
82396                }
82397                Ok(res) => {
82398                    let (mut parts, body) = res.into_parts();
82399                    let mut body = common::Body::new(body);
82400                    if !parts.status.is_success() {
82401                        let bytes = common::to_bytes(body).await.unwrap_or_default();
82402                        let error = serde_json::from_str(&common::to_string(&bytes));
82403                        let response = common::to_response(parts, bytes.into());
82404
82405                        if let common::Retry::After(d) =
82406                            dlg.http_failure(&response, error.as_ref().ok())
82407                        {
82408                            sleep(d).await;
82409                            continue;
82410                        }
82411
82412                        dlg.finished(false);
82413
82414                        return Err(match error {
82415                            Ok(value) => common::Error::BadRequest(value),
82416                            _ => common::Error::Failure(response),
82417                        });
82418                    }
82419                    let response = {
82420                        let bytes = common::to_bytes(body).await.unwrap_or_default();
82421                        let encoded = common::to_string(&bytes);
82422                        match serde_json::from_str(&encoded) {
82423                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
82424                            Err(error) => {
82425                                dlg.response_json_decode_error(&encoded, &error);
82426                                return Err(common::Error::JsonDecodeError(
82427                                    encoded.to_string(),
82428                                    error,
82429                                ));
82430                            }
82431                        }
82432                    };
82433
82434                    dlg.finished(true);
82435                    return Ok(response);
82436                }
82437            }
82438        }
82439    }
82440
82441    /// User profile ID associated with this request.
82442    ///
82443    /// Sets the *profile id* path property to the given value.
82444    ///
82445    /// Even though the property as already been set when instantiating this call,
82446    /// we provide this method for API completeness.
82447    pub fn profile_id(mut self, new_value: i64) -> VideoFormatGetCall<'a, C> {
82448        self._profile_id = new_value;
82449        self
82450    }
82451    /// Video format ID.
82452    ///
82453    /// Sets the *id* path property to the given value.
82454    ///
82455    /// Even though the property as already been set when instantiating this call,
82456    /// we provide this method for API completeness.
82457    pub fn id(mut self, new_value: i32) -> VideoFormatGetCall<'a, C> {
82458        self._id = new_value;
82459        self
82460    }
82461    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
82462    /// while executing the actual API request.
82463    ///
82464    /// ````text
82465    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
82466    /// ````
82467    ///
82468    /// Sets the *delegate* property to the given value.
82469    pub fn delegate(
82470        mut self,
82471        new_value: &'a mut dyn common::Delegate,
82472    ) -> VideoFormatGetCall<'a, C> {
82473        self._delegate = Some(new_value);
82474        self
82475    }
82476
82477    /// Set any additional parameter of the query string used in the request.
82478    /// It should be used to set parameters which are not yet available through their own
82479    /// setters.
82480    ///
82481    /// Please note that this method must not be used to set any of the known parameters
82482    /// which have their own setter method. If done anyway, the request will fail.
82483    ///
82484    /// # Additional Parameters
82485    ///
82486    /// * *$.xgafv* (query-string) - V1 error format.
82487    /// * *access_token* (query-string) - OAuth access token.
82488    /// * *alt* (query-string) - Data format for response.
82489    /// * *callback* (query-string) - JSONP
82490    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
82491    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
82492    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
82493    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
82494    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
82495    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
82496    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
82497    pub fn param<T>(mut self, name: T, value: T) -> VideoFormatGetCall<'a, C>
82498    where
82499        T: AsRef<str>,
82500    {
82501        self._additional_params
82502            .insert(name.as_ref().to_string(), value.as_ref().to_string());
82503        self
82504    }
82505
82506    /// Identifies the authorization scope for the method you are building.
82507    ///
82508    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
82509    /// [`Scope::Dfatrafficking`].
82510    ///
82511    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
82512    /// tokens for more than one scope.
82513    ///
82514    /// Usually there is more than one suitable scope to authorize an operation, some of which may
82515    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
82516    /// sufficient, a read-write scope will do as well.
82517    pub fn add_scope<St>(mut self, scope: St) -> VideoFormatGetCall<'a, C>
82518    where
82519        St: AsRef<str>,
82520    {
82521        self._scopes.insert(String::from(scope.as_ref()));
82522        self
82523    }
82524    /// Identifies the authorization scope(s) for the method you are building.
82525    ///
82526    /// See [`Self::add_scope()`] for details.
82527    pub fn add_scopes<I, St>(mut self, scopes: I) -> VideoFormatGetCall<'a, C>
82528    where
82529        I: IntoIterator<Item = St>,
82530        St: AsRef<str>,
82531    {
82532        self._scopes
82533            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
82534        self
82535    }
82536
82537    /// Removes all scopes, and no default scope will be used either.
82538    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
82539    /// for details).
82540    pub fn clear_scopes(mut self) -> VideoFormatGetCall<'a, C> {
82541        self._scopes.clear();
82542        self
82543    }
82544}
82545
82546/// Lists available video formats.
82547///
82548/// A builder for the *list* method supported by a *videoFormat* resource.
82549/// It is not used directly, but through a [`VideoFormatMethods`] instance.
82550///
82551/// # Example
82552///
82553/// Instantiate a resource method builder
82554///
82555/// ```test_harness,no_run
82556/// # extern crate hyper;
82557/// # extern crate hyper_rustls;
82558/// # extern crate google_dfareporting3d3 as dfareporting3d3;
82559/// # async fn dox() {
82560/// # use dfareporting3d3::{Dfareporting, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
82561///
82562/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
82563/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
82564/// #     secret,
82565/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
82566/// # ).build().await.unwrap();
82567///
82568/// # let client = hyper_util::client::legacy::Client::builder(
82569/// #     hyper_util::rt::TokioExecutor::new()
82570/// # )
82571/// # .build(
82572/// #     hyper_rustls::HttpsConnectorBuilder::new()
82573/// #         .with_native_roots()
82574/// #         .unwrap()
82575/// #         .https_or_http()
82576/// #         .enable_http1()
82577/// #         .build()
82578/// # );
82579/// # let mut hub = Dfareporting::new(client, auth);
82580/// // You can configure optional parameters by calling the respective setters at will, and
82581/// // execute the final call using `doit()`.
82582/// // Values shown here are possibly random and not representative !
82583/// let result = hub.video_formats().list(-33)
82584///              .doit().await;
82585/// # }
82586/// ```
82587pub struct VideoFormatListCall<'a, C>
82588where
82589    C: 'a,
82590{
82591    hub: &'a Dfareporting<C>,
82592    _profile_id: i64,
82593    _delegate: Option<&'a mut dyn common::Delegate>,
82594    _additional_params: HashMap<String, String>,
82595    _scopes: BTreeSet<String>,
82596}
82597
82598impl<'a, C> common::CallBuilder for VideoFormatListCall<'a, C> {}
82599
82600impl<'a, C> VideoFormatListCall<'a, C>
82601where
82602    C: common::Connector,
82603{
82604    /// Perform the operation you have build so far.
82605    pub async fn doit(mut self) -> common::Result<(common::Response, VideoFormatsListResponse)> {
82606        use std::borrow::Cow;
82607        use std::io::{Read, Seek};
82608
82609        use common::{url::Params, ToParts};
82610        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
82611
82612        let mut dd = common::DefaultDelegate;
82613        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
82614        dlg.begin(common::MethodInfo {
82615            id: "dfareporting.videoFormats.list",
82616            http_method: hyper::Method::GET,
82617        });
82618
82619        for &field in ["alt", "profileId"].iter() {
82620            if self._additional_params.contains_key(field) {
82621                dlg.finished(false);
82622                return Err(common::Error::FieldClash(field));
82623            }
82624        }
82625
82626        let mut params = Params::with_capacity(3 + self._additional_params.len());
82627        params.push("profileId", self._profile_id.to_string());
82628
82629        params.extend(self._additional_params.iter());
82630
82631        params.push("alt", "json");
82632        let mut url = self.hub._base_url.clone() + "userprofiles/{profileId}/videoFormats";
82633        if self._scopes.is_empty() {
82634            self._scopes
82635                .insert(Scope::Dfatrafficking.as_ref().to_string());
82636        }
82637
82638        #[allow(clippy::single_element_loop)]
82639        for &(find_this, param_name) in [("{profileId}", "profileId")].iter() {
82640            url = params.uri_replacement(url, param_name, find_this, false);
82641        }
82642        {
82643            let to_remove = ["profileId"];
82644            params.remove_params(&to_remove);
82645        }
82646
82647        let url = params.parse_with_url(&url);
82648
82649        loop {
82650            let token = match self
82651                .hub
82652                .auth
82653                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
82654                .await
82655            {
82656                Ok(token) => token,
82657                Err(e) => match dlg.token(e) {
82658                    Ok(token) => token,
82659                    Err(e) => {
82660                        dlg.finished(false);
82661                        return Err(common::Error::MissingToken(e));
82662                    }
82663                },
82664            };
82665            let mut req_result = {
82666                let client = &self.hub.client;
82667                dlg.pre_request();
82668                let mut req_builder = hyper::Request::builder()
82669                    .method(hyper::Method::GET)
82670                    .uri(url.as_str())
82671                    .header(USER_AGENT, self.hub._user_agent.clone());
82672
82673                if let Some(token) = token.as_ref() {
82674                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
82675                }
82676
82677                let request = req_builder
82678                    .header(CONTENT_LENGTH, 0_u64)
82679                    .body(common::to_body::<String>(None));
82680
82681                client.request(request.unwrap()).await
82682            };
82683
82684            match req_result {
82685                Err(err) => {
82686                    if let common::Retry::After(d) = dlg.http_error(&err) {
82687                        sleep(d).await;
82688                        continue;
82689                    }
82690                    dlg.finished(false);
82691                    return Err(common::Error::HttpError(err));
82692                }
82693                Ok(res) => {
82694                    let (mut parts, body) = res.into_parts();
82695                    let mut body = common::Body::new(body);
82696                    if !parts.status.is_success() {
82697                        let bytes = common::to_bytes(body).await.unwrap_or_default();
82698                        let error = serde_json::from_str(&common::to_string(&bytes));
82699                        let response = common::to_response(parts, bytes.into());
82700
82701                        if let common::Retry::After(d) =
82702                            dlg.http_failure(&response, error.as_ref().ok())
82703                        {
82704                            sleep(d).await;
82705                            continue;
82706                        }
82707
82708                        dlg.finished(false);
82709
82710                        return Err(match error {
82711                            Ok(value) => common::Error::BadRequest(value),
82712                            _ => common::Error::Failure(response),
82713                        });
82714                    }
82715                    let response = {
82716                        let bytes = common::to_bytes(body).await.unwrap_or_default();
82717                        let encoded = common::to_string(&bytes);
82718                        match serde_json::from_str(&encoded) {
82719                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
82720                            Err(error) => {
82721                                dlg.response_json_decode_error(&encoded, &error);
82722                                return Err(common::Error::JsonDecodeError(
82723                                    encoded.to_string(),
82724                                    error,
82725                                ));
82726                            }
82727                        }
82728                    };
82729
82730                    dlg.finished(true);
82731                    return Ok(response);
82732                }
82733            }
82734        }
82735    }
82736
82737    /// User profile ID associated with this request.
82738    ///
82739    /// Sets the *profile id* path property to the given value.
82740    ///
82741    /// Even though the property as already been set when instantiating this call,
82742    /// we provide this method for API completeness.
82743    pub fn profile_id(mut self, new_value: i64) -> VideoFormatListCall<'a, C> {
82744        self._profile_id = new_value;
82745        self
82746    }
82747    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
82748    /// while executing the actual API request.
82749    ///
82750    /// ````text
82751    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
82752    /// ````
82753    ///
82754    /// Sets the *delegate* property to the given value.
82755    pub fn delegate(
82756        mut self,
82757        new_value: &'a mut dyn common::Delegate,
82758    ) -> VideoFormatListCall<'a, C> {
82759        self._delegate = Some(new_value);
82760        self
82761    }
82762
82763    /// Set any additional parameter of the query string used in the request.
82764    /// It should be used to set parameters which are not yet available through their own
82765    /// setters.
82766    ///
82767    /// Please note that this method must not be used to set any of the known parameters
82768    /// which have their own setter method. If done anyway, the request will fail.
82769    ///
82770    /// # Additional Parameters
82771    ///
82772    /// * *$.xgafv* (query-string) - V1 error format.
82773    /// * *access_token* (query-string) - OAuth access token.
82774    /// * *alt* (query-string) - Data format for response.
82775    /// * *callback* (query-string) - JSONP
82776    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
82777    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
82778    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
82779    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
82780    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
82781    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
82782    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
82783    pub fn param<T>(mut self, name: T, value: T) -> VideoFormatListCall<'a, C>
82784    where
82785        T: AsRef<str>,
82786    {
82787        self._additional_params
82788            .insert(name.as_ref().to_string(), value.as_ref().to_string());
82789        self
82790    }
82791
82792    /// Identifies the authorization scope for the method you are building.
82793    ///
82794    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
82795    /// [`Scope::Dfatrafficking`].
82796    ///
82797    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
82798    /// tokens for more than one scope.
82799    ///
82800    /// Usually there is more than one suitable scope to authorize an operation, some of which may
82801    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
82802    /// sufficient, a read-write scope will do as well.
82803    pub fn add_scope<St>(mut self, scope: St) -> VideoFormatListCall<'a, C>
82804    where
82805        St: AsRef<str>,
82806    {
82807        self._scopes.insert(String::from(scope.as_ref()));
82808        self
82809    }
82810    /// Identifies the authorization scope(s) for the method you are building.
82811    ///
82812    /// See [`Self::add_scope()`] for details.
82813    pub fn add_scopes<I, St>(mut self, scopes: I) -> VideoFormatListCall<'a, C>
82814    where
82815        I: IntoIterator<Item = St>,
82816        St: AsRef<str>,
82817    {
82818        self._scopes
82819            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
82820        self
82821    }
82822
82823    /// Removes all scopes, and no default scope will be used either.
82824    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
82825    /// for details).
82826    pub fn clear_scopes(mut self) -> VideoFormatListCall<'a, C> {
82827        self._scopes.clear();
82828        self
82829    }
82830}